GitHub user watermen opened a pull request:

    https://github.com/apache/spark/pull/14913

    [SPARK-17358][SQL] Cached table(parquet/orc) should be shard between 
beelines

    ## What changes were proposed in this pull request?
    Cached table(parquet/orc) couldn't be shard between beelines, because the 
`sameResult` method used by `CacheManager` always return false when compare two 
`HadoopFsRelation` in different beelines. So I override the `equals` and 
`hashCode` in `HadoopFsRelation`.(Just compare the locations)
    
    ## How was this patch tested?
    Beeline1
    ```
    1: jdbc:hive2://localhost:10000> cache table src_pqt;
    +---------+--+
    | Result  |
    +---------+--+
    +---------+--+
    No rows selected (5.143 seconds)
    1: jdbc:hive2://localhost:10000> explain select * from src_pqt;
    
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--+
    |                                                                           
                                                                                
                                                 plan                           
                                                                                
                                                                                
                 |
    
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--+
    | == Physical Plan ==
    InMemoryTableScan [key#49, value#50]
       +- InMemoryRelation [key#49, value#50], true, 10000, StorageLevel(disk, 
memory, deserialized, 1 replicas), `src_pqt`
             +- *FileScan parquet default.src_pqt[key#0,value#1] Batched: true, 
Format: ParquetFormat, InputPaths: hdfs://199.0.0.1:9000/qiyadong/src_pqt, 
PartitionFilters: [], PushedFilters: [], ReadSchema: 
struct<key:int,value:string>  |
    
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--+
    ```
    
    Beeline2
    ```
    0: jdbc:hive2://localhost:10000> explain select * from src_pqt;
    
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--+
    |                                                                           
                                                                                
                                                 plan                           
                                                                                
                                                                                
                 |
    
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--+
    | == Physical Plan ==
    InMemoryTableScan [key#68, value#69]
       +- InMemoryRelation [key#68, value#69], true, 10000, StorageLevel(disk, 
memory, deserialized, 1 replicas), `src_pqt`
             +- *FileScan parquet default.src_pqt[key#0,value#1] Batched: true, 
Format: ParquetFormat, InputPaths: hdfs://199.0.0.1:9000/qiyadong/src_pqt, 
PartitionFilters: [], PushedFilters: [], ReadSchema: 
struct<key:int,value:string>  |
    
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--+
    ```


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/watermen/spark SPARK-17358

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/14913.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #14913
    
----
commit fc933563c1b5a9acc856c03ae4eba039d1f114bb
Author: Yadong Qi <[email protected]>
Date:   2016-09-01T04:02:21Z

    Override equals and hashCode in HadoopFsRelation.

----


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