alibaba / druid

阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
https://github.com/alibaba/druid/wiki
Apache License 2.0
27.97k stars 8.58k forks source link

关于sqlutil 解析hive 多层with嵌套失败的问题 #4171

Open 401825317 opened 3 years ago

401825317 commented 3 years ago

版本是1.2.5 也试过1.1.23 都不行 sql语句hive可以正常执行的 已验证 String s7 = "WITH A AS (\r\n"

401825317 commented 3 years ago

@Arbow @argan @septer @zhuzhaoyuan

401825317 commented 3 years ago

@wenshao帮忙看看 在线等

wenshao commented 3 years ago
WITH A AS (
 WITH A1 AS (
 SELECT *
 FROM aaa1226.123
 LIMIT 1
 )
 SELECT *
 FROM A1
 ), 
 B AS (
 SELECT *
 FROM aaa1226.123
 LIMIT 1
 )
SELECT *
FROM A, B

这里的表名aaa1226.123比较奇怪,这个确实是生产环境的表么?

401825317 commented 3 years ago

首先感谢您的回答 表名是测试环境的 跟这个有关系嘛?

401825317 commented 3 years ago

方便加微信沟通嘛?17303101158

401825317 commented 3 years ago

去掉也不好使

401825317 commented 3 years ago

提示解析到第二层with就报错了

401825317 commented 3 years ago

@wenshao 还在看吗???

wenshao commented 3 years ago

你更新到1.2.5版本,将其中两处的表名改一下,就可以了

401825317 commented 3 years ago

@wenshao String name = lexer.stringVal();
lexer.nextToken();
accept(Token.EQ);
SQLExpr value = this.exprParser.primary();
1.2.5报错 stmt 是HiveCreateTableStatement stmt.getTableOptions().put(name, value);
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
这块的代码应该如何改?

401825317 commented 3 years ago

String name = lexer.stringVal(); lexer.nextToken(); accept(Token.EQ); SQLExpr value = this.exprParser.primary(); stmt.getTableOptions().add(new SQLAssignItem(value, value)); 上边这个name怎么放到SQLAssignItem进去?