Skip to content

feat: generic sql based on spark sql #324

New issue

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

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

Already on GitHub? # to your account

Draft
wants to merge 2 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
@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
@LuckyFBB
Copy link
Collaborator

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

@liuxy0551 liuxy0551 force-pushed the feat_basic_sql branch 2 times, most recently from d1b1429 to 4062a56 Compare October 21, 2024 15:46
@liuxy0551 liuxy0551 closed this Oct 21, 2024
@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

@mumiao
Copy link
Collaborator

mumiao commented May 8, 2025

还要等你这个pr么,不需要的话修改下label状态,在备注下原因

@liuxy0551
Copy link
Collaborator Author

@JackWang032 沟通,目前 StarRocks 和 Doris 使用 SparkSQL 语法会有报错,离线资产都是通过关闭语法飘红去使用的,需要考虑下当时实现方式是否合理,或者新增 sql 方言的支持。暂不跟随发版。

@mumiao mumiao removed the request for review from HaydenOrz May 8, 2025 09:28
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
new features New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants