Conversation
6bc278e to
35e1763
Compare
SQLGlot Integration Test ResultsComparing:
By Dialect
Overallmain: 113552 total, 111862 passed (pass rate: 98.5%), sqlglot version: sqlglot:geooo109/json_path_refactor: 113552 total, 111830 passed (pass rate: 98.5%), sqlglot version: Transitions: |
7c54312 to
383d216
Compare
|
Will solve the tests and re-push |
| break | ||
| self.raise_error("Expected key name after '.'") | ||
| elif self._match(TokenType.L_BRACKET): | ||
| bracket_expr = self._parse_bracket_key_value() |
There was a problem hiding this comment.
bracket_expr = self._parse_disjunction()
^ this should be true for every case, less function calls
| if not bracket_expr: | ||
| continue |
There was a problem hiding this comment.
Should we raise here or even ignore the None ?
There was a problem hiding this comment.
What case does this correspond to? Is it a valid input? If not, ignore.
georgesittas
left a comment
There was a problem hiding this comment.
@geooo109 you checked all test cases against engines, right?
sqlglot/parser.py
Outdated
| path_parts.append(exp.JSONPathKey(this=next_key.name)) | ||
| else: | ||
| break | ||
| self.raise_error("Expected key name after '.'") |
There was a problem hiding this comment.
I'm not sure about these exceptions.. If we fail to convert the JSON path into a canonical / transpilable AST, is there any way to fallback to a safe representation so that Snowflake roundtrip is not messed up?
| if not bracket_expr: | ||
| continue |
There was a problem hiding this comment.
What case does this correspond to? Is it a valid input? If not, ignore.
| elif self._match(TokenType.DCOLON): | ||
| this, path_parts = self._build_json_extract(this, path_parts, escape) |
There was a problem hiding this comment.
Are brackets, dots and dcolons the only tokens we can find in these JSON path expressions, syntactically? In other words, is this branching logic complete?
49d750d to
afe1ba0
Compare
Refactored the
_parse_colon_as_variant_extractmethod.I added extensive tests for sf and sf -> duckdb:
/integration-tests