You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by "Vandana Yadav (JIRA)" <ji...@apache.org> on 2017/11/14 12:46:01 UTC

[jira] [Created] (CARBONDATA-1710) Incorrect result with alter query in while adding new column to the table

Vandana Yadav created CARBONDATA-1710:
-----------------------------------------

             Summary: Incorrect result with alter query in while adding new column to the table
                 Key: CARBONDATA-1710
                 URL: https://issues.apache.org/jira/browse/CARBONDATA-1710
             Project: CarbonData
          Issue Type: Bug
          Components: data-query
    Affects Versions: 1.3.0
         Environment: spark 2.1
            Reporter: Vandana Yadav
            Priority: Minor
         Attachments: 2000_UniqData.csv

Incorrect result with alter query while adding new column to the table

Steps to reproduce:
1) Create table:
CREATE TABLE uniqdata_alter (CUST_ID int,CUST_NAME String,ACTIVE_EMUI_VERSION string, DOB timestamp, DOJ timestamp, BIGINT_COLUMN1 bigint,BIGINT_COLUMN2 bigint,DECIMAL_COLUMN1 decimal(30,10), DECIMAL_COLUMN2 decimal(36,10),Double_COLUMN1 double, Double_COLUMN2 double,INTEGER_COLUMN1 int) STORED BY 'org.apache.carbondata.format' TBLPROPERTIES ("TABLE_BLOCKSIZE"= "256 MB")

2)Load data into the table:
LOAD DATA INPATH 'HDFS_URL/BabuStore/Data/uniqdata/2000_UniqData.csv' into table uniqdata_alter OPTIONS('DELIMITER'=',' , 'QUOTECHAR'='"','BAD_RECORDS_ACTION'='FORCE','FILEHEADER'='CUST_ID,CUST_NAME,ACTIVE_EMUI_VERSION,DOB,DOJ,BIGINT_COLUMN1,BIGINT_COLUMN2,DECIMAL_COLUMN1,DECIMAL_COLUMN2,Double_COLUMN1,Double_COLUMN2,INTEGER_COLUMN1')

3) Execute Query:

a) add column query with wrong precision and scale:
alter table uniqdata_alter add columns (decimal_column3 decimal(10,14))

output:
Error: org.apache.spark.sql.AnalysisException: Decimal scale (14) cannot be greater than precision (10).; (state=,code=0)

b)add column query with correct precision and scale:
alter table uniqdata_alter add columns (decimal_column3 decimal(10,4));

Expected Output:
it should successfully add a new column to the table.

Actual output:
Error: org.apache.spark.sql.AnalysisException: Decimal scale (14) cannot be greater than precision (10).; (state=,code=0)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)