ovr opened a new issue, #2442: URL: https://github.com/apache/arrow-datafusion/issues/2442
Hello! ```sql SELECT r.value[1 + 1] FROM (SELECT array[1,2,3] as value, 1 as key UNION ALL SELECT array[1,2,3] as value, 1 as key) as r; +------------------------------+ | r.value[Int64(1) + Int64(1)] | +------------------------------+ | 3 | | 3 | +------------------------------+ ``` ```sql SELECT r.key, r.value[r.key] FROM (SELECT array[1,2,3] as value, 1 as key UNION ALL SELECT array[1,2,3] as value, 1 as key) as r; +-----+----------------+ | key | r.value[r.key] | +-----+----------------+ | 1 | 2 | | 1 | 2 | +-----+----------------+ ``` ```sql SELECT (ARRAY[1,2,3])[1 + 1]; ``` **Describe the solution you'd like** I would like to split `GetIndexedExpr` into `MapAccessExpr` (will continue to accept `key` as `ScalarValue)` & `ArrayIndexExpr` (will use `PhysicalExpr` for key) **Describe alternatives you've considered** Making key as `PhysicalExpr`for `GetIndexedExpr` but it makes a problem with type detection for a field of a `Struct` type. Probably, it's why PostgreSQL doesn't allow expression in MapAccess. **Additional context** I have drafted already a branch that supports it. <img width="1478" alt="image" src="https://user-images.githubusercontent.com/572096/166719763-04922c76-1241-47f7-95f3-e2434789a0c3.png"> -- 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]
