aho135 opened a new issue, #17949:
URL: https://github.com/apache/druid/issues/17949

   We are observing incorrect output for UNNEST when applying it on nested 
arrays
   
   ### Affected Version
   
   32.0.1
   
   ### Description
   Given the following "values" table:
   __time                          | value
   -------------------------------|-------
   2025-04-24T21:20:10.000Z      | 1
   2025-04-24T21:21:10.000Z      | 2
   2025-04-24T21:22:10.000Z      | 3
   
   And the following query:
   ```
   SELECT *
   FROM (
     SELECT ARRAY_AGG(ARRAY[__time, "value"], 1000) AS array_agg
     FROM "values"
   )
   CROSS JOIN UNNEST(array_agg) AS unnested
   ```
   We are receiving this as the result:
   
   array_agg|unnested
   -------------------------------|-------
   [[1745529610000,1],[1745529670000,2],[1745529730000,3]] | [1745529610000]
   [[1745529610000,1],[1745529670000,2],[1745529730000,3]] | null
   
   This is the expected output:
   array_agg|unnested
   -------------------------------|-------
   [[1745529610000,1],[1745529670000,2],[1745529730000,3]] | [1745529610000,1]
   [[1745529610000,1],[1745529670000,2],[1745529730000,3]] | [1745529670000,2]
   [[1745529610000,1],[1745529670000,2],[1745529730000,3]] | [1745529670000,3]
   
   We are also observing similar behavior when trying to UNNEST with an array 
of JSON_OBJECTS:
   ```
   SELECT *
   FROM (
     SELECT ARRAY_AGG(JSON_OBJECT('t':__time, 'v':"value"), 1000) AS array_agg
     FROM "values"
   )
   CROSS JOIN UNNEST(array_agg) AS unnested
   ```
   We are receiving this as the result:
   array_agg|unnested
   -------------------------------|-------
   
[{"t":1745529610000,"v":1},{"t":1745529670000,"v":2},{"t":1745529730000,"v":3}] 
| {"t":1745529610000,"v":null}


-- 
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