You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "suprita bothra (JIRA)" <ji...@apache.org> on 2017/10/30 07:10:01 UTC

[jira] [Created] (PHOENIX-4330) To alter colomn length of a phoenix table withouht losing existing data in table

suprita bothra created PHOENIX-4330:
---------------------------------------

             Summary: To alter colomn length of a phoenix table withouht losing existing data in table
                 Key: PHOENIX-4330
                 URL: https://issues.apache.org/jira/browse/PHOENIX-4330
             Project: Phoenix
          Issue Type: Bug
            Reporter: suprita bothra


Hi ,

I am using apache phoenix to create table and then dump csv data into table.
But now I want to alter one colomn’s datatype length from varchar(7) to varchar(14),without losing the existing data into table.

Can it be done?
If yes how?

I tried the command to address the above mentioned issue but
ALTER TABLE G1V3IN_ADITI ALTER "INVOICE"."SBNUM" set data type varchar(15), column "INVOICE"."SBNUM" drop default;

Where sbnum is the colomn whose existing datatype length is 7 but we want to change it to 15.
G1V3IN_ADITI is table name.

But facing the below error:
Error: ERROR 601 (42P00): Syntax error. Encountered "ALTER" at line 1, column 26. (state=42P00,code=601)
org.apache.phoenix.exception.PhoenixParserException: ERROR 601 (42P00): Syntax error. Encountered "ALTER" at line 1, column 26.
        at org.apache.phoenix.exception.PhoenixParserException.newException(PhoenixParserException.java:33)
        at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:111)
        at org.apache.phoenix.jdbc.PhoenixStatement$PhoenixStatementParser.parseStatement(PhoenixStatement.java:1283)
        at org.apache.phoenix.jdbc.PhoenixStatement.parseStatement(PhoenixStatement.java:1364)
        at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1427)
        at sqlline.Commands.execute(Commands.java:822)
        at sqlline.Commands.sql(Commands.java:732)
        at sqlline.SqlLine.dispatch(SqlLine.java:808)
        at sqlline.SqlLine.begin(SqlLine.java:681)
        at sqlline.SqlLine.start(SqlLine.java:398)
        at sqlline.SqlLine.main(SqlLine.java:292)
Caused by: NoViableAltException(7@[])
        at org.apache.phoenix.parse.PhoenixSQLParser.from_table_name(PhoenixSQLParser.java:9081)
        at org.apache.phoenix.parse.PhoenixSQLParser.alter_table_node(PhoenixSQLParser.java:3229)
        at org.apache.phoenix.parse.PhoenixSQLParser.oneStatement(PhoenixSQLParser.java:846)
        at org.apache.phoenix.parse.PhoenixSQLParser.statement(PhoenixSQLParser.java:499)
        at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:108)
        ... 9 more




Thanks
Suprita Bothra




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