Skip to content

Implement the rewrite from the Map literal to Map function #11434

Closed

Description

@goldmedal

Is your feature request related to a problem or challenge?

Based on the discussion in #11268 (comment), we will support the MAP literal to create a map value. Referring to the DuckDB syntax, we can use syntax like:

SELECT MAP {'key1': 10, 'key2': 20, 'key3': 30};

Describe the solution you'd like

After #11361, we now have two functions: map and make_map. We can use UserDefinedSQLPlanner to implement the proposed syntax and rewrite it to the map function. As @jayzhan211 mentioned in #11361 (comment), we can also use ExprPlanner to handle the make_map function. Since make_map is less efficient than the map function, we should retain only the faster map scalar function implementation. For more details, see the previous discussions and benchmark results in #11361.

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. goldmedal commented on Jul 12, 2024

    @goldmedal
    ContributorAuthor

    take

  2. goldmedal commented on Jul 13, 2024

    @goldmedal
    ContributorAuthor

    I found the MAP literal isn't supported by the sqlparser-rs. I think we need to implement this syntax on the sqlparser-rs side first. However, I think I can have a PR for moving make_map to ExprPlanner first.
    What do you think? @jayzhan211

  3. goldmedal commented on Jul 19, 2024

    @goldmedal
    ContributorAuthor

    The part of moving MAKE_MAP has been solved by #11452. I'll start to implement the MAP literal after apache/datafusion-sqlparser-rs#1344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions