databend icon indicating copy to clipboard operation
databend copied to clipboard

Feature: Support map functions

Open b41sh opened this issue 10 months ago • 7 comments

Summary

  • [x] #15337
  • [x] MAP_CONTAINS_KEY(<key>, <map>) Determines whether the specified MAP contains the specified key. @hanxuanliang
  • [x] MAP_DELETE(<map>, <key1>[, <key2>, ...]) Returns a MAP based on an existing MAP with one or more keys removed..
  • [ ] MAP_INSERT(<map>, <key>, <value>[, <updateFlag>]) Returns a new MAP consisting of the input MAP with a new key-value pair inserted (an existing key updated with a new value).
  • [ ] MAP_PICK(<map>, <key1>[, <key2>, ...]) or MAP_PICK(<map>, <array>) Returns a new MAP containing the specified key-value pairs from an existing MAP.
  • [x] MAP_SIZE(<map>) Returns the size of a MAP.

Refer to the following documentations: https://docs.snowflake.com/en/sql-reference/functions/map_cat https://docs.snowflake.com/en/sql-reference/functions/map_contains_key https://docs.snowflake.com/en/sql-reference/functions/map_delete https://docs.snowflake.com/en/sql-reference/functions/map_insert https://docs.snowflake.com/en/sql-reference/functions/map_pick https://docs.snowflake.com/en/sql-reference/functions/map_size

b41sh avatar Apr 22 '24 16:04 b41sh

Hi @b41sh,

I am interested in taking on the implementation of the feature. If available, I would appreciate being assigned to this task.

Thank you for your consideration.

shamb0 avatar Apr 23 '24 10:04 shamb0

Hi, @shamb0 Thanks for your attention, you can pick the functions that interest you.

b41sh avatar Apr 23 '24 10:04 b41sh

I want to try map_contains_key

hanxuanliang avatar May 08 '24 16:05 hanxuanliang

https://arrow.apache.org/docs/python/generated/pyarrow.MapType.html#pyarrow.MapType.keys_sorted Is this attribute not supported? If supported, there are more efficient algorithm implementations

forsaken628 avatar May 09 '24 00:05 forsaken628

I want to try map_contains_key

Hi @hanxuanliang Thank you for your interest, you can work on this function.

b41sh avatar May 09 '24 05:05 b41sh

https://arrow.apache.org/docs/python/generated/pyarrow.MapType.html#pyarrow.MapType.keys_sorted Is this attribute not supported? If supported, there are more efficient algorithm implementations

currently, we don't support keys_sorted attribute, considering the compatibility of the previous data, we do not plan to modify it in the short term.

b41sh avatar May 09 '24 06:05 b41sh

I would like to work on MAP_PICK

vaibhawvipul avatar May 13 '24 12:05 vaibhawvipul