Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #11429
goldmedal opened this issue Jul 12, 2024 · 3 comments · Fixed by #11780
Closed
Tracked by #11429

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

goldmedal opened this issue Jul 12, 2024 · 3 comments · Fixed by #11780
Assignees
Labels
enhancement New feature or request

Comments

@goldmedal
Copy link
Contributor

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

@goldmedal goldmedal added the enhancement New feature or request label Jul 12, 2024
@goldmedal
Copy link
Contributor Author

take

@goldmedal
Copy link
Contributor Author

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

@goldmedal
Copy link
Contributor Author

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
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant