NobiGo commented on code in PR #4262:
URL: https://github.com/apache/calcite/pull/4262#discussion_r2011590065
##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -266,6 +266,23 @@ private static String toSql(RelNode root, SqlDialect
dialect,
.withInformix().ok(expectedInformix);
}
+ /** Test case for <a
href="https://issues.apache.org/jira/browse/CALCITE-6910">[CALCITE-6910]
+ * RelToSql does not handle ASOF joins</a>. */
+ @Test void testAsofJoin() {
+ final String sql = "select \"employee\".\"full_name\" from \"employee\"
asof join \"product\"\n"
+ + "match_condition \"employee\".\"department_id\" <=
\"product\".\"product_id\"\n"
+ + "on \"employee\".\"salary\" = \"product\".\"gross_weight\"";
+ final String expected = "SELECT \"t\".\"full_name\"\nFROM "
+ + "((SELECT \"employee_id\", \"full_name\", \"first_name\",
\"last_name\", \"position_id\", "
+ + "\"position_title\", \"store_id\", \"department_id\",
\"birth_date\", \"hire_date\", "
+ + "\"end_date\", \"salary\", \"supervisor_id\", \"education_level\",
\"marital_status\", "
+ + "\"gender\", \"management_role\", CAST(\"salary\" AS DOUBLE) AS
\"salary0\"\n"
+ + "FROM \"foodmart\".\"employee\") AS \"t\" ASOF JOIN
\"foodmart\".\"product\" "
+ + "MATCH_CONDITION \"t\".\"department_id\" <=
\"product\".\"product_id\" ON "
Review Comment:
According to the description of JoinRelType#ASOF, the match_condition should
be followed by parentheses. However, the current generated SQL does not include
parentheses. Does this need to be modified? Or is it indicating match_condition
optional?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]