Repository navigation
[SQL] Rebuild a keyed table's whole row in an index closure under --gen2 - #7739
Conversation
With --gen2 the indexed value of a table with a primary key drops the key columns. An index closure that reads the whole row, such as the partitioning of a RANGE window over SELECT *, read that value as the row, and compilation failed with "Tuple field ... has type Tup3<..> that does not match the declared field type Tup4<..>". The closure now rebuilds the row from the key and the value. Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
|
What I ran
missing (medium): the new test only checks that compilation succeeds. The type checker catches a wrong key/value interleaving only when the swapped columns have different types. Two same-typed key columns in the wrong order would still pass. The test also covers just one shape (a single leading + /** A window reads the whole row of a table whose composite key is not leading. */
+ @Test
+ public void gen2WindowReadsTheWholeCompositeKeyedRow() {
+ String json = this.circuitJson(this.compile("""
+ CREATE TABLE t(a INT, k1 INT NOT NULL, x INT, k2 VARCHAR NOT NULL, ts INT, PRIMARY KEY (k2, k1));
+ CREATE VIEW v AS SELECT *, SUM(x) OVER (
+ PARTITION BY a ORDER BY ts RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS s FROM t;""",
+ true, true, true));
+ Assert.assertTrue(json.contains("\"DBSPSourceMapOperator\""));
+ }No other gates are hit: this is an internal compiler fix, it has a regression test, it adds no unsafe code or dependencies, and it needs no docs. Otherwise LGTM. |
|
|
Verdict: flaky test, not this PR. High confidence. The merge queue run's only test failure was in
This PR only touches This is a known, already-tracked flake: #7716, now on its 4th occurrence across unrelated PRs. I added this run as another data point there. Next step: re-queue the PR — it should pass on retry since the failure is unrelated to this change. |
Verdict: pre-existing bug on
|
| Failing job | Adapter Tests / Test Adapters (amd64) |
| Failing test | transport::kafka::ft::output::tests::an_outage_aborts_and_replays_the_transaction |
| Assertion | log:1690-1693 — assertion left == right failed: the spool must be released at commit (left: 190, right: 0) |
Already tracked in #7760 (opened earlier today for the same assertion in a different merge-queue run, root-caused to commit 6ad915e99 on main). I added this run's evidence there.
Next step: requeue is likely to pass once #7760 is fixed — this failure is unrelated to your change and will keep reoccurring until then.
With
--gen2the indexed value of a table with a primary key drops the key columns. An index closure that reads the whole row, such as the partitioning of a RANGE window overSELECT *, read that value as the row, and compilation failed with "Tuple field ... has type Tup3<..> that does not match the declared field type Tup4<..>". The closure now rebuilds the row from the key and the value. AddsGen2JsonTests#gen2WindowReadsTheWholeKeyedRow.