create view中语法问题
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Domain
- databases, stream-processing
Research direction
Start in CreateTmpTableParser at the EMPTY_STR pattern, then trace how SqlParser handles the supplied CREATE VIEW statement. Reproduce the SQL example and verify that leading whitespace before CREATE VIEW is accepted and that the subsequent INSERT statements parse successfully.
Written by the indexing model from the issue text.
Description
用
CREATE VIEW viewName [ (columnName[ , columnName]*) ];
INSERT INTO viewName queryStatement;
的语法使用临时表,会报错。
我的sql用例如下:
CREATE TABLE MyTable(
name varchar,
channel varchar,
pv INT,
xctime bigint,
CHARACTER_LENGTH(channel) AS timeLeng
)WITH(
type ='kafka10',
bootstrapServers ='hw-bd-01:9092',
zookeeperQuorum ='hw-bd-01:2181/kafka',
offsetReset ='earliest',
topic ='zxh_test',
parallelism ='1',
topicIsPattern='false'
);
create view MyView1 (
name varchar,
pv INT,
channel varchar
);
insert into MyView1 select name,pv+100 as pv,channel from MyTable;
CREATE TABLE MyResult(
name VARCHAR,
channel varchar,
cnt INT
)WITH(
type ='console',
parallelism ='1'
);
insert
into
MyResult
select
name,
channel,
pv+2000 as cnt
from
MyView1 where name='zhou';
报错的内容为:
Exception in thread "main" java.lang.RuntimeException: create view MyView1 ( name varchar, pv INT, channel varchar ):Syntax does not support,the format of SQL like insert into tb1 select * from tb2.
at com.dtstack.flink.sql.parser.SqlParser.parseSql(SqlParser.java:95)
at com.dtstack.flink.sql.exec.ExecuteProcessHelper.getStreamExecution(ExecuteProcessHelper.java:153)
at com.dtstack.flink.sql.Main.main(Main.java:42)
at com.dtstack.flink.sql.launcher.LauncherMain.main(LauncherMain.java:138)
修改方法:
将CreateTmpTableParser类中的
private static final String EMPTY_STR = "(?i)^\\screate\\s+view\\s+(\\S+)\\s*\\((.+)\\)$";
改为
private static final String EMPTY_STR = "(?i)^\\s*create\\s+view\\s+(\\S+)\\s*\\((.+)\\)$";
即可
- Dominant language
- Java
- Stars
- 2k
- Forks
- 913
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DTStack/flinkStreamSQL
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
DTStack/flinkStreamSQL#467 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
DTStack/flinkStreamSQL#437 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
DTStack/flinkStreamSQL#432 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
DTStack/flinkStreamSQL#431 ·
-
有无对sql 语法校验的方法 Open
Difficulty 5/5 Over a week Newbie friendliness 15/100
DTStack/flinkStreamSQL#430 · 1 comment ·
All issues in DTStack/flinkStreamSQL
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Openbug frontend maui-pilot
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
objectionary/eo-graphs#74 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100