GitHub user huaxingao opened a pull request:

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

    [SPARK-15749][SQL]make the error message more meaningful

    ## What changes were proposed in this pull request?
    
    For table test1 (C1 varchar (10), C2 varchar (10)), when I insert a row 
using
    ```
    sqlContext.sql("insert into test1 values ('abc', 'def', 1)")
    ```
    I got error message
    
    ```
    Exception in thread "main" java.lang.RuntimeException: RelationC1#0,C2#1 
JDBCRelation(test1)
    requires that the query in the SELECT clause of the INSERT INTO/OVERWRITE 
statement generates the same number of columns as its schema.
    ```
    The error message is a little confusing. In my simple insert statement, it 
doesn't have a SELECT clause.
    
    I will change the error message to a more general one
    
    ```
    Exception in thread "main" java.lang.RuntimeException: RelationC1#0,C2#1 
JDBCRelation(test1)
    requires that the data to be inserted have the same number of columns as 
the target table.
    ```
    
    
    ## How was this patch tested?
    
    I tested the patch using my simple unit test, but it's a very trivial 
change and I don't think I need to check in any test. 
    


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

    $ git pull https://github.com/huaxingao/spark spark-15749

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

    https://github.com/apache/spark/pull/13492.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 #13492
    
----
commit 11768e8ec799a8b51bbf90ff9943b2b0a2808e72
Author: Huaxin Gao <huax...@us.ibm.com>
Date:   2016-06-03T06:15:32Z

    [SPARK-15749][SQL]make the error message more meaningful

----


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to