Skip to content

Uniqueness in keys is not ensured by MAP function like PrestoDB does #3640

@Tishj

Description

@Tishj

What happens?

Uniqueness in keys is not ensured by MAP function

To Reproduce

Steps to reproduce the behavior. Bonus points if those are only SQL queries.

Expected:

presto> select MAP(ARRAY[1, 1, 3, 4],ARRAY[10, 9, 8, 7]);
----
Query 20220513_121640_00001_hhhs4 failed: Duplicate map keys (1) are not allowed

Observed:

select MAP(LIST_VALUE(1, 1, 3, 4),LIST_VALUE(10, 9, 8, 7))
----
{1=10, 1=9, 3=8, 4=7}

Also NULL as a map key has this behavior on PrestoDB:

presto> select MAP(ARRAY[1, 1, 3, NULL],ARRAY[10, 9, 8, 7]);
----
Query 20220607_141513_00003_qpq6n failed: map key cannot be null

Arrow errors on this as well:

pyarrow.lib.ArrowInvalid: Invalid Map: key field can not contain null values

Environment (please complete the following information):

  • OS: MacOS
  • DuckDB Version: latest
  • DuckDB Client: unittest

Before Submitting

  • Have you tried this on the latest master branch?
  • Python: pip install duckdb --upgrade --pre
  • R: install.packages("https://github.com/duckdb/duckdb/releases/download/master-builds/duckdb_r_src.tar.gz", repos = NULL)
  • Other Platforms: You can find binaries here or compile from source.
  • Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions