Closed emerkfu closed 2 years ago
upgrade 1.0
mysql> insert into test.rownumber_test_00
-> select
-> t0.id,
-> t1.name
-> from
-> test.rownumber_test_01 t0
-> left join
-> (select
-> t.client_actor_id,
-> t.name
-> from
-> (select
-> t1.client_actor_id,
-> t2.name,
-> row_number()OVER(PARTITION BY t1.client_actor_id,t1.service_actor_id,t1.service_application,t2.name ORDER BY t1.refresh_token_expiration desc) AS rn
-> from test.rownumber_test_02 t1
-> left join test.rownumber_test_03 t2
-> on t1.id = t2.token_id and t2.is_deleted_flg=0
-> where t1.is_deleted_flg=0) t
-> where t.rn = 1
-> ) t1
-> on t0.id= t1.client_actor_id
-> ;
Query OK, 0 rows affected (0.04 sec)
{'label':'insert_4e331671d65a4303-834e7fea963d08cc', 'status':'VISIBLE', 'txnId':'17042'}
Search before asking
Version
0.15.3
What's Wrong?
-- The following is the DDL to create the test table.
DROP TABLE test.
rownumber_test_00
;CREATE TABLE test.
rownumber_test_00
(code
varchar(200) NULL,name
char(255) NULL ) ENGINE=OLAP UNIQUE KEY(code
) COMMENT "rownumber_test_00" DISTRIBUTED BY HASH(code
) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "in_memory" = "false", "storage_format" = "V2" );DROP TABLE test.
rownumber_test_01
;CREATE TABLE test.
rownumber_test_01
(id
varchar(128) NOT NULL,outer_id
varchar(128) NOT NULL ) ENGINE=OLAP UNIQUE KEY(id
,outer_id
) COMMENT "rownumber_test_01" DISTRIBUTED BY HASH(id
,outer_id
) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "in_memory" = "false", "storage_format" = "V2" );DROP TABLE test.
rownumber_test_02
;CREATE TABLE test.
rownumber_test_02
(id
varchar(128) NOT NULL,refresh_token_expiration
datetime NOT NULL ,client_actor_id
varchar(128) NULL,service_actor_id
varchar(128) NULL,client_application
varchar(128) NOT NULL,service_application
varchar(128) NOT NULL,is_deleted_flg
int(11) NULL DEFAULT "0" ) ENGINE=OLAP UNIQUE KEY(id
) COMMENT "rownumber_test_02" DISTRIBUTED BY HASH(id
) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "in_memory" = "false", "storage_format" = "V2" );DROP TABLE test.
rownumber_test_03
;CREATE TABLE test.
rownumber_test_03
(id
varchar(1020) NOT NULL,token_id
varchar(1020) NULL,name
varchar(1020) NULL,is_deleted_flg
int(11) NULL DEFAULT "0" ) ENGINE=OLAP UNIQUE KEY(id
) COMMENT "rownumber_test_03" DISTRIBUTED BY HASH(id
) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1", "in_memory" = "false", "storage_format" = "V2" );-- The following is the SQL that will report an error when executing insert select. -- If only the select part is executed, no error will be reported. -- However, when the complete insert select SQL is executed, an error will occur. -- The above scenario can be reproduced even if there is no data in the test table.
insert into test.
rownumber_test_00
select t0.id, t1.name from test.rownumber_test_01
t0 left join (select t.client_actor_id, t.name from (select t1.client_actor_id, t2.name, row_number()OVER(PARTITION BY t1.client_actor_id,t1.service_actor_id,t1.service_application,t2.name ORDER BY t1.refresh_token_expiration desc) AS rn from test.rownumber_test_02
t1 left join test.rownumber_test_03
t2 on t1.id = t2.token_id and t2.is_deleted_flg=0 where t1.is_deleted_flg=0) t where t.rn = 1 ) t1 on t0.id= t1.client_actor_id ;The following content is the error content.
org.jkiss.dbeaver.model.sql.DBSQLException: SQL 错误 [1064] [42000]: errCode = 2, detailMessage = can't support at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:133) at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:509) at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$0(SQLQueryJob.java:440) at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:168) at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:427) at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:812) at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:3181) at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:121) at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:168) at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:119) at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:4514) at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: java.sql.SQLSyntaxErrorException: errCode = 2, detailMessage = can't support at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:768) at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:653) at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:327) at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:130) ... 12 more
The following is Explain String .
t0
.id
t2
.name
default_cluster:test
.rownumber_test_01
.id
,default_cluster:test
.rownumber_test_01
.outer_id
t0
.id
= <slot 25> <slot 6>t0
.__DORIS_DELETE_SIGN__
= 0t1
.client_actor_id
,t1
.service_actor_id
,t1
.service_application
,t2
.name
t1
.client_actor_id
,t1
.service_actor_id
,t1
.service_application
,t2
.name
default_cluster:test
.rownumber_test_02
.id
t1
.client_actor_id
,t1
.service_actor_id
,t1
.service_application
,t2
.name
t1
.id
=t2
.token_id
t1
.is_deleted_flg
= 0,t1
.__DORIS_DELETE_SIGN__
= 0default_cluster:test
.rownumber_test_03
.id
t2
.is_deleted_flg
= 0,t2
.__DORIS_DELETE_SIGN__
= 0What You Expected?
Can a subquery containing row_number be joined?
How to Reproduce?
No response
Anything Else?
No response
Are you willing to submit PR?
Code of Conduct