Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-24602

In Spark SQL, ALTER TABLE--CHANGE column1 column2 datatype is not supported in 2.3.1

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Incomplete
    • 2.3.0
    • None
    • SQL
    • OS: SUSE11

      Spark Version: 2.3

    Description

      Precondition:

      Spark cluster 2.3 is up and running

      Test Steps:

      1. Launch Spark-sql
      2. spark-sql> CREATE TABLE t1(a int,string)                                                                 0: jdbc:hive2://ha-cluster/default> alter table t1 change a a1 int;
        Error: org.apache.spark.sql.AnalysisException: ALTER TABLE CHANGE COLUMN is not supported for changing column 'a' with type 'IntegerType' to 'b' with type 'IntegerType'; (state=,code=0)
      3. Launch hive beeliine
      4. repeat step1 & 2
      5. 0: jdbc:hive2://10.18.108.126:10000/> desc del1;
        -----------------------------+
        col_name  data_type  comment 

        -----------------------------+

        a1        int                 
        dob       int                 

        -----------------------------+
        2 rows selected (1.572 seconds)
        0: jdbc:hive2://10.18.108.126:10000/> alter table del1 change a1 a bigint;
        No rows affected (0.425 seconds)
        0: jdbc:hive2://10.18.108.126:10000/> desc del1;
        -----------------------------+

        col_name  data_type  comment 

        -----------------------------+

        a         bigint              
        dob       int                 

        -----------------------------+
        2 rows selected (0.364 seconds)

       

      Actual Result: In spark sql, alter table change is not supported, whereas in hive beeline it is working fine.

      Expected Result: ALTER Table CHANGE should be supported in Spark-SQL as well

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              koolsen@gmail.com Sushanta Sen
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: