You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/12/11 08:22:12 UTC
[GitHub] [calcite] amaliujia commented on a change in pull request #1588: [CALCITE-3577] Unparse to correct BigQuery interval syntax: "INTERVAL…
amaliujia commented on a change in pull request #1588: [CALCITE-3577] Unparse to correct BigQuery interval syntax: "INTERVAL…
URL: https://github.com/apache/calcite/pull/1588#discussion_r356454274
##########
File path: core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java
##########
@@ -2292,6 +2292,28 @@ private void checkLiteral2(String expression, String expected) {
.ok(expectedDateMinusNegate);
}
+ @Test public void testUnparseSqlIntervalQualifierBigQuery() {
+ final String sql0 = "select * from \"employee\" where \"hire_date\" - "
+ + "INTERVAL '19800' SECOND(5) > TIMESTAMP '2005-10-17 00:00:00' ";
+ final String expect0 = "SELECT *\n"
+ + "FROM foodmart.employee\n"
+ + "WHERE (hire_date - INTERVAL 19800 SECOND)"
+ + " > TIMESTAMP '2005-10-17 00:00:00'";
+ sql(sql0).withBigQuery().ok(expect0);
+
+ final String sql1 = "select * from \"employee\" where \"hire_date\" + "
+ + "INTERVAL '10' HOUR > TIMESTAMP '2005-10-17 00:00:00' ";
+ final String expect1 = "SELECT *\n"
+ + "FROM foodmart.employee\n"
+ + "WHERE (hire_date + INTERVAL 10 HOUR)"
+ + " > TIMESTAMP '2005-10-17 00:00:00'";
+ sql(sql1).withBigQuery().ok(expect1);
+
+ final String sql2 = "select * from \"employee\" where \"hire_date\" + "
+ + "INTERVAL '1 2:34:56.78' DAY TO SECOND > TIMESTAMP '2005-10-17 00:00:00' ";
+ sql(sql2).withBigQuery().throws_("Only INT64 is supported as the interval value for BigQuery.");
Review comment:
Sorry I don't understand your question.
I meant because usually range time unit like "WEEK TO DAY" usually has non-int64 value, which will be reject by INT64 check before goes to time unit check.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services