OpenSearch/x-pack/plugin/sql/qa/server
Andras Palinkas 3d8e17f3bd
SQL: Fix incorrect parameter resolution (#63710) (#64615)
Summary of the issue and the root cause:

```
(1) SELECT 100, 100 -> success
(2) SELECT ?, ? (with params: 100, 100) -> success
(3) SELECT 100, 100 FROM test -> Unknown output attribute exception for the second 100
(4) SELECT ?, ? FROM test (params: 100, 100) -> Unknown output attribute exception for the second ?
(5) SELECT field1 as "x", field1 as "x" FROM test -> Unknown output attribute exception for the second "x"
```

There are two separate issues at play here:
1. Construction of `AttributeMap`s keeps only one of the `Attribute`s with the same name even if the `id`s are different (see the `AttributeMapTests` in this PR). This should be fixed no matter what, we should not overwrite attributes with one another during the construction of the `AttributeMap`.
2. The `id` on the `Alias`es is not the same in case the `Alias`es have the same `name` and same `child`

It was considered to simpy fix the second issue by just reassigning the same `id`s to the `Alias`es with the same name and child, but it would not solve the `unknown output attribute exception` (see notes below). This PR covers the fix for the first issue.

Relates to #56013
2020-11-04 20:38:00 -05:00
..
multi-node SQL: [Tests] Move JDBC integration tests to new module (#56872) (#57072) 2020-05-22 17:49:36 +02:00
security Deprecate REST access to System Indices (#63274) (Original #60945) 2020-10-06 13:41:40 -06:00
single-node SQL: [Tests] Move JDBC integration tests to new module (#56872) (#57072) 2020-05-22 17:49:36 +02:00
src/main SQL: Fix incorrect parameter resolution (#63710) (#64615) 2020-11-04 20:38:00 -05:00
build.gradle Fix Eclipse build (#62733) (#62786) 2020-09-22 17:44:25 -04:00