Uploaded image for project: 'CarbonData'
  1. CarbonData
  2. CARBONDATA-1808

(Carbon1.3.0 - Alter Table) Inconsistency in create table and alter table usage for char and varchar column

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.0
    • Fix Version/s: 1.3.0
    • Component/s: sql
    • Labels:
    • Environment:
      3 node ant cluster

      Description

      Steps:
      User creates a table with char datatype --> Create table is success.
      0: jdbc:hive2://10.18.98.34:23040> CREATE TABLE sensor_reading_blockblank_false(id char) STORED BY 'carbondata';
      ---------+

      Result

      ---------+
      ---------+
      No rows selected (0.688 seconds)
      User tries to alter the table using column name for char datatype in the same way.
      alter table sensor_reading_blockblank_false add columns(id1 char);

      Issue : Alter table fails with parsing error as shown below
      0: jdbc:hive2://10.18.98.34:23040> alter table sensor_reading_blockblank_false add columns(id1 char);
      Error: java.lang.RuntimeException:
      BaseSqlParser>>>>
      Operation not allowed: alter table add columns(line 1, pos 0)

      == SQL ==
      alter table sensor_reading_blockblank_false add columns(id1 char)
      ^^^

      CarbonSqlParser>>>> [1.65] failure: ``('' expected but `)' found

      alter table sensor_reading_blockblank_false add columns(id1 char)
      ^ (state=,code=0)

      Similar consistency issue is observed for varchar data type create table and alter table usage.

      0: jdbc:hive2://10.18.98.34:23040> CREATE TABLE sensor_reading_blockblank_false(id varchar) STORED BY 'carbondata';
      ---------+

      Result

      ---------+
      ---------+
      No rows selected (0.244 seconds)
      0: jdbc:hive2://10.18.98.34:23040> alter table sensor_reading_blockblank_false add columns(id1 varchar);
      Error: java.lang.RuntimeException:
      BaseSqlParser>>>>
      Operation not allowed: alter table add columns(line 1, pos 0)

      == SQL ==
      alter table sensor_reading_blockblank_false add columns(id1 varchar)
      ^^^

      CarbonSqlParser>>>> [1.68] failure: ``('' expected but `)' found

      alter table sensor_reading_blockblank_false add columns(id1 varchar)
      ^ (state=,code=0)

      Expected : The create table and alter table output should be consistent for char and varchar types for similar syntax usage.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                anubhavtarar anubhav tarar
                Reporter:
                chetdb Chetan Bhat
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m