I have a got a fix ready, the issues was due to a missed implementation of
'unparse' on Sql Datetime addition. .

I have a question related to the precision of INTERVAL. The precision 2 on
"INTERVAL '99' YEAR(2)" is not accepted by MySQL and gets pushed causing an
error.  Removing the precision during unparse causes tests in
SqlParserTest#subTestIntercalYearPositive to fail. What to be done here?

Queries work fine on MySql without the precision part.

Regards,
Rahul

On Fri, Feb 16, 2018 at 11:33 PM, Julian Hyde <[email protected]> wrote:

> Sure, please log a JIRA case. And develop a fix, if you are able to.
>
> > On Feb 16, 2018, at 4:11 AM, Rahul Raj <[email protected]> wrote:
> >
> > I tested it on Drill 1.13 branch having the latest calcite changes merged
> > in. It throws an unsupported operation exception, should I raise a
> Calcite
> > ticked on this?
> >
> > org.apache.drill.common.exceptions.UserException: SYSTEM ERROR:
> > UnsupportedOperationException: class org.apache.calcite.sql.SqlSyntax$6:
> > SPECIAL
> >
> > Caused by: java.lang.UnsupportedOperationException: class
> > org.apache.calcite.sql.SqlSyntax$6: SPECIAL
> >    at org.apache.calcite.util.Util.needToImplement(Util.java:925)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlSyntax$6.unparse(SqlSyntax.java:116)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlOperator.unparse(SqlOperator.java:332)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:332)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at
> > org.apache.calcite.sql.dialect.MysqlSqlDialect.
> unparseCall(MysqlSqlDialect.java:154)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:103)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlUtil.unparseBinarySyntax(
> SqlUtil.java:323)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlSyntax$3.unparse(SqlSyntax.java:65)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlOperator.unparse(SqlOperator.java:332)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:332)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at
> > org.apache.calcite.sql.dialect.MysqlSqlDialect.
> unparseCall(MysqlSqlDialect.java:154)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:103)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlNodeList.andOrList(SqlNodeList.java:142)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at
> > org.apache.calcite.sql.SqlOperator.unparseListClause(
> SqlOperator.java:347)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at
> > org.apache.calcite.sql.SqlSelectOperator.unparse(
> SqlSelectOperator.java:197)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlSelect.unparse(SqlSelect.java:240)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlNode.toSqlString(SqlNode.java:152)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.calcite.sql.SqlNode.toSqlString(SqlNode.java:158)
> > ~[calcite-core-1.15.0-drill-r0.jar:1.15.0-drill-r0]
> >    at org.apache.drill.exec.store.jdbc.JdbcPrel.<init>(JdbcPrel.java:65)
> > ~[drill-jdbc-storage-1.13.0-SNAPSHOT.jar:1.13.0-SNAPSHOT]
> >
> > Regards,
> > Rahul
> >
> > On Tue, Dec 12, 2017 at 8:21 AM, Julian Hyde <[email protected]> wrote:
> >
> >> I’ve added a comment to the JIRA case. Its a Calcite issue and it
> >> shouldn’t be too hard to develop a fix.
> >>
> >>> On Dec 7, 2017, at 11:11 PM, Rahul Raj <[email protected]> wrote:
> >>>
> >>> Hi All,
> >>>
> >>> This is an issue related to Apache Drill and need some help to debug
> the
> >>> problem.
> >>>
> >>> Drill supports a feature to query a database directly. When querying a
> >>> database directly, Drill throws an exception while manipulating a date
> >>> field inside the 'where' clause as shown in the query below:
> >>>
> >>> select * from config_1.APP.EXECUTIONSTEP
> >>> where DATE_ADD(CAST(STARTED_AT as DATE),interval '1' second) <
> >>> CAST(CURRENT_DATE as DATE)
> >>>
> >>> I could see a calcite exception in the trace:
> >>> Caused by: java.lang.AssertionError: 1000: INTERVAL_DAY_TIME
> >>> at
> >>> org.apache.calcite.adapter.jdbc.JdbcImplementor$Context.
> >> toSql(JdbcImplementor.java:179)
> >>> ~[calcite-core-1.4.0-drill-r19.jar:1.4.0-drill-r19]
> >>>
> >>> I have raised the issue and details at
> >>> https://issues.apache.org/jira/browse/DRILL-5578.
> >>>
> >>> The issue does not happen when querying parquet files.
> >>>
> >>> Regards,
> >>> Rahul
> >>
> >>
> >
> >
> > --
> > <a href="http://www.spreadfirefox.com/?q=affiliates&id=0&t=1";><textarea
> > rows="3" cols="40"><a href="
> > http://www.spreadfirefox.com/?q=affiliates&id=0&t=1";>Get Firefox!</a>
>
>


-- 
<a href="http://www.spreadfirefox.com/?q=affiliates&id=0&t=1";><textarea
rows="3" cols="40"><a href="
http://www.spreadfirefox.com/?q=affiliates&id=0&t=1";>Get Firefox!</a>

Reply via email to