neilconway opened a new issue, #25419:
URL: https://github.com/apache/datafusion/issues/25419

   ### Describe the bug
   
   When the input list array is sliced, `map_from_arrays` and 
`map_from_entries` in datafusion-spark pair the correct values with keys taken 
from rows _outside_ the slice.
   
   ### To Reproduce
   
   `datafusion-cli --spark`:
   ```
   > CREATE TABLE t AS VALUES ([99, 98], [990, 980]), ([1, 2], [10, 20]);
   
   > SELECT map_from_arrays(column1, column2)
     FROM (SELECT * FROM t ORDER BY column2 DESC LIMIT 1 OFFSET 1) s;
   +--------------------------------------+
   | map_from_arrays(s.column1,s.column2) |
   +--------------------------------------+
   | {99: 10, 98: 20}                     |
   +--------------------------------------+
   
   > CREATE TABLE e AS VALUES
       ([struct(99, 990), struct(98, 980)], 1),
       ([struct(1, 10), struct(2, 20)], 2);
   
   > SELECT map_from_entries(column1)
     FROM (SELECT * FROM e ORDER BY column2 LIMIT 1 OFFSET 1) s;
   +-----------------------------+
   | map_from_entries(s.column1) |
   +-----------------------------+
   | {99: 10, 98: 20}            |
   +-----------------------------+
   
   ```
   
   ### Expected behavior
   
   Both queries should return `{1: 10, 2: 20}`. Without the `OFFSET`, both 
queries return the correct results.
   
   ### Additional context
   
   _No response_


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to