Added index type of FlattenNode as LargeInteger #661
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the
getIndexVariableType()
method returnsOptional.empty()
.However, this can cause problems: When used as part of an IRI template, the variable has to be cast to
STRING
. Since we don't know what the base-type is, it will use aDefaultSimpleDBCastFunctionSymbol
. For this function symbol,isAlwaysInjectiveInTheAbsenceOfNonInjectiveFunctionalTerms()
returns false if the input type is unknown.This way, the
analyzeInjectivity(...)
method inFunctionSymbolImpl
will not return a decomposition; therefore, theConstructionNode
will not know that the Unique Constraint that may have been holding before the IRI construction will still hold, which prevents the query from being optimised.Adding an expected type for the index variable prevents all of this, and the unique constraint will be carried over.
I chose
DBLargeInteger
as the type, as this is the most reasonable one. It works with all currently supported databases, and there is no reason to assume an index of theFLATTEN
function for any different database may be of a non-integer type.