-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Hello!
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 |
+------------------------------+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 |
+-----+----------------+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 PhysicalExprfor 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.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
