-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[CALCITE-6876] Druid Adapter support more functions #4227
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3969,6 +3969,30 @@ private void testCountWithApproxDistinct(boolean approx, String sql, String expe | |
+ "filter=[AND(>(SIN($91), 0.9129452507276277E0), >(COS($90), 0.40808206181339196E0), =(FLOOR(TAN($91)), 2.0E0), " | ||
+ "<(ABS(-(TAN($91), /(SIN($91), COS($91)))), 1.0E-6))], " | ||
+ "groups=[{}], aggs=[[COUNT()]])"); | ||
|
||
final String sql1 = "SELECT COUNT(*) FROM " + FOODMART_TABLE + " WHERE " | ||
+ "COT(\"store_cost\") > COT(20) AND ASIN(\"store_sales\") > ASIN(1) " | ||
+ "AND FLOOR(ACOS(\"store_cost\")) = 2 " | ||
+ "AND ABS(ATAN(\"store_cost\") - ATAN(\"store_cost\") / ATAN(\"store_cost\")) < 10e-7"; | ||
sql(sql1, FOODMART) | ||
.returnsOrdered("EXPR$0=0") | ||
.explainContains("PLAN=EnumerableInterpreter\n" | ||
+ " DruidQuery(table=[[foodmart, foodmart]], " | ||
+ "intervals=[[1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z]], " | ||
+ "filter=[AND(>(COT($91), 0.4469951089489167E0), >(ASIN($90), 1.5707963267948966E0), =(FLOOR(ACOS($91)), 2.0E0), " | ||
+ "<(ABS(-(ATAN($91), /(ATAN($91), ATAN($91)))), 1.0E-6))], " | ||
+ "groups=[{}], aggs=[[COUNT()]])"); | ||
|
||
final String sql2 = "SELECT COUNT(*) FROM " + FOODMART_TABLE + " WHERE " | ||
+ "FLOOR(ATAN2(\"store_cost\", \"store_cost\")) = 2 "; | ||
sql(sql2, FOODMART) | ||
.returnsOrdered("EXPR$0=0") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this result has been validated in some way. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes,I had test the ut with Druid Adapter dataset(https://github.com/zabetak/calcite-druid-dataset) in docker env and result is passed. @mihaibudiu There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the question is about the results, not the test, something like comparing the result here with the output of a few major DBs like postgres or Oracle, could you do that and share @xuzifu666 please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @asolimando OK,I had test the result from Oracle,the result like follow which keep the same with Druid: select ASIN(0.1) from test_db.new_table nt ORDER BY id limit 1; select ACOS(0.1) from test_db.new_table nt ORDER BY id limit 1; select ATAN(10) from test_db.new_table nt ORDER BY id limit 1; select ATAN2(10, 20) from test_db.new_table nt ORDER BY id limit 1; select DEGREES(10) from test_db.new_table nt ORDER BY id limit 1; Druid: select ASIN(0.1) select ACOS(0.1) select ATAN(10) select ATAN2(10, 20) select DEGREES(10) |
||
.explainContains("PLAN=EnumerableInterpreter\n" | ||
+ " DruidQuery(table=[[foodmart, foodmart]], " | ||
+ "intervals=[[1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z]], " | ||
+ "filter=[=(FLOOR(ATAN2($91, $91)), 2.0E0)], " | ||
+ "groups=[{}], aggs=[[COUNT()]])"); | ||
|
||
} | ||
|
||
@Test void testCastLiteralToTimestamp() { | ||
|
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 please add a link to the druid function documentation for this method, at least to let users know which version it is, thank you
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.
Done, Thanks~ @caicancai