Comments (1)
The Type of SQL
hiveYour Code
const { HiveSQL } = require('dt-sql-parser'); const parser = new HiveSQL(); const sql = `select from_unixtime(unix_timestamp('20210728','yyyyMMdd'),'yyyy-MM-dd') as stat_date, -- from_unixtime(unix_timestamp('20210728','yyyyMMdd'),'yyyy-MM-dd HH:mm:ss') as stat_time, '5' as track_type, tenant_id, -- 5 as track_type, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, count(DISTINCT uid_now) as now_cnt, sum(case when uid_last is NULL then 0 else 1 end) as return_user_cnt from (select a.tenant_id, a.uid_now, b.uid_last from ( SELECT tenant_id , user_id as uid_now FROM tezign_dw.dw_fact_web_tracking_log_add_h where dt is not null and biz_line_id = 'd14eae7480b640cab48af3db8567d298' and product_line_id = '0358a581866642d9b8e6c1c94e5a5f00' AND is_page_flag =1 and cast(create_date as date) > DATE_ADD(from_unixtime(unix_timestamp('20210728','yyyyMMdd'),'yyyy-MM-dd'),-7) and cast(create_date as date) <= from_unixtime(unix_timestamp('20210728','yyyyMMdd'),'yyyy-MM-dd') and tenant_id not in ('t2', 't3', 't4', 't11', 't32', 't39', 't52', 't53', 't127', 't141', 't147', 't168', 't169', 't171', 't172', 't173', 't174', 't178', 't187', 't192', 't197', 't199', 't202') and tenant_id is not NULL and length(user_id)<11 group by tenant_id,user_id) a left join (SELECT tenant_id, user_id as uid_last FROM tezign_dw.dw_fact_web_tracking_log_add_h where dt is not null and biz_line_id = 'd14eae7480b640cab48af3db8567d298' and product_line_id = '0358a581866642d9b8e6c1c94e5a5f00' AND is_page_flag =1 and cast(create_date as date)> DATE_ADD(from_unixtime(unix_timestamp('20210728','yyyyMMdd'),'yyyy-MM-dd'),-14) and cast(create_date as date)<= DATE_ADD(from_unixtime(unix_timestamp('20210728','yyyyMMdd'),'yyyy-MM-dd'),-7) and tenant_id not in ('t2', 't3', 't4', 't11', 't32', 't39', 't52', 't53', 't127', 't141', 't147', 't168', 't169', 't171', 't172', 't173', 't174', 't178', 't187', 't192', 't197', 't199', 't202') and tenant_id is not NULL and length(user_id)<11 group by tenant_id,user_id) b on a.tenant_id=b.tenant_id and a.uid_now = b.uid_last group by a.tenant_id,a.uid_now,b.uid_last) c group by tenant_id`; const errors = parser.validate(sql); console.log(errors);Problem
validate sql too slow, need about 10 seconds;
这里推荐你使用 Web Worker 来处理,可以尝试使用这个项目来集成:https://github.com/DTStack/monaco-sql-languages
from dt-sql-parser.
Related Issues (20)
- [Bug]: hive not support set configuration properties
- [Bug]: webpack mode=production模式下,文件访问报错 HOT 1
- [Bug]: pgsql truncate table suggestion
- [Bug]: ctxToWord is a bad function HOT 1
- [Feature Request]: 收集实体时需要更加丰富的信息
- [Feature Request]: TSQL (MS SQL) Support would be nice
- Cannot use schema "public" cause it is considered as a keyword
- [Feature Request]: Support ClickHouse HOT 1
- [Bug]: "ALTER TABLE" can collect entities but entities don't have belongStmt HOT 1
- [Bug]: 使用基准测试,报错 no such file or directory, open '..../dt-sql-parser/benchmark/reports/flink.benchmark.md' HOT 1
- [Feature Request]: How to add a new language HOT 1
- [Feature Request]: whereClause can complete with column name HOT 1
- [Feature Request]: 支持其他SQL的 alter 收集实体 HOT 1
- 正确的FlinkSQL函数语句会标红色的错误 HOT 1
- Impala正确语法也会标红 HOT 1
- [Doc]: toMatchUnorderedArrary rename to toMatchUnorderedArray
- [Feature Request]: 基准测试优化
- [Bug]: postgreSQL syntax error
- [Feature Request]: 支持所有SQL的所有实体属性收集
- [Bug]: 这段SQL有问题 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dt-sql-parser.