Skip to content

Conversation

parkertimmins
Copy link
Contributor

@parkertimmins parkertimmins commented Sep 3, 2025

The existing blockloader for patterned_text does not work correctly. Update it so that patterned_text works in ESQL.

@parkertimmins parkertimmins added >non-issue :StorageEngine/Mapping The storage related side of mappings v9.2.0 labels Sep 3, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

query: 'FROM test | SORT @timestamp | KEEP message, message.template_id | LIMIT 10'

- match: {columns.0.name: "message"}
- match: {columns.0.type: "text"}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be updated to be patterned_text? This comes from the familyType, which is text. So I think leaving as text is correct 🤔

}
}

public static class BytesRefsFromSimpleBinary extends AbstractBytesRefsFromBinary {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing BytesRefsFromBinary reader assumes some structure within the ByteRefs provided by the BinaryDocValues. Specifically, a number of value and some length and offsets for each value. The BinaryDocValues created for patterned_text has no such structure: the returned BytesRef contains a single value, which is the message string.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, BytesRefsFromBinary is expecting the bytes read out of the BinaryDocValues to be encoded in the format used by BinaryFieldMapper.CustomBinaryDocValuesField.

Maybe add comments to both BytesRefsFromBinary and BytesRefsFromSimpleBinary explaining which format each expects?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, that's where it's from, thanks for tracking it down! Yeah, definitely makes sense to document how they are encoded. Thanks for the review!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then let's just rename this BytesRefsFromBinary?

Copy link
Contributor

@jordan-powers jordan-powers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one nit, otherwise LGTM!

}
}

public static class BytesRefsFromSimpleBinary extends AbstractBytesRefsFromBinary {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, BytesRefsFromBinary is expecting the bytes read out of the BinaryDocValues to be encoded in the format used by BinaryFieldMapper.CustomBinaryDocValuesField.

Maybe add comments to both BytesRefsFromBinary and BytesRefsFromSimpleBinary explaining which format each expects?

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a naming suggestion, LGTM otherwise!

/**
* Read BinaryDocValues encoded by {@link BinaryFieldMapper.CustomBinaryDocValuesField}
*/
static class BytesRefsFromBinary extends AbstractBytesRefsFromBinary {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename this BytesRefsFromBinary to BytesRefsFromCustomBinary? Given that it only works with bytes created by CustomBinaryDocValuesField?

}
}

public static class BytesRefsFromSimpleBinary extends AbstractBytesRefsFromBinary {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then let's just rename this BytesRefsFromBinary?

@parkertimmins parkertimmins merged commit fc32afd into elastic:main Sep 4, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants