Fix inline property filter support for ANY graph queries#453
Closed
aheev wants to merge 1 commit intoLadybugDB:mainfrom
Closed
Fix inline property filter support for ANY graph queries#453aheev wants to merge 1 commit intoLadybugDB:mainfrom
aheev wants to merge 1 commit intoLadybugDB:mainfrom
Conversation
Two bugs prevented MATCH (a:Label { prop: val }) from working in ANY graphs:
1. JSON string serialization mismatch in ColumnCaster (scan_table.cpp):
yyjson_val_write() serialized JSON strings as '"Alice"' (with JSON quote
delimiters), but CAST(STRING → JSON) on the RHS produced 'Alice' (no
delimiters). Numbers accidentally worked because both sides produced '30'.
Fix: add jsonExtractScalarToString() which uses yyjson_get_str() for string
JSON values (returns raw string content), falling back to jsonToString() for
numbers and booleans.
2. Cardinality estimator crash (cardinality_estimator.cpp):
getTableStatsIfPossible() called entry->getColumnID(propertyName) without
checking whether the property actually exists as a column. In ANY graphs,
properties like 'age' are stored as JSON in the 'data' column — not as
individual columns — so nameToPropertyIDMap.at('age') threw unordered_map::at.
Fix: add entry->containsProperty(propertyName) guard before getColumnID call.
Also updates the QueryDynamicProperties test expectation: with the scan fix,
string properties now return unquoted values (e.g., Alice instead of "Alice"),
consistent with regular graph property access.
Adds four new test cases to test/test_files/graph/any.test:
- InlineIntPropertyFilter
- InlineStringPropertyFilter
- InlinePropertyFilterReturnStar
- InlinePropertyFilterNoMatch
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
This handles only the node filters. I was working on a more generic fix that handles both node and edge filters: Please review the incoming PR. Main delta is it touches map_extend.cpp |
Contributor
Author
|
fixed by #454 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two bugs prevented MATCH (a:Label { prop: val }) from working in ANY graphs:
JSON string serialization mismatch in ColumnCaster (scan_table.cpp): yyjson_val_write() serialized JSON strings as '"Alice"' (with JSON quote delimiters), but CAST(STRING → JSON) on the RHS produced 'Alice' (no delimiters). Numbers accidentally worked because both sides produced '30'. Fix: add jsonExtractScalarToString() which uses yyjson_get_str() for string JSON values (returns raw string content), falling back to jsonToString() for numbers and booleans.
Cardinality estimator crash (cardinality_estimator.cpp): getTableStatsIfPossible() called entry->getColumnID(propertyName) without checking whether the property actually exists as a column. In ANY graphs, properties like 'age' are stored as JSON in the 'data' column — not as individual columns — so nameToPropertyIDMap.at('age') threw unordered_map::at. Fix: add entry->containsProperty(propertyName) guard before getColumnID call.
Also updates the QueryDynamicProperties test expectation: with the scan fix, string properties now return unquoted values (e.g., Alice instead of "Alice"), consistent with regular graph property access.
Adds four new test cases to test/test_files/graph/any.test:
Closes #451