| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Allow CAST as a table function argument (#307) Table function arguments are parsed by parseTableArgPrimaryExpr, which had no case for CAST. It read the keyword as an ordinary function name, so CAST's own AS separator ended the argument list and numbers(CAST(1 + 1 AS UInt64)) failed with "expected ')'". Route CAST to parseColumnCastExpr, as parseColumnExpr already does. CAST is not reserved, so it also matches TokenKindIdent and the new case has to come before that one. Only the argument list of a table function reaches this parser, never the table name, so a table called cast still parses. Both CAST spellings are covered, since parseColumnCastExpr reads AS and ',' alike. Checked against clickhouse-local 26.7.1, which accepts the new statements and their formatted output. Assistant By Claude Opus 5
Fix signed number after ')' or ']' being lexed as a literal (#286) (#287 ) `Lexer.hasPrecedenceToken` decides whether a `+`/`-` is a sign or a binary operator by looking at the previous token, but its set omitted the closing brackets. `(1)-1` and `arr[1]-1` therefore lexed `-1` as a signed literal, leaving two adjacent expressions with no operator, so valid ClickHouse SQL was rejected. Add `TokenKindRParen` and `TokenKindRBracket` to the set, since a closing bracket ends an expression just like an identifier or a number does.
Add COMMENT support to CREATE VIEW parser (#265) CREATE VIEW in ClickHouse supports COMMENT between the schema and AS SELECT: CREATE VIEW db.v (columns) COMMENT '{...}' AS SELECT ... The parser previously failed with 'expected EOF or ; but got COMMENT'. Changes: - Add Comment field to CreateView struct (ast.go) - Parse COMMENT clause in parseCreateView before AS (parser_view.go) - Format COMMENT in CreateView.FormatSQL (format.go) - Add test case: create_view_with_comment.sql - Update golden files for existing view tests (new nil Comment field)
Support expressions (dotted column refs) in `DISTINCT ON` (#258) parseDistinctOn() was calling parseIdent() which only handles simple identifiers. Queries like DISTINCT ON (t.id, t.name) would fail because the dot was not recognized. Changed to parseExpr() so that any valid column expression (including table.column references) is accepted.
bug: fix a crash with an invalid query following MODIFY QUERY (#215) ALTER TABLE foo MODIFY QUERY <an invalid query> crashed the parser with a sigsegv due to a missing error check; this commit adds the missing check and a regression test.
| Back | FazBrowse Home | New Git URL |