uros-b commented on PR #60353:
URL: https://github.com/apache/spark/pull/60353#issuecomment-6869594120
The syntax-only split looks right: GAP FILL parses to UnresolvedGapFill,
ResolveGapFill always throws UNSUPPORTED_FEATURE.GAP_FILL, and
spark.sql.gapFillRelationOperator.enabled (internal, 4.4.0, default false) only
changes whether a missing table is reported first. Keywords are non-reserved,
the pipe form matches the relation form, FILL columns are real Expressions, and
the PlanParserSuite / ResolveGapFillSuite coverage of clause order,
joins-vs-alias, and the gate is solid.
The duplicate-clause checks are the problem. checkDuplicateClauses(ctx.MAX /
ctx.FROM / ctx.ALIGN / ctx.BIN_START / ctx.IS_GENERATED) uses
ParserRuleContext.getTokens, which walks the whole GAP FILL subtree. Those
tokens also appear as identifiers and inside expressions, because the new words
are non-reserved (and MAX / FROM already were). FILL does not have this bug,
because it counts gapFillFillClause.
These fail with DUPLICATE_CLAUSES even though each clause appears once:
-- default names from the JIRA, valid identifiers
... BIN_START AS bin_start
... IS_GENERATED AS is_generated
-- ALIGN / MAX are the same token as the unquoted identifier
... ALIGN TO align
... MAX GAP max
-- FROM also appears in EXTRACT
... FROM ts TO ts + INTERVAL '1' DAY
ALIGN TO EXTRACT(YEAR FROM ts)
... MAX GAP max(ts)
Please give each optional clause its own parser rule, the way FILL already
has gapFillFillClause, and check those rule lists:
gapFillAlignClause: ALIGN TO origin=expression ;
gapFillRangeClause: FROM rangeStart=expression TO rangeEnd=expression ;
gapFillMaxGapClause: MAX GAP maxGap=expression ;
gapFillBinStartClause: BIN_START (AS
binStartAlias=errorCapturingIdentifier)? ;
gapFillIsGeneratedClause: IS_GENERATED (AS
isGeneratedAlias=errorCapturingIdentifier)? ;
Then add those AS-default-name and EXTRACT / max() cases next to the
existing DUPLICATE_CLAUSES tests.
Nit: the conf doc reads as if setting it to true turns GAP FILL on. In this
PR both values still throw; worth a sentence that resolution is not implemented
yet.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]