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

[Feature]Add parameter to set whether trino dialect is downgraded #52660

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

renzhimin7
Copy link
Contributor

@renzhimin7 renzhimin7 commented Nov 6, 2024

Why I'm doing:

set sql_dialect = 'trino';
select json_extract(json, '$.store.book')  --正常
select date_sub(current_date, interval 14 day) --正常
但是
select json_extract(json, '$.store.book') , date_sub(current_date, interval 14 day)  -- 不正常
原因是 json_extract符合trino语法,date_sub(current_date, interval 14 day) 符合SR语法,所以两个单独查询没问题,但是联合查时会有异常,会带来困惑

What I'm doing:

Fixes #52702

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
  • I have added documentation for my new feature or new function
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 3.3
    • 3.2
    • 3.1
    • 3.0
    • 2.5

@renzhimin7 renzhimin7 requested a review from a team as a code owner November 6, 2024 03:56
@renzhimin7 renzhimin7 changed the title Dialect downgrade main [Feature]Dialect downgrade main Nov 6, 2024
@renzhimin7 renzhimin7 changed the title [Feature]Dialect downgrade main [Feature]Add parameter to set whether trino dialect is downgraded Nov 7, 2024
@miomiocat
Copy link
Contributor

@wangsimo0 Can you help review this requirement

miomiocat
miomiocat previously approved these changes Nov 7, 2024
@miomiocat miomiocat enabled auto-merge (squash) November 7, 2024 12:04
@wangsimo0
Copy link
Contributor

wangsimo0 commented Nov 7, 2024

Thanks for your contributing!
In the beginning, I'm just thinking about the scalability of this parameter, and it seems fine. So I just recorded some thoughts here:
In the future, starrocks may support different kinds of SQL dialects. For example spark, hive, impala, and so on. And some users may need to downgrade the SQL in a different order. For example, trino->spark->hive->starrocks.
StarRocks' default behavior will always be the sql_dialect -> starrocks dialect. And in the future maybe we can provide a parameter like something like sql_dialect_downgrade_order? and it will be still affected by the ENABLE_DIALECT_DOWNGRADE parameter, which still makes sense.
So I think this parameter LGTM

@wangsimo0
Copy link
Contributor

pls add related doc, thx in advance

Seaven
Seaven previously approved these changes Nov 7, 2024
Copy link

github-actions bot commented Nov 8, 2024

[FE Incremental Coverage Report]

pass : 9 / 9 (100.00%)

file detail

path covered_line new_line coverage not_covered_line_detail
🔵 com/starrocks/qe/SessionVariable.java 3 3 100.00% []
🔵 com/starrocks/sql/parser/SqlParser.java 6 6 100.00% []

auto-merge was automatically disabled November 8, 2024 08:13

Head branch was pushed to by a user without write access

@renzhimin7 renzhimin7 dismissed stale reviews from Seaven and miomiocat via 10e2c4e November 8, 2024 08:13
Copy link

sonarcloud bot commented Nov 8, 2024

Copy link

github-actions bot commented Nov 8, 2024

[Java-Extensions Incremental Coverage Report]

pass : 0 / 0 (0%)

Copy link

github-actions bot commented Nov 8, 2024

[BE Incremental Coverage Report]

pass : 0 / 0 (0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add parameter to set whether trino dialect is downgraded
4 participants