Github user vvysotskyi commented on a diff in the pull request: https://github.com/apache/drill/pull/1066#discussion_r158259594 --- Diff: contrib/storage-jdbc/src/main/java/org/apache/drill/exec/store/jdbc/JdbcPrel.java --- @@ -62,7 +62,7 @@ public JdbcPrel(RelOptCluster cluster, RelTraitSet traitSet, JdbcIntermediatePre (JavaTypeFactory) getCluster().getTypeFactory()); final JdbcImplementor.Result result = jdbcImplementor.visitChild(0, input.accept(new SubsetRemover())); - sql = result.asQuery().toSqlString(dialect).getSql(); + sql = result.asSelect().toSqlString(dialect).getSql(); --- End diff -- It is also may be another `SqlCall` instance. Thanks for pointing this, replaced it by `asStatement()` method.
---