dtenedor commented on PR #60367:
URL: https://github.com/apache/spark/pull/60367#issuecomment-6961953681
Thanks for the sixth round. All seven findings are addressed in the new
commit, and each inline thread has a reply.
On the P2 about three mechanisms of the DML guard that no test covered, the
new tests are:
- `OptionalReferencesAnalysisSuite`: an UPDATE built without the parser,
with `?` in an assignment or in its condition, fails with IN_DML naming UPDATE.
- `MergeIntoDataFrameSuite`: a source analyzed by the single-pass resolver,
whose `IF(is_active?, true, false)` folded the NULL, fails with IN_DML at
`is_active?`.
- The cost test also counts the lookups of the mark. Over 20 levels of
nested IN subqueries, in a DELETE condition and in a MERGE source, the search
visits every level once. The search for NULLs and marks is now a single
traversal.
With each mechanism reverted locally (the UPDATE arm, the single-pass mark,
a search that visits each subquery plan twice), its test fails.
Before pushing, I reviewed the whole PR again and fixed these:
- **Metric views:** their definitions now reject `?` with IN_DDL (context
METRIC VIEW). A query that reads a metric view resolves its definition as part
of its own analysis, unlike the query of a view. So a `?` that matched nothing
at creation could resolve to a session variable of the reader, and a DataFrame
MERGE whose source read the metric view was rejected because the reader's plan
carried the mark. This replaces the previous round's handling of metric view
creation as a view definition.
- **Views named by an IDENTIFIER clause:** inside a labeled script, `CREATE
TEMPORARY VIEW IDENTIFIER('v') AS SELECT lbl.missing? AS m` now fails at
creation like the other forms. Its command is built only after its query is
analyzed, so the parser now tags the plan that builds it. The golden file also
covers a label-qualified `?` in the body of a scalar or table SQL function
called from a view definition.
- **Variables in views:** a view now keeps the variable of a missing
optional field, such as `known_struct.b?`, whose NULL does not mention the
variable. A temporary view captures it, and a persistent view rejects it with
INVALID_TEMP_OBJ_REFERENCE, as for `known_struct.a`. Before, the temporary view
could not be read, and the persistent one was created.
- **Legacy conf for SQL function bodies:** `ResolveOptionalReferences` now
tells a subquery plan from the body of a SQL function that the subquery calls
by an explicit `AnalysisContext.isSubqueryPlan`, not by `outerPlan`. So
`spark.sql.legacy.sqlFunctionBodyResolvesOuterReferences` now also applies
while optional references are enabled.
- **Plan strings:** with the conf off, the plan strings of
`PosParameterizedQuery` and `GeneralParameterizedQuery` no longer show the new
`hasOptionalReferences` field.
About CI on the previous head, both failures are unrelated to this PR:
- `StateStoreInstanceMetricSuiteWithRowChecksum` failed again with the
`eventually` timeout on the snapshot lag metrics. SPARK-61788 fixes that test
on master.
- "sql - extended tests" lost its runner in the middle of
`SQLQueryTestSuite`: the log ends almost an hour before the job was marked
failed. The full `SQLQueryTestSuite` passes locally.
--
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]