opendistro-for-elasticsearch / sql

🔍 Open Distro SQL Plugin
https://opendistro.github.io/for-elasticsearch/features/SQL%20Support.html
Apache License 2.0
621 stars 186 forks source link

Cannot recoginze Sql identifer b.XXX #1169

Open tlxfif opened 2 years ago

tlxfif commented 2 years ago
SELECT
  *
FROM
  `table1` as a,
  `table2` as b
WHERE
a.XXX= b.XXX

find ERROR

{"reason":"There was internal problem at backend","details":"Cannot recoginze Sql identifer b.XXX","type":"SqlParseException"}


SELECT a.XXX FROM `table1` as a limit 1   [is OK]
SELECT b.XXX FROM `table2` as b limit 1   [is OK]

opendistroforelasticsearch log


com.amazon.opendistroforelasticsearch.sql.legacy.exception.SqlParseException: Cannot recoginze Sql identifer b.XXX
        at com.amazon.opendistroforelasticsearch.sql.legacy.query.maker.Maker.make(Maker.java:204) ~[legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.query.maker.Maker.make(Maker.java:127) ~[legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.query.maker.QueryMaker.explanWhere(QueryMaker.java:59) ~[legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.query.maker.QueryMaker.explanWhere(QueryMaker.java:64) ~[legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.query.maker.QueryMaker.explain(QueryMaker.java:46) ~[legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.query.DefaultQueryAction.setWhere(DefaultQueryAction.java:223) ~[legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.query.DefaultQueryAction.buildRequest(DefaultQueryAction.java:97) ~[legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.query.DefaultQueryAction.explain(DefaultQueryAction.java:88) ~[legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.executor.format.PrettyFormatRestExecutor.buildProtocolForDefaultQuery(PrettyFormatRestExecutor.java:102) ~[legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.executor.format.PrettyFormatRestExecutor.execute(PrettyFormatRestExecutor.java:77) [legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.executor.format.PrettyFormatRestExecutor.execute(PrettyFormatRestExecutor.java:53) [legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.executor.AsyncRestExecutor.doExecuteWithTimeMeasured(AsyncRestExecutor.java:161) [legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.executor.AsyncRestExecutor.lambda$async$1(AsyncRestExecutor.java:121) [legacy-1.8.0.0.jar:?]
        at com.amazon.opendistroforelasticsearch.sql.legacy.utils.LogUtils.lambda$withCurrentContext$0(LogUtils.java:72) [legacy-1.8.0.0.jar:?]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:684) [elasticsearch-7.10.2.jar:7.10.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?]
        at java.lang.Thread.run(Thread.java:832) [?:?]