Skip to content

Require matching dtypes for extension comparisons - #11016

Merged
connortsui20 merged 7 commits into
developfrom
ct/ext-types/comparison-consistency
Nov 2, 2026
Merged

connortsui20 merged 7 commits into
developfrom
ct/ext-types/comparison-consistency

Conversation

@connortsui20

@connortsui20 connortsui20 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Extension comparisons could compare raw storage on the array path while scalar execution rejected the same operands. Applies one dtype requirement across comparison paths.

Changes

Checks logical dtypes at binding and before comparison fast paths or encoding kernels run. Regression tests cover batch, row, and constant execution, encoded timestamps, and DuckDB filter pushdown through SQL logic tests. Broader documentation is split into #11099. DataFusion literal conversion is handled separately in #11067.

Local pre-commit license and formatting checks passed. Tests and benchmarks were not run after the review fixes. Workspace-wide Clippy started through the pre-push hook and was stopped without a result.

API Changes

Comparison operands must have matching logical dtypes, ignoring nullability. Comparisons between an extension and its storage dtype, or between different extension dtypes, now return an error. This includes timestamps with different units or time zones.

@connortsui20 connortsui20 added the changelog/break A breaking API change label Oct 29, 2026 — with ChatGPT Codex Connector
@connortsui20
connortsui20 added this pull request to stack #11017 October 29, 2026 22:05
@codspeed

codspeed Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 15.67%

1 warning

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

❌ 6 regressed benchmarks
✅ 2312 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation filter_powerlaw_by_random[10000] 1.1 µs 1.4 µs -23.35%
❌ CPU Simulation bench_compare_varbin[(50000, 2)] 133.3 µs 161.7 µs -17.59%
❌ CPU Simulation bench_compare_varbin[(50000, 64)] 135.3 µs 163.2 µs -17.1%
❌ CPU Simulation bench_compare_sliced_dict_varbinview[(7500, 10000)] 199.8 µs 227 µs -11.98%
❌ CPU Simulation bench_compare_sliced_dict_varbinview[(1000, 10000)] 78.1 µs 88.5 µs -11.74%
❌ CPU Simulation bench_compare_sliced_dict_varbinview[(10000, 10000)] 206.1 µs 233.1 µs -11.56%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ct/ext-types/comparison-consistency (c1625ea) with develop (ec6c7fb)

Open in CodSpeed

@connortsui20
connortsui20 marked this pull request as draft October 29, 2026 22:22
@connortsui20
connortsui20 force-pushed the ct/ext-types/comparison-consistency branch from 2c3048c to deb59a4 Compare October 30, 2026 13:43
@connortsui20
connortsui20 force-pushed the ct/ext-types/comparison-consistency branch 2 times, most recently from b1e9533 to 5bed318 Compare October 30, 2026 19:35
Base automatically changed from ct/ext-types/path-consistency to develop October 30, 2026 19:45
@connortsui20
connortsui20 force-pushed the ct/ext-types/comparison-consistency branch from 5bed318 to 2461528 Compare October 30, 2026 19:45

@myrrc myrrc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The general algorithm is fine, but I have two notes:

  • Duckdb part should not add any new ifdefs, macros, tweaks, or features unless this is required for building (see static_extensions feature). We also shouldn't write a rust test if we can write an SLT.
  • Roughly a third of the changes are comments generated by LLM which are very verbose and IMO don't give you any more information than you'd get reading just the code. I'd propose removing all of them .

Comment thread vortex-duckdb/cpp/table_filter.cpp Outdated
return reinterpret_cast<duckdb_value>(&(*vec)[idx]);
}

#ifdef VORTEX_DUCKDB_TEST_HARNESS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please don't add ifdefs or macros changing how we run and test duckdb

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

How should we test this instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

i added sqllogictests, I think this is fine now

@connortsui20

Copy link
Copy Markdown
Member Author

@myrrc can you tell me which comments you think are not useful?

At least for me, I should be able to look at the module docs and not have to read the whole file to understand what it is doing. Generally speaking, if I have to read any code, that is the failure of the docs and the type and function names.

We also generally don't have great developer docs, so I try to update these as I make changes (which also helps in keeping them up to date).

I'm happy to change docs if you have a better way of summarizing.

Note that documentation is not just for the purpose of enhancing what you can understand by manually reading code.

@connortsui20
connortsui20 requested a review from myrrc November 2, 2026 13:55
@connortsui20

Copy link
Copy Markdown
Member Author

just to make progress, im going to pull the comments out into a separate PR

@connortsui20
connortsui20 merged commit dafc832 into develop Nov 2, 2026
84 of 85 checks passed
@connortsui20
connortsui20 deleted the ct/ext-types/comparison-consistency branch November 2, 2026 15:56
connortsui20 added a commit that referenced this pull request Nov 2, 2026
## Summary

- Tracking Issue: #7683.

Depends on #11016.

DataFusion literals can hold an extension column's Arrow storage value
without its extension metadata. Uses the other operand's field metadata
to reconstruct Vortex extension scalars, so UUID and JSON filters can
still be pushed down with matching dtypes.

## Changes

Uses one binary operand conversion path, with field context for
comparison literals. Comparison and `IN`-list literals use the
registered Arrow importer, preserving explicit literal metadata and
timestamp units. Inherited extension names and payloads come from the
same field, including when the payload is absent, and import errors
retain their original cause.

Tests cover literal metadata, including stale payloads, static filters,
and dynamic filter updates with residual evaluation. Formatting passes
with CI's pinned `nightly-2026-09-10` for `vortex-datafusion`. Tests,
Clippy, and benchmarks were not run locally for this layer.

## API Changes

Exporting a non-temporal extension scalar as a bare DataFusion
`ScalarValue` now returns an error instead of discarding its extension
type. Scalar statistics that cannot preserve the extension type are
omitted.

---------

Signed-off-by: Connor Tsui <[email protected]>
@connortsui20 connortsui20 mentioned this pull request Nov 2, 2026
9 tasks done
connortsui20 added a commit that referenced this pull request Nov 2, 2026
## Summary

Moves the module and helper documentation extracted from #11016 into a
separate PR.

## Changes

Explains temporal storage, binary function execution, encoded
comparisons, and the DuckDB end-to-end tests. Descriptions match current
`develop` behavior so this PR can merge independently of #11016.

Documentation only. No tests, linting, or formatting commands were run
for this PR.

Signed-off-by: Connor Tsui <[email protected]>
connortsui20 added a commit that referenced this pull request Nov 2, 2026
U2, U3, U4, U6, U7 and U8 merged on 2026-11-02 in #11012, #11014 and
#11016, and the DataFusion literal fix #11067 merged right after U2. So
order constraint 1 holds, and phase 1 starts from develop. The graph
shows these nodes as merged, and parts 2 and 4 name the PR that fixed
each finding.

#10953 now keeps i32 days and widens only the days part to i64 when a
value does not fit. It has no review, and it conflicts with the
DateTimeParts compare kernel that U2 changed. #11056 still waits on its
request for changes. #10661 replaces the closed #10482 for file sort
statistics.

In the type roadmap, only the N1 sentence changes.

Signed-off-by: Connor Tsui <[email protected]>
@connortsui20 connortsui20 mentioned this pull request Nov 2, 2026
12 of 49 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants