Skip to content

Conversation

shah-nirmit
Copy link
Contributor

@shah-nirmit shah-nirmit commented Mar 23, 2025

Resolves #600

Also did not need new subscript functions as unresolved subscript functions already takes care of this. See below

postgres=# select r['mp'][100] from duckdb.query($$ select mp from tbl1 $$) r;
 r.mp[100] 
-----------
         1
(1 row)

postgres=# select r['mp'][200] from duckdb.query($$ select mp from tbl1 $$) r;
 r.mp[200] 
-----------
         2
(1 row)

postgres=# select r['mp'][1] from duckdb.query($$ select mp from tbl1 $$) r;
 r.mp[1] 
---------
        
(1 row)

postgres=# select * from duckdb.query($$ select mp[100] from tbl1 $$) r;
 mp[100] 
---------
       1
(1 row)

postgres=# select * from duckdb.query($$ select mp[200] from tbl1 $$) r;
 mp[200] 
---------
       2
(1 row)

Signed-off-by: Nirmit Shah <nirmitshah191@gmail.com>
@shah-nirmit shah-nirmit requested a review from Y-- March 29, 2025 03:01
@shah-nirmit
Copy link
Contributor Author

@Y-- can you please review again , thanks

Copy link
Collaborator

@Y-- Y-- left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the extra iterations!

@Y-- Y-- merged commit e99ab5d into duckdb:main Apr 1, 2025
6 checks passed
JelteF added a commit that referenced this pull request May 8, 2025
In #689 the subscript operator was not implemented for the duckdb.map
type. This worked fine for MAPs returned by `duckdb.query()` because
that returned duckdb.unresolved_type. But not when getting a map from a
`duckdb` table column, i.e. a MotherDuck table. So this implements the
subscript operator directly on the `duckdb.map` type.

Fixes #732
JelteF added a commit that referenced this pull request May 9, 2025
In #689 the subscript operator was not implemented for the duckdb.map
type. This worked fine for MAPs returned by `duckdb.query()` because
that returned duckdb.unresolved_type. But not when getting a map from a
`duckdb` table column, i.e. a MotherDuck table. So this implements the
subscript operator directly on the `duckdb.map` type.

Fixes #732
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support the DuckDB MAP type
3 participants