fdb-record-layer icon indicating copy to clipboard operation
fdb-record-layer copied to clipboard

Cascades throws Verify exception if a `KeyExpression`'s key is not primitive

Open hatyo opened this issue 4 months ago • 0 comments

It is possible to have a KeyExpression whose key is referencing a complex type. For example:

[Field { 'A' None}/Field { 'B' None}, Field { 'A' None}/Field { 'C' None}]

It is possible that C is a non-primitive (and non-enum) type. This is valid as long as there is a special code path that understands how to ser/de this field via a special Tuple encoding.

However, this is not something that Cascades expects, and throws an exception when it encounters such key when attempting to create a create a plan from the corresponding MatchCandidate:

https://github.com/FoundationDB/fdb-record-layer/blob/2f94a93d5d0526fe9e97d4bbcd63eec18e1df781/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/IndexEntryObjectValue.java#L79

Instead, Cascades should have an extra logic to handle this, and more importantly, ignore any KeyExpression it can not handle instead of throwing an exception safeguarding against potential evolution in KeyExpression semantics that it can not immediately deal with.

hatyo avatar Oct 04 '24 09:10 hatyo