Skip to content

Add UnionValue and UnionScalar#8791

Draft
connortsui20 wants to merge 1 commit into
developfrom
agent/union-scalar-nullability
Draft

Add UnionValue and UnionScalar#8791
connortsui20 wants to merge 1 commit into
developfrom
agent/union-scalar-nullability

Conversation

@connortsui20

@connortsui20 connortsui20 commented Jul 16, 2026

Copy link
Copy Markdown
Member

Tracking issue: #8769

Depends on #8804 for the existing nested Scalar equality/hash contract fix.

Implements the scalar portion of #8769 on top of #8798.

  • adds UnionValue and UnionScalar
  • stores the full selected child Scalar, preserving its dtype and inner null state
  • uses the Union dtype nullability for the independent outer null state
  • preserves a selected null child instead of collapsing it into a null Union scalar
  • treats selected null children as equal across variants while retaining variant identity for non-null values
  • adds construction, downcasts, display, ordering, validation, recursive defaults, and constant scalar access
  • updates scalar protobuf serialization for the full child scalar

@connortsui20
connortsui20 force-pushed the agent/union-scalar-nullability branch from 547f89b to a05b340 Compare July 16, 2026 14:59
@connortsui20
connortsui20 force-pushed the agent/union-type-ids-u8 branch from 7820b66 to d9583d3 Compare July 16, 2026 15:09
@connortsui20
connortsui20 force-pushed the agent/union-scalar-nullability branch from a05b340 to bb2292d Compare July 16, 2026 15:10
@connortsui20
connortsui20 force-pushed the agent/union-type-ids-u8 branch from d9583d3 to 2c72940 Compare July 16, 2026 15:46
@connortsui20
connortsui20 force-pushed the agent/union-scalar-nullability branch from bb2292d to 6c0a2ea Compare July 16, 2026 15:47
@connortsui20
connortsui20 force-pushed the agent/union-type-ids-u8 branch from 2c72940 to 378b981 Compare July 16, 2026 16:02
@connortsui20
connortsui20 force-pushed the agent/union-scalar-nullability branch 2 times, most recently from 056c755 to 877e544 Compare July 16, 2026 16:08
@connortsui20
connortsui20 force-pushed the agent/union-type-ids-u8 branch from 378b981 to 2eb8864 Compare July 16, 2026 16:08
Base automatically changed from agent/union-type-ids-u8 to develop July 16, 2026 16:48
@connortsui20 connortsui20 changed the title Add outer nullability to Union scalars Add UnionValue and UnionScalar Jul 16, 2026
@connortsui20
connortsui20 force-pushed the agent/union-scalar-nullability branch from 877e544 to af088ad Compare July 16, 2026 17:23
@codspeed-hq

codspeed-hq Bot commented Jul 16, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 10.79%

⚡ 2 improved benchmarks
✅ 1668 untouched benchmarks
⏩ 52 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation compact[(4096, 90)] 867.8 ns 780.3 ns +11.21%
Simulation compact[(16384, 90)] 931.1 ns 843.6 ns +10.37%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing agent/union-scalar-nullability (d5458d2) with develop (17f843a)2

Open in CodSpeed

Footnotes

  1. 52 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on develop (407720c) during the generation of this report, so 17f843a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Polar Signals Profiling Results

Latest Run

Status Commit Job Attempt Link
🟢 Done d5458d2 1 Explore Profiling Data
Previous Runs (2)
Status Commit Job Attempt Link
🟢 Done 3a22a55 1 Explore Profiling Data
🟢 Done af088ad 1 Explore Profiling Data

Powered by Polar Signals Cloud

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Benchmarks: Vortex queries

Verdict: No clear signal (low confidence)
Attributed Vortex impact: +0.5%
Engines: DataFusion No clear signal (+0.2%, low confidence) · DuckDB No clear signal (+0.7%, low confidence)
Vortex (geomean): 1.005x ➖
Parquet (geomean): 1.003x ➖
Shifts: Parquet (control) +0.3% · Median polish +0.4%

How to read Verdict and Engines
  • Verdict: Overall PR-level signal after subtracting baseline drift estimated from Parquet control rows. It can be Likely improvement, Likely regression, or No clear signal.
  • Engines: Per-engine attribution. DataFusion is compared against DataFusion/Parquet controls; DuckDB is compared against DuckDB/Parquet controls. This answers whether each engine improved or regressed independently.
  • Confidence: Based on directional consistency, share of rows above the noise floor, and control-run noise.

datafusion / vortex-file-compressed (0.998x ➖, 0↑ 0↓)
name PR d5458d2 (ns) base 407720c (ns) ratio (PR/base)
vortex_q00/datafusion:vortex-file-compressed 9808409 9824979 1.00
vortex_q01/datafusion:vortex-file-compressed 6348898 6363061 1.00
datafusion / parquet (0.996x ➖, 0↑ 0↓)
name PR d5458d2 (ns) base 407720c (ns) ratio (PR/base)
vortex_q00/datafusion:parquet 20268628 20817537 0.97
vortex_q01/datafusion:parquet 4941477 4851302 1.02
duckdb / vortex-file-compressed (1.017x ➖, 0↑ 0↓)
name PR d5458d2 (ns) base 407720c (ns) ratio (PR/base)
vortex_q00/duckdb:vortex-file-compressed 10228718 10100030 1.01
vortex_q01/duckdb:vortex-file-compressed 6439160 6304024 1.02
duckdb / parquet (1.010x ➖, 0↑ 0↓)
name PR d5458d2 (ns) base 407720c (ns) ratio (PR/base)
vortex_q00/duckdb:parquet 23459510 23412652 1.00
vortex_q01/duckdb:parquet 9562752 9392853 1.02

No file size changes detected.

@connortsui20
connortsui20 force-pushed the agent/union-scalar-nullability branch from af088ad to 3a22a55 Compare July 16, 2026 17:36
@connortsui20
connortsui20 changed the base branch from develop to agent/union-outer-nullability July 16, 2026 17:38
@connortsui20 connortsui20 added the changelog/feature A new feature label Jul 16, 2026
@connortsui20
connortsui20 force-pushed the agent/union-outer-nullability branch from c5f26f5 to 7db4fac Compare July 16, 2026 17:43
@connortsui20
connortsui20 force-pushed the agent/union-scalar-nullability branch from 3a22a55 to 50d65b5 Compare July 16, 2026 17:43
@connortsui20
connortsui20 force-pushed the agent/union-outer-nullability branch from 7db4fac to f04a9d8 Compare July 16, 2026 18:54
@connortsui20
connortsui20 force-pushed the agent/union-scalar-nullability branch 3 times, most recently from 5b5d8c0 to 39be7e2 Compare July 16, 2026 20:01
Base automatically changed from agent/union-outer-nullability to develop July 16, 2026 20:20
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@connortsui20
connortsui20 force-pushed the agent/union-scalar-nullability branch from 39be7e2 to d5458d2 Compare July 16, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant