Github user arina-ielchiieva commented on the issue:

    https://github.com/apache/drill/pull/794
  
    
    Thanks for bringing up this point. I have done some investigation and found 
out that implicit casts for nested loop join are already included during 
materialization.
    Join condition is transformed into FunctionCall [1] which is later on 
materialized using ExpressionTreeMaterializer [2]. 
    `ExpressionTreeMaterializer.visitFunctionCall` includes section which 
implicit casts [3].
    Actually these casts are more enhanced that during hash and merge joins.
    For example, during hash and merge joins only casts between numeric types, 
date and timestamp, varchar and varbinary are supported, i.e.
    join by int and varchar columns won't be performed. The following error 
will be returned: `Join only supports implicit casts between 1. Numeric data
     2. Varchar, Varbinary data 3. Date, Timestamp data Left type: INT, Right 
type: VARCHAR. Add explicit casts to avoid this error`. 
    In our case nested loop join will be able to perform join by int and 
varchar columns without adding explicit casts.
    
    [1] 
https://github.com/arina-ielchiieva/drill/blob/71628e70a525d9bd27b4f5f56259dce84c75154d/exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/NestedLoopJoinPrel.java#L95
    [2] 
https://github.com/arina-ielchiieva/drill/blob/71628e70a525d9bd27b4f5f56259dce84c75154d/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/NestedLoopJoinBatch.java#L265
    [3] 
https://github.com/apache/drill/blob/9411b26ece34ed8b2f498deea5e41f1901eb1013/exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java#L362


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to