Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: generic sql based on spark sql #324

Draft
wants to merge 8 commits into
base: next
Choose a base branch
from

Conversation

liuxy0551
Copy link
Collaborator

@liuxy0551 liuxy0551 commented Jun 27, 2024

简介

添加通用 SQL 的语法文件,内容基于 spark sql 改动

参考资料

@HaydenOrz HaydenOrz added the new features New feature or request label Jul 31, 2024
@liuxy0551
Copy link
Collaborator Author

  1. 仅保留 SELECT、INSERT 等常见语法,其余的删除
  2. 已有的 sql 需要都通过单测

@tcodehuber
Copy link

能否支持 insert into/overwrite db.tab [(column list)] select *, 目前db-sql-parser语法不报错需要去掉column list, 但是sparksql是支持这个语法的,https://spark.apache.org/docs/latest/sql-ref-syntax-dml-insert-table.html
img_v3_02ed_8b6391bc-a440-440f-a4d3-494c9b5e28cg
@liuxy0551

@liuxy0551
Copy link
Collaborator Author

liuxy0551 commented Sep 5, 2024

能否支持 insert into/overwrite db.tab [(column list)] select *, 目前db-sql-parser语法不报错需要去掉column list, 但是sparksql是支持这个语法的,https://spark.apache.org/docs/latest/sql-ref-syntax-dml-insert-table.html img_v3_02ed_8b6391bc-a440-440f-a4d3-494c9b5e28cg @liuxy0551

@tcodehuber 你好,能提供下你写的 SQL 吗,我这边验证的 SQL 没有语法飘红报错:

INSERT INTO TABLE my_table (col1, col2, col3)
SELECT colA, colB, colC 
FROM source_table
WHERE condition = 'value';

另外我看了下语法文件,官方的 和我们的都支持了
image
image

@tcodehuber
Copy link

insert overwrite
db.user (id, name, ts)
select
id,
name,
ts
from
db.tuser;
image

@liuxy0551
Copy link
Collaborator Author

insert overwrite db.user (id, name, ts) select id, name, ts from db.tuser; image

@tcodehuber 看下你依赖的版本是多少,我这边是 "monaco-sql-languages": "0.12.2", "dt-react-monaco-editor": "1.0.4"
image

@tcodehuber
Copy link

insert overwrite db.user (id, name, ts) select id, name, ts from db.tuser; image

@tcodehuber 看下你依赖的版本是多少,我这边是 "monaco-sql-languages": "0.12.2", "dt-react-monaco-editor": "1.0.4" image

估计是依赖的版本问题,目前还是vue2。我们再排查下,感谢🙏

@liuxy0551 liuxy0551 force-pushed the feat_basic_sql branch 2 times, most recently from ba9c2b3 to 7338423 Compare September 27, 2024 09:36
LuckyFBB and others added 6 commits October 17, 2024 19:21
* feat: add mysql errorListener and commonErrorListener

* feat: improve other sql error msg

* feat: support i18n for error msg

* feat: add all sql errorMsg unit test

* feat: update locale file and change i18n funtion name

* test: upate error unit test
* feat(flinksql): collect comment, type attribute for entity

* feat(flinksql): delete console log

* fix(DTStack#305): delete function ctxToWord,using ctxToText instead of ctxToWord

* feat: update attribute's type

* feat(flinksql): update flinksql's entitycollect unit test

* feat: optimize interface and update unit test

* feat: update collect attr detail

* feat: optimize interface and some function's arguments

* feat: add comment and update params' name

* feat: collect alias in select statement

* feat: update collect attribute function and update unit test

---------

Co-authored-by: zhaoge <>
* feat(trinosql): collect trino sql's attribute(comment,alias,colType)

* feat(hivesql): collect hive sql's attribute(comment,alias,colType)

* feat(impalasql): collect attribute(comment, colType, alias)

* feat(sparksql): collect entity's attribute (comment,alias, colType)

* feat: update endContextList of collect attribute

* feat(postgresql): collect hive sql's attribute(alias,colType)

* feat: update interface of attrInfo and alter entitycollect ts file

* feat(mysql): collect entity's attribute(comment,colType,alias)

* ci: fix check-types problem

---------

Co-authored-by: zhaoge <>
@liuxy0551 liuxy0551 changed the base branch from main to next October 21, 2024 02:19
@liuxy0551 liuxy0551 closed this Oct 21, 2024
@liuxy0551 liuxy0551 reopened this Oct 21, 2024
@liuxy0551 liuxy0551 changed the title add basic sql based on spark sql feat: generic sql based on spark sql Oct 21, 2024
@liuxy0551 liuxy0551 requested review from HaydenOrz, Cythia828, JackWang032 and LuckyFBB and removed request for HaydenOrz and Cythia828 October 21, 2024 11:29
@liuxy0551 liuxy0551 marked this pull request as ready for review October 21, 2024 11:32
src/grammar/sql/SqlParser.g4 Outdated Show resolved Hide resolved
src/grammar/sql/SqlParser.g4 Show resolved Hide resolved
@LuckyFBB
Copy link
Collaborator

这一个基础sql的修改,为何里面有对 sparkSql 的变更?

@liuxy0551
Copy link
Collaborator Author

这一个基础sql的修改,为何里面有对 sparkSql 的变更?

基于 SparkSQL 改动,发现了一些问题,已经单独提 PR,这里应该是构建时不小心添加上来的

@liuxy0551 liuxy0551 reopened this Oct 21, 2024
@liuxy0551 liuxy0551 marked this pull request as draft October 22, 2024 08:12
@liuxy0551
Copy link
Collaborator Author

考虑基于 postgresql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new features New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants