提交 ba5baa94 authored 作者: Thomas Mueller's avatar Thomas Mueller

The INSERT optimizations (INSERT ... DIRECT SORTED SELECT) were not parsed…

The INSERT optimizations (INSERT ... DIRECT SORTED SELECT) were not parsed correctly when using a column list.
上级 7b6e894f
...@@ -921,12 +921,6 @@ public class Parser { ...@@ -921,12 +921,6 @@ public class Parser {
read("INTO"); read("INTO");
Table table = readTableOrView(); Table table = readTableOrView();
command.setTable(table); command.setTable(table);
if (readIf("DIRECT")) {
command.setInsertFromSelect(true);
}
if (readIf("SORTED")) {
command.setSortedInsertMode(true);
}
if (readIf("(")) { if (readIf("(")) {
if (isSelect()) { if (isSelect()) {
command.setQuery(parseSelect()); command.setQuery(parseSelect());
...@@ -936,6 +930,12 @@ public class Parser { ...@@ -936,6 +930,12 @@ public class Parser {
Column[] columns = parseColumnList(table); Column[] columns = parseColumnList(table);
command.setColumns(columns); command.setColumns(columns);
} }
if (readIf("DIRECT")) {
command.setInsertFromSelect(true);
}
if (readIf("SORTED")) {
command.setSortedInsertMode(true);
}
if (readIf("DEFAULT")) { if (readIf("DEFAULT")) {
read("VALUES"); read("VALUES");
Expression[] expr = { }; Expression[] expr = { };
......
--- special grammar and test cases --------------------------------------------------------------------------------------------- --- special grammar and test cases ---------------------------------------------------------------------------------------------
create table test(id int primary key);
> ok
insert into test(id) direct sorted select x from system_range(1, 100);
> update count: 100
explain insert into test(id) direct sorted select x from system_range(1, 100);
> PLAN
> -----------------------------------------------------------------------------------------------------
> INSERT INTO PUBLIC.TEST(ID) DIRECT SORTED SELECT X FROM SYSTEM_RANGE(1, 100) /* PUBLIC.RANGE_INDEX */
> rows: 1
drop table test;
> ok
create table test(d date, t time, ts timestamp); create table test(d date, t time, ts timestamp);
> ok > ok
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论