siying commented on PR #59960:
URL: https://github.com/apache/spark/pull/59960#issuecomment-6596891731

   **Semantic check of the golden results (AI-assisted)**
   
   Checked: all 16 `results/streaming/available-now-*.sql.out` files, against 
their input SQL and data. Also checked that the 16 `analyzer-results` files are 
consistent with them.
   
   **Conclusion: every query result and every expected error is semantically 
correct for its query and input data.** The only issue found is in the PR 
description (last section below).
   
   **How it was checked**
   - **Positive tests:**
     - Expected rows were derived by hand.
     - They were re-computed with a small independent simulation of 
AvailableNow + watermark semantics. The simulation runs one data batch, then a 
no-data batch. In append mode, a group is emitted when `event_time <= 
watermark`, or `window.end <= watermark` for windows. The watermark is restored 
across refreshes and never moves backward.
     - Rows were compared with the batch goldens they are meant to mirror.
   - **Negative tests:**
     - Each expected error was traced to the `UnsupportedOperationChecker` / 
`CheckAnalysis` rule that should fire for that query shape.
     - No earlier check masks the intended error. For example, the append-mode 
watermark check passes wherever another error is the target.
     - Each `queryContext` fragment equals the 1-based `[startIndex, 
stopIndex]` slice of its `CREATE FLOW` text.
   
   **Positive tests**
   
   | File | Why the golden is right | |
   |---|---|---|
   | `cte` | Identity CTE over 0, 1, 2 (the values of `t` in `cte.sql`) gives 
0, 1, 2. | ✅ |
   | `rollup`, `cube` | All five courseSales rows share `event_time` 00:00:01. 
The zero-valued row at 00:00:10 moves the watermark to 00:00:09, so only the 
00:00:01 groups are emitted. Single column: NULL 113000, Java 50000, dotNET 
63000. Two columns: identical to `ROLLUP(course, year)` (7 rows) and 
`CUBE(course, year)` (9 rows, including NULL/2012 = 35000 and NULL/2013 = 
78000) in `group-analytics.sql.out`. | ✅ |
   | `stream-static-window-aggregation` | Refresh 1 (15, odd): watermark 5s, no 
window closes, sink empty. Refresh 2 (10, 11, 14): not late, and the watermark 
stays at 5s because 14 − 10 < 5, so the sink stays empty. Refresh 3 (25): 
watermark 15s closes `[10s, 15s)`, emitting `(10, even, 2)` and `(10, odd, 1)`. 
`[15s, 20s)` and `[25s, 30s)` stay open. | ✅ |
   
   **Negative tests**
   
   | File | Query shape | Error in golden | |
   |---|---|---|---|
   | `append-mode-errors` | `UNION` of two streams; `SELECT DISTINCT value`. In 
both, the only key is `value`, which has no watermark. | 
`STREAMING_OUTPUT_MODE.UNSUPPORTED_OPERATION` (streaming aggregations without 
watermark, append). The checker treats a streaming `Distinct` as an aggregate. 
| ✅ |
   | `distinct-aggregation-errors` | `COUNT(DISTINCT id)` grouped by the 
watermarked `event_time`, so the output-mode check passes. | Distinct 
aggregations are not supported | ✅ |
   | `join-asof-errors` | static `ASOF JOIN` stream (stream on the right) | 
ASOF join with a streaming DataFrame/Dataset on the right is not supported | ✅ |
   | `join-nearest-by-errors` | stream `JOIN` static `APPROX NEAREST 1 BY 
DISTANCE` | `NEAREST_BY_JOIN.STREAMING_NOT_SUPPORTED` | ✅ |
   | `join-outer-errors` | stream `FULL OUTER JOIN` static | FullOuter, 
streaming on the left / static on the right | ✅ |
   | `monotonic-id-errors` | `monotonically_increasing_id()` | Expression(s): 
monotonically_increasing_id() is not supported | ✅ |
   | `offset-errors` | `OFFSET 1` | Offset is not supported | ✅ |
   | `set-operation-errors` | stream `UNION ALL` batch; `INTERSECT`; `EXCEPT` 
with the stream on the left | Union between streaming and batch; Intersect of 
streaming; Except on the left 
(`spark.sql.streaming.allowExceptOnStreamingDataFrame` defaults to false) | ✅ |
   | `sort-errors` | `ORDER BY` on a non-aggregated stream | Sorting is not 
supported | ✅ |
   | `subquery-errors` | stream inside `EXISTS` | 
`INVALID_SUBQUERY_EXPRESSION.STREAMING_QUERY` | ✅ |
   | `tablesample-errors` | `TABLESAMPLE (50 PERCENT)` over a stream | Sampling 
is not supported | ✅ |
   | `window-errors` | `ROW_NUMBER() OVER (ORDER BY event_time)` | 
`NON_TIME_WINDOW_NOT_SUPPORTED_IN_STREAMING`, with the resolved default frame 
`ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW` | ✅ |
   
   **analyzer-results**
   
   The analyzer-results agree with the results:
   - The `CheckAnalysis` errors (NEAREST BY, streaming subquery) appear when 
the `CREATE FLOW` query is analyzed.
   - The `UnsupportedOperationChecker` errors appear only at `REFRESH FLOW`, 
because that checker runs when the query starts.
   - ROLLUP/CUBE `Expand` grouping IDs are correct: 0/1 for one column, 0/1/3 
for two-column ROLLUP, and 0/1/2/3 for two-column CUBE. The grouping keys carry 
the watermark.
   
   **Minor issue: PR description only**
   
   The description lists GROUPING SETS as positive coverage, but no input file 
uses `GROUPING SETS`; the tests use only `ROLLUP` and `CUBE`. Either add a 
test, for example one mirroring `GROUP BY course, year GROUPING SETS(course, 
year)` from `group-analytics.sql`, or drop GROUPING SETS from the description.
   
   The suite was not re-run. This is a review of the committed goldens at 
9ad03a3.
   
   
   ---
   <!-- GITHUB_MCP_FOOTER: This attribution is automatically appended by GitHub 
MCP. -->
   _This comment was generated with [GitHub MCP](http://go/mcps)._


-- 
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]

Reply via email to