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

Some issues with StarRocks being compatible with Trino #34026

Closed
zenoyang opened this issue Oct 31, 2023 · 3 comments · Fixed by #34845, #35158 or #35199
Closed

Some issues with StarRocks being compatible with Trino #34026

zenoyang opened this issue Oct 31, 2023 · 3 comments · Fixed by #34845, #35158 or #35199
Assignees
Labels
type/enhancement Make an enhancement to StarRocks

Comments

@zenoyang
Copy link
Contributor

zenoyang commented Oct 31, 2023

Enhancement

Test version: StarRocks 3.1.0

1. rand function

The rand function has two problems:

  1. select * from xxx where rand() < 0.1; We tested this query and either returned empty or all data. We expected to return about 1/10 of the data. Inconsistent with Trino behavior;
  2. rand(n), when there are parameters, SR represents seed, and Trino represents the output range. The semantics of the two are different;

2. regexp_extract function

In StarRocks, the regexp_extract function returns an empty string when there is no matching content. Trino returns NULL. The two behave inconsistently.

I hope to get everyone’s discussion, feedback and help.

@zenoyang zenoyang added the type/enhancement Make an enhancement to StarRocks label Oct 31, 2023
@imay
Copy link
Contributor

imay commented Oct 31, 2023

@zenoyang thanks for your pointing them out. @wangsimo0 please take a look at these issues.

@wangsimo0
Copy link
Contributor

for the regexp_extract, I'm curious is there a difference between an empty string and null in real world scenario? could you pls give us an example? overall I think we can fix this in trino's compatibility framework without changing sr's build-in funciton's behavior.

@wangsimo0
Copy link
Contributor

for random(n), it seems like a unique function of trino I didn't find any familiar function in other dbms. I think we need to support another function like rand_int(m,n). the input m and n are both integer, and output is also integer.

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