[ 
https://issues.apache.org/jira/browse/DRILL-3180?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14901390#comment-14901390
 ] 

Julian Hyde commented on DRILL-3180:
------------------------------------

I don't often see non-join conditions into the ON clause, but I take 
[~magnusp]'s point. If that were an outer join, we would be able to push the 
date condition down to the salary table, whereas if it were in the WHERE clause 
we could not.

Anyway, the JDBC adapter's goal is not to format the SQL to follow any "best 
practice" or to look nice for humans to read. It is to communicate with the 
target DB's query optimizer, ideally in a form that the optimizer is unlikely 
to screw up, and most importantly to preserve semantics.

Sometimes there is a danger that Calcite will "over optimize" the query, e.g.

{code}select *
FROM mp.employees.`employees` e
INNER JOIN  (
  SELECT * FROM mp.employees.`salaries` s
  WHERE s.`to_date` > CURRENT_DATE) AS s
ON e.`EMP_NO` = s.`EMP_NO`{code}

is valid and efficient but the new query block might confuse optimizers like 
MySQL's.

> Apache Drill JDBC storage plugin to query rdbms systems such as MySQL and 
> Netezza from Apache Drill
> ---------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-3180
>                 URL: https://issues.apache.org/jira/browse/DRILL-3180
>             Project: Apache Drill
>          Issue Type: New Feature
>          Components: Storage - Other
>    Affects Versions: 1.0.0
>            Reporter: Magnus Pierre
>            Assignee: Jacques Nadeau
>              Labels: Drill, JDBC, plugin
>             Fix For: 1.2.0
>
>         Attachments: patch.diff, pom.xml, storage-mpjdbc.zip
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> I have developed the base code for a JDBC storage-plugin for Apache Drill. 
> The code is primitive but consitutes a good starting point for further 
> coding. Today it provides primitive support for SELECT against RDBMS with 
> JDBC. 
> The goal is to provide complete SELECT support against RDBMS with push down 
> capabilities.
> Currently the code is using standard JDBC classes.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to