ZdravDim opened a new pull request, #60718: URL: https://github.com/apache/spark/pull/60718
### What changes were proposed in this pull request? This is the second PR for the `GAP FILL` relation operator ([SPARK-61276](https://issues.apache.org/jira/browse/SPARK-61276)), after #60353 added the syntax. It resolves `GAP FILL` in the analyzer ([SPARK-61993](https://issues.apache.org/jira/browse/SPARK-61993)). - `ResolveGapFill` turns `UnresolvedGapFill` into a `Generate` with a new `GapFillGenerator`, and a `Project` above it that keeps the input column order. Only the partition columns pass through the `Generate`. Every other column becomes a new nullable column with the name, type, metadata and table name of its input column. - `GapFillResolution` checks the clauses in a fixed order and evaluates their constants. The single-pass analyzer can reuse it. - 15 new error classes, such as `GAP_FILL_TIME_TYPE_MISMATCH` and `GAP_FILL_INVALID_RANGE`, and 4 new `UNSUPPORTED_FEATURE` subclasses: `GAP_FILL_FILL_METHOD_TYPE`, `GAP_FILL_PARTITION_KEY_TYPE`, `GAP_FILL_TIMESTAMP_DAY_BIN_WIDTH` and `GAP_FILL_TIMESTAMP_NANOS`. - `CheckAnalysis` rejects a correlated input, a streaming input, and a metadata column of the input used above `GAP FILL`. A `GAP FILL` left unresolved after analysis gets `UNSUPPORTED_FEATURE.GAP_FILL` only when its input resolved after the Resolution batch. Any other clause error, such as an unresolved column, is reported as that error. - `OptimizeOneRowRelationSubquery` does not move a `GAP FILL` onto the rows of an outer query. There is no physical operator yet. Until a later PR adds one, the planner rejects a resolved `GAP FILL` with `UNSUPPORTED_FEATURE.GAP_FILL`. ### Why are the changes needed? Resolution is the second step of `GAP FILL`. The next PR adds the physical operator on top of the resolved plan. ### Does this PR introduce _any_ user-facing change? No. `spark.sql.gapFillRelationOperator.enabled` stays internal and off by default, so every `GAP FILL` query is still rejected with `UNSUPPORTED_FEATURE.GAP_FILL`. With the conf on, a `GAP FILL` query now gets its analysis errors, and a valid one is rejected at planning. ### How was this patch tested? - `ResolveGapFillSuite`: the output columns, the folded constants, each analysis error, the order in which errors are reported, and that an unresolved column or a type error in a clause keeps its own error. - `GapFillSuite`: `GAP FILL` from SQL text, including table names after joins and aliases, CHAR columns, metadata and hidden columns, LATERAL, correlated and streaming input, and the planner rejection. - `OptimizeOneRowRelationSubquerySuite`: a LATERAL `GAP FILL` over one row stays below the join. - `streaming/gap-fill.sql`: a streaming flow that uses `GAP FILL` is rejected. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5) This pull request and its description were written by Isaac. -- 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]
