-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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] pinot sql transformation to sr sql with date functionPinot dialect date function #55106
base: main
Are you sure you want to change the base?
Conversation
e5a810e
to
89b9dd5
Compare
if (args.length < 2 || args.length > 5) { | ||
throw new SemanticException("The datetrunc function must include between 2 and 5 parameters, inclusive."); | ||
} | ||
// DATETRUNC(unit, timeValue) or DATETRUNC(unit, timeValue, inputTimeUnitStr) output is milliseconds --> unix_timestamp(date_trunc('day',event_timestamp)) * 1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, too long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have change it to be shorter
|
||
public class ComplexFunctionCallTransformer { | ||
public static Expr transform(String functionName, Expr... args) { | ||
if (functionName.equalsIgnoreCase("datetimeconvert")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you make it more extensible with separated class/function for each function ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have added some seperated functions for each function
Expr convertedFunctionCall = Pinot2SRFunctionCallTransformer.convert(functionName, arguments); | ||
|
||
if (convertedFunctionCall != null) { | ||
if (functionName.equalsIgnoreCase("fromdatetime")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it a static ?
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class Pinot2SRFunctionCallTransformer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better abstract a class FunctionCallTransformer, both Trino2SRFunctionCallTransformer and Pinot2SRFunctionCallTransformer can inherit from it, to avoid duplicate code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have create a abstract base class
statements.add(statement); | ||
} | ||
String sqlTrans = AstToSQLBuilder.toSQL(statements.get(0)); | ||
System.out.println("sqlTrans: " + sqlTrans); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not print here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have delete it
edf677c
to
9dd9d64
Compare
5b958d1
to
277c98a
Compare
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 396 / 489 (80.98%) file detail
|
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
277c98a
to
0900713
Compare
Signed-off-by: maggie-zhu <[email protected]>
Signed-off-by: maggie-zhu <[email protected]>
Signed-off-by: maggie-zhu <[email protected]>
Signed-off-by: maggie-zhu <[email protected]>
Signed-off-by: maggie-zhu <[email protected]>
Signed-off-by: maggie-zhu <[email protected]>
Signed-off-by: maggie-zhu <[email protected]>
Signed-off-by: maggie-zhu <[email protected]>
0900713
to
082ebbd
Compare
Why I'm doing:
We have many pinot sqls in the prod environment when we try to migrate the pinot to starrocks. We hope the starrocks can support the sql transformation automatically.
What I'm doing:
To support the sql transformation from pinot sql to starrocks sql when use some date/string/aggregation functions.
Fixes #55276
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: