Repository navigation
Spark: TABLE t, VALUES ... AS t(a, b), DESC TABLE t (#13 onto the v0.63.0 branch) - #14
Merged
moshap-firebolt merged 2 commits intoOct 3, 2026
Conversation
…13) * Spark: TABLE t as a statement, VALUES ... AS t(a, b) as a query body Two dialect hooks, on for Spark, Databricks and Hive. supports_table_statement lets a statement start with TABLE, which parse_query already reads as SetExpr::Table. supports_values_alias reads a table alias with a column list after a VALUES body and rewrites the body as SELECT * FROM (VALUES ...) AS t(a, b), since a bare SetExpr::Values has nowhere to carry the alias; a reserved word after VALUES (UNION, ORDER, LIMIT) is not an alias. * parse_as_table: take a second name part only after a period It read three tokens unconditionally, so TABLE t ORDER BY a swallowed ORDER BY and then failed on what followed; the statement form is the first place a clause can follow the name. * Spark: read TABLE t as SELECT * FROM t in every query-body position The string-only SetExpr::Table drops identifier quoting and leaves consumers to special-case it at the top level. Under supports_table_statement, build a SELECT * over the parsed ObjectName instead, so TABLE works on set-operation sides, in CTEs, INSERT and CTAS, and keeps its quote style. * Spark: DESC TABLE t describes the table, not the query TABLE t With TABLE able to start a query, DESCRIBE TABLE t parsed as a describe of that query, and DESCRIBE TABLE EXTENDED t took EXTENDED for the table name. For DESC/DESCRIBE under supports_table_statement, a TABLE followed by a name now goes straight to the describe-table form, which accepts EXTENDED/FORMATTED after TABLE as Spark writes it and prints TABLE first. DESCRIBE table (a table named table) and EXPLAIN are unchanged.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 30670de. Configure here.
The alias was read after the whole query body, by which point a set operator had been consumed, so VALUES ... AS t(a) UNION ... failed. Read it where the VALUES operand is parsed, the way TABLE is.
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.

#13 was squash-merged into
firebolt/typed-numeric-suffixes, its stacked base, rather than intofirebolt/v0.63.0-patches. This carries that squash commit (d642873) onto the 0.63 branch as a clean cherry-pick.The cherry-pick's tree is byte-identical to 8c0c77d, the commit packdb master pins today. A second commit fixes a Bugbot finding: the
VALUESalias was read after the whole query body, so an aliasedVALUESbesideUNION/EXCEPT/INTERSECTfailed; it is now read where theVALUESoperand is parsed.Content, unchanged from #13:
supports_table_statement(Spark, Databricks, Hive):TABLE <name>parses asSELECT * FROM <name>in any query-body position, keeping the name's quoting.supports_values_alias:VALUES ... AS t(a, b)becomesSELECT * FROM (VALUES ...) AS t(a, b), on either side of a set operation.DESC [TABLE] [EXTENDED|FORMATTED] namestays a table describe instead of describing the queryTABLE name.parse_as_tabletakes a second name part only after a period.