OpenSearch/x-pack/plugin/sql
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
..
jdbc Add compatibility testing for JDBC driver (#60409) 2020-07-29 10:45:11 -07:00
qa SQL: Fix incorrect parameter resolution (#63710) (#64615) 2020-11-04 20:38:00 -05:00
sql-action Upgrade to Lucene-8.7.0 (#64532) (#64537) 2020-11-03 16:57:04 +01:00
sql-cli Replace immediate task creations by using task avoidance api (#60071) (#60504) 2020-07-31 13:09:04 +02:00
sql-client [7.x] SQL: Redact credentials in connection exceptions (#58650) (#59025) 2020-07-04 11:29:06 +02:00
sql-proto SQL: Add option to provide the delimiter for the CSV format (#59907) (#60420) 2020-07-29 21:40:11 +02:00
src SQL: Fix incorrect parameter resolution (#63710) (#64615) 2020-11-04 20:38:00 -05:00
build.gradle SQL: Allow skip of bwc tests on `check` task (#62936) (#63089) 2020-09-30 20:03:19 +02:00