Github user chenghao-intel commented on the pull request:

    https://github.com/apache/spark/pull/8226#issuecomment-132185375
  
    I agree this is an improvement with the original code. However, I think the 
original code is probably a little over in optimization.
    
    Take the simple query for example:
    ```explain extended select * from src1 a join src2 b on a.key=b.key and 
a.value > b.value;```
    And the physical plan like:
    ···
    TungstenProject [key#11,value#12,key#13,value#14]
     Filter (value#12 > value#14)
      SortMergeJoin [key#11], [key#13]
       TungstenSort [key#11 ASC], false, 0
        TungstenExchange hashpartitioning(key#11)
         ConvertToUnsafe
          HiveTableScan [key#11,value#12], (MetastoreRelation default, src1, 
Some(a))
       TungstenSort [key#13 ASC], false, 0
        TungstenExchange hashpartitioning(key#13)
         ConvertToUnsafe
          HiveTableScan [key#13,value#14], (MetastoreRelation default, src2, 
Some(b))
    ···
    
    We will create many small objects (and memory copying) in `SortMergeJoin`, 
but probably only few records will be filtered in the `Filter`, a normal 
`JoinedRow` probably more efficient in this case.
    
    cc @JoshRosen 


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to