{{ message }}
Repository navigation
Fix VARIANT cast reading wrong rows under a filter - #23031
Merged
Mytherin merged 2 commits intoJun 4, 2026
Merged
Conversation
mlafeldt
force-pushed
the
fix/variant-to-variant-selection
branch
from
June 3, 2026 12:13
4e6c9e9 to
4d71e9a
Compare
mlafeldt
marked this pull request as draft
June 3, 2026 12:13
mlafeldt
marked this pull request as ready for review
June 3, 2026 12:13
mlafeldt
marked this pull request as draft
June 3, 2026 19:58
mlafeldt
marked this pull request as ready for review
June 3, 2026 19:58
mlafeldt
marked this pull request as draft
June 3, 2026 20:23
mlafeldt
marked this pull request as ready for review
June 3, 2026 20:23
ConvertVariantToVariant indexed the source by the raw loop counter, ignoring the incoming selection vector, so nested VARIANT values were read from the wrong rows under a filter. Map the index through GetMappedIndex like the other converters.
mlafeldt
force-pushed
the
fix/variant-to-variant-selection
branch
from
June 4, 2026 07:23
8b232f2 to
216fe98
Compare
Member
Author
mlafeldt
marked this pull request as draft
June 4, 2026 07:24
mlafeldt
marked this pull request as ready for review
June 4, 2026 07:24
Member
|
Thanks! |
krlmlr
pushed a commit
to krlmlr/duckdb
that referenced
this pull request
Jun 21, 2026
…ilter; ADBC 1.1.0 rich errors) Conflict-free bundle of the clean commits between resolutions: VARIANT cast reading wrong rows under a filter, and the ADBC 1.1.0 Rich Error Metadata API. No conflicts with main.
krlmlr
pushed a commit
to krlmlr/duckdb
that referenced
this pull request
Jun 21, 2026
`ConvertVariantToVariant` indexed the source by the raw loop counter,
ignoring the incoming selection vector, so nested `VARIANT` values were
read from the wrong rows under a filter. Map the index through
`GetMappedIndex` like the other converters.
Before:
```
❯ duckdb
-- Loading resources from /Users/mathias/.duckdbrc
DuckDB v1.5.3 (Variegata)
Enter ".help" for usage hints.
🟡◗ CREATE TABLE t AS SELECT i, MAP{'k': i::VARIANT} AS m FROM range(2) t(i);
🟡◗ SELECT m::VARIANT FROM t WHERE i = 1;
┌──────────────────────────┐
│ CAST(m AS "VARIANT") │
│ variant │
├──────────────────────────┤
│ [{'key': k, 'value': 0}] │
└──────────────────────────┘
🟡◗ SELECT m::VARCHAR FROM t WHERE i = 1;
┌────────────────────┐
│ CAST(m AS VARCHAR) │
│ varchar │
├────────────────────┤
│ {k=1} │
└────────────────────┘
```
(`'value': 0` is wrong)
After:
```
❯ ./build/release/duckdb
-- Loading resources from /Users/mathias/.duckdbrc
DuckDB v1.5.4-dev84 (Development Version, 4e6c9e9)
Enter ".help" for usage hints.
🟡◗ CREATE TABLE t AS SELECT i, MAP{'k': i::VARIANT} AS m FROM range(2) t(i);
🟡◗ SELECT m::VARIANT FROM t WHERE i = 1;
┌──────────────────────────┐
│ CAST(m AS "VARIANT") │
│ variant │
├──────────────────────────┤
│ [{'key': k, 'value': 1}] │
└──────────────────────────┘
🟡◗ SELECT m::VARCHAR FROM t WHERE i = 1;
┌────────────────────┐
│ CAST(m AS VARCHAR) │
│ varchar │
├────────────────────┤
│ {k=1} │
└────────────────────┘
```
Reported on
[Discord](https://discord.com/channels/909674491309850675/1125676736311480340/1511698549354664020)
krlmlr
pushed a commit
to krlmlr/duckdb
that referenced
this pull request
Jun 21, 2026
…ilter; ADBC 1.1.0 rich errors) Conflict-free bundle of the clean commits between resolutions: VARIANT cast reading wrong rows under a filter, and the ADBC 1.1.0 Rich Error Metadata API. No conflicts with main.
krlmlr
pushed a commit
to krlmlr/duckdb
that referenced
this pull request
Jun 21, 2026
Brings these v1.5-variegata commits; they do not overlap with the main/v2.0 line, so they merge with no conflicts: - Fix VARIANT cast reading wrong rows under a filter (duckdb#23031) - fix(adbc): implement ADBC 1.1.0 Rich Error Metadata API (duckdb#23073)
krlmlr
pushed a commit
to krlmlr/duckdb
that referenced
this pull request
Jun 21, 2026
Brings these v1.5-variegata commits; they do not overlap with the main/v2.0 line, so they merge with no conflicts: - Fix VARIANT cast reading wrong rows under a filter (duckdb#23031) - fix(adbc): implement ADBC 1.1.0 Rich Error Metadata API (duckdb#23073)
kaka11chen
pushed a commit
to kaka11chen/astrovela_vane
that referenced
this pull request
Aug 14, 2026
`ConvertVariantToVariant` indexed the source by the raw loop counter,
ignoring the incoming selection vector, so nested `VARIANT` values were
read from the wrong rows under a filter. Map the index through
`GetMappedIndex` like the other converters.
Before:
```
❯ duckdb
-- Loading resources from /Users/mathias/.duckdbrc
DuckDB v1.5.3 (Variegata)
Enter ".help" for usage hints.
🟡◗ CREATE TABLE t AS SELECT i, MAP{'k': i::VARIANT} AS m FROM range(2) t(i);
🟡◗ SELECT m::VARIANT FROM t WHERE i = 1;
┌──────────────────────────┐
│ CAST(m AS "VARIANT") │
│ variant │
├──────────────────────────┤
│ [{'key': k, 'value': 0}] │
└──────────────────────────┘
🟡◗ SELECT m::VARCHAR FROM t WHERE i = 1;
┌────────────────────┐
│ CAST(m AS VARCHAR) │
│ varchar │
├────────────────────┤
│ {k=1} │
└────────────────────┘
```
(`'value': 0` is wrong)
After:
```
❯ ./build/release/duckdb
-- Loading resources from /Users/mathias/.duckdbrc
DuckDB v1.5.4-dev84 (Development Version, 4e6c9e90a7)
Enter ".help" for usage hints.
🟡◗ CREATE TABLE t AS SELECT i, MAP{'k': i::VARIANT} AS m FROM range(2) t(i);
🟡◗ SELECT m::VARIANT FROM t WHERE i = 1;
┌──────────────────────────┐
│ CAST(m AS "VARIANT") │
│ variant │
├──────────────────────────┤
│ [{'key': k, 'value': 1}] │
└──────────────────────────┘
🟡◗ SELECT m::VARCHAR FROM t WHERE i = 1;
┌────────────────────┐
│ CAST(m AS VARCHAR) │
│ varchar │
├────────────────────┤
│ {k=1} │
└────────────────────┘
```
Reported on
[Discord](https://discord.com/channels/909674491309850675/1125676736311480340/1511698549354664020)
Upstream-Commit: duckdb/duckdb@be167b0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

ConvertVariantToVariantindexed the source by the raw loop counter, ignoring the incoming selection vector, so nestedVARIANTvalues were read from the wrong rows under a filter. Map the index throughGetMappedIndexlike the other converters.Before:
(
'value': 0is wrong)After:
Reported on Discord