You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "dharanad (via GitHub)" <gi...@apache.org> on 2024/08/07 17:17:28 UTC

Re: [I] Support Arrays for the Map scalar functions [datafusion]

dharanad commented on issue #11436:
URL: https://github.com/apache/datafusion/issues/11436#issuecomment-2273952089

   Sharing my observation from `DuckDB`, both `Map` exprssion and `map` function are meant to do two different things.
   But in Datafusion we are using `map` function to support `Map` expression. 
   In case of `DuckDB` `Map` expr & `map` function would yeild different result for same input.
   Shouldn't we have two different function to support these two use cases ? Or any ideas on how should we support both usecases using using single `map` function.
   ### Observations
   ```
   D create table t as values
   · ('a', 1, 'k1', 10, ['k1', 'k2'], [1, 2], 'POST', [[1,2,3]]),
   · ('b', 2, 'k3', 30, ['k3'], [3], 'PUT', [[4]]),
   ‣ ('d', 4, 'k5', 50, ['k5'], [5], null, [[1,2]]);
   
   D select map(col4, col5) from t;
   ┌───────────────────────┐
   │    map(col4, col5)    │
   │ map(varchar, integer) │
   ├───────────────────────┤
   │ {k1=1, k2=2}          │
   │ {k3=3}                │
   │ {k5=5}                │
   └───────────────────────┘
   
   D select Map {col4: col5} from t;
   ┌────────────────────────────────────────────────────────┐
   │ main.map(main.list_value(col4), main.list_value(col5)) │
   │               map(varchar[], integer[])                │
   ├────────────────────────────────────────────────────────┤
   │ {[k1, k2]=[1, 2]}                                      │
   │ {[k3]=[3]}                                             │
   │ {[k5]=[5]}                                             │
   └────────────────────────────────────────────────────────┘
   ```
   
   In the meantime i will continue my investigation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org