Skip to content

perf(vector): specialize wide fixed-width selection copies - #31081

Merged
XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue30845-scattered-gather-20261025
Oct 25, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issue30845-scattered-gather-20261025

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #30838 and #30845. This delivers one shared copy-kernel optimization; both issues remain open for query-level and complete workload acceptance.

What this PR does / why we need it:

Vector.Union / UnionInt32 use dynamic-length copy once per selected wide fixed-width value. A baseline profile of the existing hashjoin projection consumer with Decimal128 payloads attributes 38.68% of samples to runtime.memmove.

  • Reuse the existing shuffle.FixedLengthShuffle loop for physical widths 12/16/20/24/32, allowing either int32 or int64 selections. The compiler emits fixed-size assignments.
  • Retain the scalar loops for 1/2/4/8-byte values; rejected an earlier all-width implementation after tiny-input controls exposed regressions.
  • Bound source and appended destination bytes before constructing typed views, including allocation padding and self-append after growth.
  • Compute nullable copy offsets once per selected non-NULL row (two multiplications instead of four). The skip-NULL loop, payload/bitmap semantics and metadata/allocation/error ownership stay intact.

There are no query identifiers, selection-length thresholds, new caches, ownership transfers, configuration or persisted-format changes. Time remains O(selected rows), with the same copied byte count and no additional allocations.

Design and review

See the versioned design. Design and implementation were reviewed using gpt-6.1-sol with xhigh reasoning. The design and code review found no implementation blockers. The final two-offset refinement was also independently reviewed; performance evidence is reported separately below.

Production: +40/-5 lines across two files. Tests/benchmarks: +246/-21 lines, extending the existing real hashbuild/probe fixture and adding a four-row independent byte oracle. Design: +98 lines. Review logs and temporary performance probes are not part of the patch.

Validation

Passed locally with Go 1.27.1 on Linux/amd64 and the repository CGo wrapper:

  • Full UTs for pkg/container/vector, pkg/sql/colexec/hashjoin, pkg/container/batch and pkg/sql/colexec/hashbuild; pkg/vectorize/shuffle compiles and is exercised through vector tests.
  • Focused -race/checkptr checks for both index widths, physical representations, prefix/empty/repeated/reversed selections, borrowed windows, forced self-append growth, metadata, reset/reuse and real hashjoin projection/error paths.
  • Incremental gofmt, go vet, pinned molint and golangci-lint for all three changed Go packages. Golangci reports zero issues. Molint exits zero and reports two unsafe-import notes in unchanged baseline test files; no changed-file finding.
  • Rebased on 553bf39dbb. Its new temporary-DDL changes do not change the tested dependency closure; the final offset refinement is revalidated below on that base.

No new SQL semantics or topology are introduced; existing consumer tests cover this boundary. A full BVT, full repository CI and TPC-H SF10/SF100 campaigns have not been claimed as locally passed.

Performance

Linux/amd64, Intel i7-11700, Go 1.27.1, one pinned CPU (6), GOMAXPROCS=1. Freeze the benchmark sources and binaries, exclude a cold warmup, then run six baseline/candidate pairs serially and adjacent per case, with the same fixed iteration count per pair. The initial matrix kept a fixed within-case order (66 cases each way); the longer independent control confirmation below uses three baseline-first and three candidate-first pairs for each of its eight cases. No own build or UT runs overlap scoring. Baseline production is aeaa273daf; the relevant source and dependency closure is unchanged at the rebased main 553bf39dbb. Final candidate source matches f02f94fd5cc6.

Component, 256 selected rows Baseline median Candidate median Time reduction
Non-NULL wide fixed selection, both index widths See full matrix below See full matrix below 66.4–76.7%
Decimal128 hashjoin projection, same source 8,584 ns 2,632.5 ns 69.3%
Decimal128 hashjoin projection, alternating sources 25,008.5 ns 22,225 ns 11.1%

All 132 cases retain 0 B/op and 0 allocs/op in the reused-capacity hot path. Copied byte count and output ownership do not change. This is a CPU/copy-dispatch optimization, not a claim of reduced materialized bytes or application-wide peak memory.

Controls and uncertainty: narrow widths, one-row/empty outputs, NULL/constant columns, varlen projections and alternating sources are included. An earlier candidate had repeatable 2–4% NULL-control regressions and was rejected. The final full matrix has positive control median differences up to 1.48%; a separate longer, within-case counterbalanced six-pair run covering every positive control plus the previously suspected Decimal128 NULL control has positive median differences up to 1.25%, with mixed pair signs and no confirmed stable slowdown. The TS nullable control that originally measured +1.48% is +0.16% in that confirmation. Those small differences remain measurement uncertainty; non-significance does not establish universal zero regression. Full workload no-regression acceptance remains open in the linked issues.

The final code keeps the demonstrated wide-copy gain and removes duplicate nullable offset multiplication. No source changes were made between final scoring, UT/race/SCA and this commit.

Longer independent control confirmation: three AB and three BA pairs per case (ns/op)
case | baseline samples | candidate samples | median change
J/int32/alternating-source/rows=0/batch | 118.1,117.4,117.6,118.3,114.4,113.3 | 118.5,117.2,119.2,118,113.8,114.2 | +0.09%
J/int32/same-source/rows=0/batch | 118.5,117.5,118.7,117.5,113.3,115 | 117.5,118.2,117.8,118.4,114.1,112.6 | +0.13%
J/nullable-varchar/alternating-source/rows=0/batch | 116.8,119,118.9,117.3,114.4,113.7 | 117.6,116.4,163,117.3,112.9,114.1 | -0.17%
J/varchar/alternating-source/rows=0/batch | 118.8,117.3,120,118.3,112.5,113.3 | 117.9,117,116.7,118.2,113.6,114.3 | -0.81%
J/varchar/same-source/rows=0/batch | 117.5,118,119,117.9,113.2,113.5 | 118.2,118.1,117.4,118.2,114.9,114.3 | +0.04%
V/BLOCKID/rows=256/nullable/int32=true | 1569,1572,1570,1550,1502,1488 | 1508,1513,1524,1558,1471,1468 | -3.14%
V/DECIMAL128/rows=256/nullable/int32=false | 1527,1732,1535,1518,1474,1472 | 1549,1590,1544,1539,1506,1476 | +1.25%
V/TRANSACTION_TIMESTAMP/rows=256/nullable/int32=false | 1541,1509,1530,1551,1584,1453 | 1542,1554,1553,1534,1490,1464 | +0.16%
Complete component measurements: six paired samples per case (ns/op)

V = BenchmarkUnionFixedSelection; J = BenchmarkHashJoinUniqueProjection. Baseline and candidate were run serially and adjacent for each case with cold warmup excluded. This first matrix kept a fixed within-case order (66 cases each way); the separate longer eight-control confirmation counterbalances order within every case. These are component timings, not SQL/query measurements.

case | baseline samples | candidate samples | median change
J/decimal128/alternating-source/rows=0/batch | 114,116.6,115.4,112.8,116.8,126.9 | 114,114.8,117.1,113.4,115.4,121.5 | -0.78%
J/decimal128/alternating-source/rows=1/batch | 475.9,490.6,490.3,491.4,480.5,733.5 | 475,490.9,477.7,472.5,494,792.3 | -1.25%
J/decimal128/alternating-source/rows=256/batch | 24605,25528,24741,24914,25103,30468 | 22170,22669,22083,22280,22038,26387 | -11.13%
J/decimal128/same-source/rows=0/batch | 113.3,114.8,114.8,114.5,115.8,136.6 | 112.3,114.2,114.2,114.4,116.2,121.2 | -0.44%
J/decimal128/same-source/rows=1/batch | 477.8,490.9,482.1,477.2,492.3,611.7 | 462.4,478.4,471.4,486.3,494.1,576 | -0.85%
J/decimal128/same-source/rows=256/batch | 8454,8779,8496,8354,8672,9715 | 2587,2673,2581,2606,2659,2972 | -69.33%
J/int32/alternating-source/rows=0/batch | 113.4,113.3,113.6,115,116,117.8 | 114,113.1,114.2,115,115.8,117.2 | +0.26%
J/int32/alternating-source/rows=1/batch | 450.2,452.5,452.9,450.6,462.1,462.7 | 449.7,448.5,450.8,450.9,454.5,454.6 | -0.41%
J/int32/alternating-source/rows=256/batch | 19823,19895,19861,19963,20038,19942 | 18419,19239,18733,18682,18994,19089 | -5.30%
J/int32/same-source/rows=0/batch | 114.2,113.8,115.7,113.2,114.3,115.9 | 113.5,114.7,114.7,114.8,115.7,115.3 | +0.44%
J/int32/same-source/rows=1/batch | 457,459.6,457.9,447.9,460,462.8 | 440.9,448.1,450.7,457.9,449.3,452.5 | -1.91%
J/int32/same-source/rows=256/batch | 3223,3250,3267,3252,3288,3300 | 2997,3043,3062,3001,3114,3072 | -6.35%
J/nullable-varchar/alternating-source/rows=0/batch | 113.6,112.7,114,113.2,113.4,115.7 | 113.9,113.5,115,113,116.4,116.8 | +0.84%
J/nullable-varchar/alternating-source/rows=1/batch | 720.1,714.2,717.3,719.4,724.6,727.5 | 714.5,701.1,711.2,696.5,719.9,726.2 | -0.96%
J/nullable-varchar/alternating-source/rows=256/batch | 60863,60467,60675,60402,61466,61575 | 60198,59631,61414,59981,60781,59878 | -1.12%
J/nullable-varchar/same-source/rows=0/batch | 113.8,113.9,115,118.9,115.4,124.9 | 114.4,113,114.4,115,117.8,124.1 | -0.43%
J/nullable-varchar/same-source/rows=1/batch | 718.1,716.9,720.8,1019,733.4,1038 | 697.2,712.1,713.1,708.8,707.5,717.2 | -2.29%
J/nullable-varchar/same-source/rows=256/batch | 28879,29068,28447,28037,28093,28663 | 27955,27866,28195,27816,28426,28322 | -1.68%
J/varchar/alternating-source/rows=0/batch | 113.9,114.1,114.1,115.5,115.6,114.7 | 115.5,118.1,114.5,113.5,118,115.7 | +1.05%
J/varchar/alternating-source/rows=1/batch | 711.6,704.4,712.9,707.5,709.3,717.9 | 703.1,695.9,714.4,702.2,710.1,721.3 | -0.54%
J/varchar/alternating-source/rows=256/batch | 51977,50897,51844,51776,52344,55524 | 51537,50743,51273,53816,51825,57037 | -0.44%
J/varchar/same-source/rows=0/batch | 113.3,129.1,115.4,112.7,115.4,115.5 | 113.8,127.4,115.7,113.9,117.7,118.4 | +1.13%
J/varchar/same-source/rows=1/batch | 700.7,703,707.2,711.6,715.2,725.6 | 699.1,702.7,708.7,703,711,705.3 | -0.74%
J/varchar/same-source/rows=256/batch | 22351,22909,22785,22495,22829,22661 | 22224,22551,22256,22355,22885,22503 | -1.29%
V/BIGINT/rows=1/constant/int32=false | 79.18,79.82,80.64,79.37,79.97,79.49 | 74.92,75.64,76.27,76.48,75.59,75.43 | -5.07%
V/BIGINT/rows=1/constant/int32=true | 77.46,77.79,77.82,77.77,77.98,78.39 | 75.83,74.86,75.99,77.18,76.83,76.36 | -2.09%
V/BIGINT/rows=1/flat/int32=false | 74.91,72.2,74.31,74,79.3,93.54 | 70.76,70.38,70.48,70.07,76.05,94.89 | -5.35%
V/BIGINT/rows=1/flat/int32=true | 76.17,74.25,74.85,74.31,75.7,90.1 | 70.87,70.86,71.64,71.17,73,82.25 | -5.14%
V/BIGINT/rows=1/nullable/int32=false | 92.14,97.98,92.21,92.64,92.56,113.4 | 85.74,86.51,86.41,86.87,87.02,103.4 | -6.38%
V/BIGINT/rows=1/nullable/int32=true | 94.02,111.4,95.56,95.09,96.56,106.1 | 86.52,93.23,88.19,90.22,89.91,88.45 | -7.16%
V/BIGINT/rows=256/constant/int32=false | 118.2,119.8,122.3,118.8,118.9,123.6 | 114.4,113.8,113.4,117.2,122.8,124.7 | -2.97%
V/BIGINT/rows=256/constant/int32=true | 117.8,120.7,119.4,118.7,123.8,123.7 | 116.5,116.2,116.3,115.6,120.4,116.9 | -3.04%
V/BIGINT/rows=256/flat/int32=false | 298.1,298.6,302,300.1,303.5,302.3 | 293,299.1,301.8,299,292.8,298.3 | -0.80%
V/BIGINT/rows=256/flat/int32=true | 331.5,329.7,333.4,327.5,333.3,335.7 | 291.4,293.9,300.4,296.1,296.8,296.9 | -10.82%
V/BIGINT/rows=256/nullable/int32=false | 1409,1418,1499,1448,1448,1424 | 1402,1395,1393,1419,1410,1418 | -2.09%
V/BIGINT/rows=256/nullable/int32=true | 1431,1434,1434,1432,1434,1470 | 1399,1412,1415,1515,1424,1496 | -1.01%
V/BLOCKID/rows=1/constant/int32=false | 78.36,80.36,78.24,81.46,80.98,79.8 | 74.44,76.48,76.16,77.89,77.75,77.51 | -3.85%
V/BLOCKID/rows=1/constant/int32=true | 78.66,77.46,78.61,78.25,74.85,79.25 | 77.21,76.99,77.61,76.6,177.8,77.82 | -1.30%
V/BLOCKID/rows=1/flat/int32=false | 75.86,77.01,76.2,76.69,77.64,77.63 | 76.16,74.63,74.72,74.74,75.4,75.93 | -2.32%
V/BLOCKID/rows=1/flat/int32=true | 75.14,77.29,76.38,75.62,77.64,77.34 | 74.63,74.66,73.88,73.69,74.77,74.02 | -3.27%
V/BLOCKID/rows=1/nullable/int32=false | 91.83,93.48,93.02,91.72,93.08,95.92 | 84.84,87.06,87.15,87.11,86.45,88.3 | -6.41%
V/BLOCKID/rows=1/nullable/int32=true | 94.33,95.25,94.62,95.48,97.24,95.72 | 86.23,87.12,86.87,88.85,87.94,88.71 | -8.22%
V/BLOCKID/rows=256/constant/int32=false | 143.1,141.1,139.7,147.1,144.5,162.2 | 138.8,138.8,142.1,142.4,140.9,153.4 | -1.60%
V/BLOCKID/rows=256/constant/int32=true | 141.1,144.9,143.2,147.5,142.7,152.7 | 137.8,140.7,138.7,137.5,141.3,146.3 | -3.02%
V/BLOCKID/rows=256/flat/int32=false | 980,978.1,974.3,1019,972.4,999.4 | 271.5,274.3,276.7,295.9,275.9,274 | -71.90%
V/BLOCKID/rows=256/flat/int32=true | 954.2,970.1,1020,965.8,977.4,995.7 | 270.4,270.4,272.2,270,278.9,277.8 | -72.14%
V/BLOCKID/rows=256/nullable/int32=false | 1482,1464,1483,1536,1498,1575 | 1447,1444,1489,1451,1489,1481 | -1.64%
V/BLOCKID/rows=256/nullable/int32=true | 1506,1504,1501,1499,1540,1561 | 1521,1474,1470,1500,1541,1563 | +0.37%
V/DECIMAL128/rows=1/constant/int32=false | 76.14,77.76,77.37,79.05,78.64,80.18 | 74.81,74.46,74.87,75.1,75.14,77.32 | -4.11%
V/DECIMAL128/rows=1/constant/int32=true | 76.89,76.28,77.3,76.78,78.62,77.39 | 75.98,74.51,75.21,74.98,75.73,75.47 | -2.28%
V/DECIMAL128/rows=1/flat/int32=false | 75.5,76.21,74.98,78.67,76.58,79.58 | 71.22,70.51,70.95,72.26,74.23,71.03 | -6.90%
V/DECIMAL128/rows=1/flat/int32=true | 76.34,75.32,76.7,75.2,76.36,83.36 | 73.09,72.89,72.84,72,74.23,85.66 | -4.40%
V/DECIMAL128/rows=1/nullable/int32=false | 89.99,91.05,90.83,93.33,93.31,92.94 | 84.69,83.87,83.91,87.04,86.97,98.4 | -6.70%
V/DECIMAL128/rows=1/nullable/int32=true | 92.34,92.58,93.57,94.18,94.86,98.12 | 85.28,84.77,85.89,86,88.21,94.77 | -8.45%
V/DECIMAL128/rows=256/constant/int32=false | 131.4,134.5,132.4,136.3,135.2,132.6 | 126.5,131,126.4,128.2,129.3,131.6 | -3.59%
V/DECIMAL128/rows=256/constant/int32=true | 131,133.7,134.1,133.4,135.3,133.2 | 124.5,131.5,129.6,129.4,131.2,132.3 | -2.36%
V/DECIMAL128/rows=256/flat/int32=false | 977.1,979.6,1013,966.4,1006,980.1 | 223.1,227.5,229,228.2,228.6,232.3 | -76.69%
V/DECIMAL128/rows=256/flat/int32=true | 1018,1005,1009,1021,1035,1017 | 245.3,244.3,262.9,245.2,250.3,246.4 | -75.84%
V/DECIMAL128/rows=256/nullable/int32=false | 1518,1485,1508,1457,1521,1474 | 1493,1488,1472,1482,1502,1488 | -0.57%
V/DECIMAL128/rows=256/nullable/int32=true | 1522,1518,1505,1522,1556,1520 | 1498,1486,1463,1478,1495,1495 | -2.01%
V/DECIMAL256/rows=1/constant/int32=false | 77.66,78.55,81.26,78.02,78.92,79.97 | 75.56,75.68,76.06,74.64,74.65,75.93 | -3.96%
V/DECIMAL256/rows=1/constant/int32=true | 75.83,76.86,76.32,76.05,76.62,77.4 | 75.48,78.65,76.02,74.53,76.17,76.27 | -0.49%
V/DECIMAL256/rows=1/flat/int32=false | 76.76,78.21,76.96,75.07,77.4,76.39 | 73.71,76.03,73.9,73.87,74.46,75.55 | -3.49%
V/DECIMAL256/rows=1/flat/int32=true | 75.64,78.66,74.99,74.27,75.33,76.59 | 73.75,73.5,74.64,73.28,73.63,73.53 | -2.52%
V/DECIMAL256/rows=1/nullable/int32=false | 90.41,90.38,91.37,89.88,91.71,92.7 | 85.11,84.19,84.69,84.02,84.34,85.91 | -7.01%
V/DECIMAL256/rows=1/nullable/int32=true | 93.07,93.07,97.27,92.84,95.21,96.87 | 85,85.74,85.36,85.48,87.01,86.4 | -9.06%
V/DECIMAL256/rows=256/constant/int32=false | 157.1,158.2,158.8,157,157.6,160 | 150.8,151.3,153.7,151.8,153.7,155.5 | -3.26%
V/DECIMAL256/rows=256/constant/int32=true | 155.4,161,157.6,157.4,159.4,158.9 | 151.6,157.8,155.2,154.3,155.9,155.6 | -1.80%
V/DECIMAL256/rows=256/flat/int32=false | 1151,979.7,1052,968.6,982.5,978.9 | 332.1,328.9,327.2,323.2,346.4,330.2 | -66.41%
V/DECIMAL256/rows=256/flat/int32=true | 961.7,968.6,969.6,964.4,995.8,973.7 | 320.6,319.1,321.1,321.1,329.3,324.8 | -66.87%
V/DECIMAL256/rows=256/nullable/int32=false | 1481,1478,1486,1481,1501,1495 | 1465,1451,1450,1451,1519,1458 | -1.95%
V/DECIMAL256/rows=256/nullable/int32=true | 1493,1483,1585,1505,1500,1514 | 1469,1462,1469,1479,1486,1489 | -1.90%
V/INT/rows=1/constant/int32=false | 78.44,78.81,79.16,79.37,80.77,91.13 | 75.21,75.99,74.89,75.99,74.95,94.71 | -4.62%
V/INT/rows=1/constant/int32=true | 76.83,77.6,77.19,77.43,77.15,86.73 | 75.33,75.67,75.47,75.66,74.82,81.65 | -2.26%
V/INT/rows=1/flat/int32=false | 75.38,73.12,72.42,75.41,73.57,73.47 | 69.98,71.08,69.69,70.55,70.09,70.35 | -4.49%
V/INT/rows=1/flat/int32=true | 76.1,75.84,73.08,73.72,73.28,73.67 | 73.54,69.75,70.31,69.52,69.91,70.98 | -4.86%
V/INT/rows=1/nullable/int32=false | 95.94,92.04,93.17,91.38,91.52,99.31 | 87.02,86.28,86.45,85.74,86.73,88.57 | -6.50%
V/INT/rows=1/nullable/int32=true | 95.01,94.64,94.25,94.27,95.41,120.2 | 87.47,87.55,86.39,86.66,87.22,113.1 | -7.89%
V/INT/rows=256/constant/int32=false | 108.5,110,109.5,108.6,112.8,212.7 | 104.9,105.8,105.3,105.4,107,108.7 | -3.78%
V/INT/rows=256/constant/int32=true | 108.2,109.1,110.7,109.1,112.6,128.6 | 104.3,105.2,106,104.2,107,126.8 | -3.91%
V/INT/rows=256/flat/int32=false | 330.9,333.4,328.8,327.3,336.9,343.2 | 293.8,300.3,293.3,294.8,316.2,302 | -10.42%
V/INT/rows=256/flat/int32=true | 324.3,328.3,327.5,332.4,341.3,356.1 | 294.3,300.1,300.4,296.7,314.4,332.9 | -9.11%
V/INT/rows=256/nullable/int32=false | 1349,1379,1348,1380,1432,1610 | 1331,1331,1326,1344,1491,1632 | -3.04%
V/INT/rows=256/nullable/int32=true | 1366,1400,1367,1443,1681,1514 | 1335,1408,1351,1389,1786,1384 | -2.46%
V/ROWID/rows=1/constant/int32=false | 78.33,78.04,80.94,78.29,79.09,79.77 | 75.1,75.26,76.83,75.64,75.41,77.51 | -4.05%
V/ROWID/rows=1/constant/int32=true | 76.82,76.33,76.62,77.13,78.02,77.61 | 75.25,75.34,78.01,74.74,75.59,77.67 | -1.96%
V/ROWID/rows=1/flat/int32=false | 75.09,75.52,76.98,75.74,76.56,81.58 | 73.02,74.02,72.77,73.27,73.62,77.32 | -3.55%
V/ROWID/rows=1/flat/int32=true | 74.64,76.02,75.43,77.3,75.37,83.18 | 72.55,74.25,73.05,73.88,74.46,82.6 | -2.19%
V/ROWID/rows=1/nullable/int32=false | 91.04,93.7,90.01,91.57,92.56,139.7 | 84.46,84.43,84.13,86.15,84.65,99.96 | -8.16%
V/ROWID/rows=1/nullable/int32=true | 93.54,93.8,95.25,94.57,96.25,146.5 | 85.69,85.35,88.8,85.61,88.39,127.6 | -8.29%
V/ROWID/rows=256/constant/int32=false | 142.3,156.3,142.6,143.5,147.7,146 | 137.2,141.6,139.7,139.3,139.5,140.4 | -3.56%
V/ROWID/rows=256/constant/int32=true | 140.6,184.8,143.6,145.7,148.4,145 | 138.9,243.5,142.2,140.8,144.4,141.2 | -2.51%
V/ROWID/rows=256/flat/int32=false | 962.6,972.3,975.9,1034,1050,1084 | 249,250.7,250.3,248.9,248.6,262.9 | -75.16%
V/ROWID/rows=256/flat/int32=true | 984.9,972.5,977.2,974.7,985.7,1190 | 268.7,270.8,271,269.4,269.4,301.5 | -72.47%
V/ROWID/rows=256/nullable/int32=false | 1484,1509,1494,1480,1541,1622 | 1461,1497,1463,1456,1493,1609 | -1.57%
V/ROWID/rows=256/nullable/int32=true | 1495,1530,1524,1510,1518,1595 | 1476,1544,1481,1477,1484,1515 | -2.53%
V/SMALLINT/rows=1/constant/int32=false | 78.4,77.83,80.6,78.42,79.37,81.85 | 74.11,74.11,75.78,74.47,76.56,76.43 | -4.78%
V/SMALLINT/rows=1/constant/int32=true | 77.33,76.27,78.35,76.62,77.73,78.71 | 75.06,74.12,74.87,74.9,75.76,76.94 | -3.29%
V/SMALLINT/rows=1/flat/int32=false | 72.17,72.48,73.85,74,72.62,76.08 | 69.37,69.13,70.92,72.42,69.46,73.36 | -4.16%
V/SMALLINT/rows=1/flat/int32=true | 72.85,72.92,73.24,73.44,73.18,79.39 | 69.88,69.52,70.73,69.34,69.49,82.53 | -4.79%
V/SMALLINT/rows=1/nullable/int32=false | 90.86,91.3,91.69,93.78,91.21,92.6 | 86.45,83.91,85.48,85.1,84.74,90.82 | -6.78%
V/SMALLINT/rows=1/nullable/int32=true | 93.09,93.19,94.54,94.48,93.9,96.54 | 86.75,85.94,86.32,86.74,86.76,88.82 | -7.90%
V/SMALLINT/rows=256/constant/int32=false | 102.4,107.7,102.7,107,102.2,102.6 | 96.46,96.36,98.19,103.7,96.94,97.93 | -5.08%
V/SMALLINT/rows=256/constant/int32=true | 101.3,102.5,101.2,103.7,101.4,102.8 | 97.83,99.2,98.78,98.1,99.45,99.42 | -2.90%
V/SMALLINT/rows=256/flat/int32=false | 280.4,274.1,285.5,280.9,345.5,282.9 | 272.2,274.4,271.9,274,271.8,279.8 | -3.12%
V/SMALLINT/rows=256/flat/int32=true | 294.7,297.3,291.7,304.6,293.3,304.2 | 271.1,273.6,272.4,274.3,273.8,274.5 | -7.53%
V/SMALLINT/rows=256/nullable/int32=false | 1300,1300,1304,1312,1291,1306 | 1264,1296,1273,1288,1275,1270 | -2.15%
V/SMALLINT/rows=256/nullable/int32=true | 1362,1354,1331,1366,1335,1368 | 1298,1301,1289,1353,1303,1284 | -4.31%
V/TINYINT/rows=1/constant/int32=false | 78.61,78.47,78.56,77.34,79.21,78.86 | 73.64,73.95,75.03,73.71,73.93,75.18 | -5.91%
V/TINYINT/rows=1/constant/int32=true | 77.02,75.05,79.65,75.6,80.13,76.13 | 73.96,74.1,74.72,74.21,74.74,74.2 | -3.10%
V/TINYINT/rows=1/flat/int32=false | 72.11,71.9,73.79,75.08,73.13,73.71 | 69.77,71.17,67.97,68.95,68.12,68.72 | -6.24%
V/TINYINT/rows=1/flat/int32=true | 71.18,71.67,71.67,80.68,71.14,72.01 | 68.38,68.28,68.36,84.49,68.31,68.67 | -4.60%
V/TINYINT/rows=1/nullable/int32=false | 88.99,90.51,90.41,92.67,89.49,90.45 | 83.43,84.14,84.4,95.19,84.15,84.12 | -6.95%
V/TINYINT/rows=1/nullable/int32=true | 92.34,92.09,92.31,94.26,92.85,93.41 | 85.54,85.31,85.01,86.74,84.83,86.63 | -7.74%
V/TINYINT/rows=256/constant/int32=false | 99.5,99.74,99.47,103.5,98.51,101.1 | 94.8,95.44,95.77,97.04,96.71,94.3 | -4.03%
V/TINYINT/rows=256/constant/int32=true | 94.94,96.41,96.54,96.8,97.5,98 | 94.3,94.93,94.73,94.92,97.72,99.77 | -1.81%
V/TINYINT/rows=256/flat/int32=false | 270.3,267.9,268.8,265.9,272.1,268.4 | 265.6,270.7,260.7,265.5,264.2,264.1 | -1.40%
V/TINYINT/rows=256/flat/int32=true | 270.3,273.9,275.4,268.9,271.2,276.4 | 265.7,268.6,272.4,268.1,264.7,271.1 | -1.54%
V/TINYINT/rows=256/nullable/int32=false | 1311,1314,1296,1298,1311,1336 | 1272,1267,1280,1275,1282,1310 | -2.56%
V/TINYINT/rows=256/nullable/int32=true | 1335,1363,1352,1349,1366,1388 | 1291,1286,1291,1292,1303,1331 | -4.86%
V/TRANSACTION_TIMESTAMP/rows=1/constant/int32=false | 79.14,78.69,78.92,82.95,81.9,80.02 | 75.92,76.07,76.43,77.28,77.63,76.77 | -3.74%
V/TRANSACTION_TIMESTAMP/rows=1/constant/int32=true | 77.58,79.42,78.04,81.42,79.25,78.09 | 76.16,76.68,77.77,79.92,78.16,77.78 | -1.14%
V/TRANSACTION_TIMESTAMP/rows=1/flat/int32=false | 76.86,76.44,77.79,77.12,79.01,78.39 | 72.83,72.81,73.09,73.27,73,73.61 | -5.69%
V/TRANSACTION_TIMESTAMP/rows=1/flat/int32=true | 77.24,76.99,76.68,77.61,78.48,77.49 | 74.07,74.31,73.58,74.11,74.89,74.96 | -4.08%
V/TRANSACTION_TIMESTAMP/rows=1/nullable/int32=false | 92.65,94.15,93.71,96.42,97.89,92.83 | 86.56,87.78,87.29,87.5,86.73,87.4 | -7.01%
V/TRANSACTION_TIMESTAMP/rows=1/nullable/int32=true | 95.42,95.03,95.37,99.69,102.5,96.18 | 87.41,86.28,87.68,88.42,142.4,88.18 | -8.22%
V/TRANSACTION_TIMESTAMP/rows=256/constant/int32=false | 124.2,132.1,126,127.1,128.5,143 | 125.3,131.3,121.6,124.2,124.6,130.1 | -2.23%
V/TRANSACTION_TIMESTAMP/rows=256/constant/int32=true | 127.5,127.3,127.7,129.3,130.5,153.8 | 126.3,128.6,126.4,128,127.9,133.5 | -0.43%
V/TRANSACTION_TIMESTAMP/rows=256/flat/int32=false | 968.8,974.5,976.7,997.9,990.9,982.9 | 249.1,249.2,246.6,247.2,247.4,248.5 | -74.69%
V/TRANSACTION_TIMESTAMP/rows=256/flat/int32=true | 1032,1032,1010,1067,1090,1021 | 275.5,278.2,272.4,271.8,277.1,275 | -73.33%
V/TRANSACTION_TIMESTAMP/rows=256/nullable/int32=false | 1485,1500,1482,1527,1497,1473 | 1487,1519,1507,1487,1520,1584 | +1.48%
V/TRANSACTION_TIMESTAMP/rows=256/nullable/int32=true | 1526,1585,1500,1545,1551,1547 | 1461,1506,1468,1522,1511,1504 | -2.65%

Kernel/projection timings are not end-to-end SQL speedups. The remaining multi-source gather/materialization work and full Q1–Q22 acceptance in #30845 remain open.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: f02f94fd5cc67512bfa3db19c786ad888f529724

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: f02f94fd5cc67512bfa3db19c786ad888f529724

Assessment: approve

Reviewed the complete six-file delta and affected callers. Reusing the existing typed shuffle kernel preserves vector ownership, allocation, metadata and ordering contracts without adding state or allocations. No actionable blocker remains for this scoped optimization.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Verified the clean frozen head, supplied patch and native-library provenance against 192 matching native input files. Isolation preflight passed.

  • Full vector, batch, hashjoin and hashbuild suites passed. Shuffle compiled and was exercised through vector tests. Focused race/checkptr checks passed for selection copying, metadata, join boundaries, reset/reuse and allocation rejection.

  • Formatting, whitespace, go vet, pinned molint and golangci-lint checks passed. Molint reported only two unchanged baseline test-file notes.

  • Ran 28 baseline/candidate component cases with six counterbalanced pairs each, followed by seven longer controls and two additional nullable controls. Wide selections improved 62.1–76.7%; Decimal128 join projection improved 68.2% for one source and 10.2% for alternating sources. Measured hot paths retained zero allocations.

  • Reconciled commands, source fingerprints, exit receipts, binary hashes and retained logs in /home/xupeng/.local/state/mo-bot/jobs/cddbb1e79aaa008c21b18a13/attempt-1/evidence-audit.json. Audit receipt: checks/1792912150250330791-4.json, exit 0.

Limitations:

  • Longer tiny-input controls measured approximately 0.8–1.1% increases. Nullable timestamp measurements were noisy; a second-core confirmation measured +0.37%. These component results do not establish universal performance improvement.

  • Validation used Linux/amd64 with Go 1.27.1. Frozen relevant CI remained in progress; full BVT, arm64 execution and query-level workload acceptance were not established. The broader linked issues remain open as declared by the PR.

This branch had an error being deployed

1 failed deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants