ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Kasnacheev (Jira)" <j...@apache.org>
Subject [jira] [Created] (IGNITE-12229) Column not found when using CASE named column from result
Date Tue, 24 Sep 2019 17:34:00 GMT
Ilya Kasnacheev created IGNITE-12229:
----------------------------------------

             Summary: Column not found when using CASE named column from result
                 Key: IGNITE-12229
                 URL: https://issues.apache.org/jira/browse/IGNITE-12229
             Project: Ignite
          Issue Type: Improvement
          Components: sql
    Affects Versions: 2.7.6
            Reporter: Ilya Kasnacheev


Consider the following SQL:
{code}
create table main (key varchar primary key, val int, grouper int);
create table joiner (key varchar primary key, value int, grouper int);
select m.key, case when m.grouper > j.grouper then 1 else -1 end d_grouper from main m
join joiner j on m.key = j.key where d_grouper = 1 order by d_grouper;
{code}
Expected behavior - success.
Observed behavior:
{code}
[20:31:13,498][SEVERE][jdbc-request-handler-worker-#1828][JdbcRequestHandler] Failed to execute
SQL query [reqId=0, req=JdbcQueryExecuteRequest [schemaName=PUBLIC, pageSize=1024, maxRows=0,
sqlQry=select m.key, case when m.grouper > j.grouper then 1 else -1 end d_grouper from
main m join joiner j on m.key = j.key where d_grouper = 1 order by d_grouper, args=[], stmtType=ANY_STATEMENT_TYPE,
autoCommit=true]]
class org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to parse query.
Столбец "D_GROUPER" не найден
Column "D_GROUPER" not found; SQL statement:
select m.key, case when m.grouper > j.grouper then 1 else -1 end d_grouper from main m
join joiner j on m.key = j.key where d_grouper = 1 order by d_grouper [42122-197]
        at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatementAndCaches(IgniteH2Indexing.java:2653)
        at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.parseAndSplit(IgniteH2Indexing.java:2356)
        at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:2196)
        at org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2128)
        at org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2123)
        at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
        at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2693)
        at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2137)
        at org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.executeQuery(JdbcRequestHandler.java:511)
        at org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.doHandle(JdbcRequestHandler.java:245)
        at org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandlerWorker.body(JdbcRequestHandlerWorker.java:90)
        at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.h2.jdbc.JdbcSQLException: Столбец "D_GROUPER" не найден
Column "D_GROUPER" not found; SQL statement:
select m.key, case when m.grouper > j.grouper then 1 else -1 end d_grouper from main m
join joiner j on m.key = j.key where d_grouper = 1 order by d_grouper [42122-197]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:357)
        at org.h2.message.DbException.get(DbException.java:179)
        at org.h2.message.DbException.get(DbException.java:155)
        at org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:150)
        at org.h2.expression.Comparison.optimize(Comparison.java:177)
        at org.h2.expression.ConditionAndOr.optimize(ConditionAndOr.java:130)
        at org.h2.command.dml.Select.prepare(Select.java:861)
        at org.h2.command.Parser.prepareCommand(Parser.java:283)
        at org.h2.engine.Session.prepareLocal(Session.java:611)
        at org.h2.engine.Session.prepareCommand(Session.java:549)
        at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1247)
        at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:76)
        at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:694)
        at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepare0(IgniteH2Indexing.java:539)
        at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatement(IgniteH2Indexing.java:509)
        at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatement(IgniteH2Indexing.java:476)
        at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatementAndCaches(IgniteH2Indexing.java:2635)
        ... 12 more
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message