GitHub user weiqingy opened a pull request:

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

    [SPARK-17108][SQL]: Fix BIGINT and INT comparison failure in spark sql

    ## What changes were proposed in this pull request?
    Add a function to check if two integers are compatible when invoking 
`acceptsType()` in `DataType`.
    
    ## How was this patch tested?
    Manually.  
    E.g.
    ```
        spark.sql("create table t3(a map<bigint, array<string>>)")
        spark.sql("select * from t3 where a[1] is not null")
    ```
    Before:
    ```
    cannot resolve 't.`a`[1]' due to data type mismatch: argument 2 requires 
bigint type, however, '1' is of int type.; line 1 pos 22
    org.apache.spark.sql.AnalysisException: cannot resolve 't.`a`[1]' due to 
data type mismatch: argument 2 requires bigint type, however, '1' is of int 
type.; line 1 pos 22
        at 
org.apache.spark.sql.catalyst.analysis.package$AnalysisErrorAt.failAnalysis(package.scala:42)
        at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:82)
        at 
org.apache.spark.sql.catalyst.analysis.CheckAnalysis$$anonfun$checkAnalysis$1$$anonfun$apply$2.applyOrElse(CheckAnalysis.scala:74)
    at 
org.apache.spark.sql.catalyst.trees.TreeNode$$anonfun$transformUp$1.apply(TreeNode.scala:307)
    ```
    After:
     Passed the sql query. No error above.

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

    $ git pull https://github.com/weiqingy/spark SPARK_17108

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

    https://github.com/apache/spark/pull/15448.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 #15448
    
----
commit ec3d55296abc9f355a0f0db0f40e04abb4b58d94
Author: Weiqing Yang <[email protected]>
Date:   2016-10-12T06:14:48Z

    [SPARK-17108][SQL]: Fix BIGINT and INT comparison failure in spark sql

----


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