phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ankit Singhal <ankitsingha...@gmail.com>
Subject Re: [jira] [Commented] (PHOENIX-4234) Unable to find failed csv records in phoenix logs
Date Tue, 31 Oct 2017 10:41:14 GMT
Hi Suprita,

I still appreciate you asking questions on user@phoenix.apache.org so that
whoever is better acquainted with the related code of the problem, can
answer it at his earliest.

We don't have any construct to alter the data type of the column as it will
involve re-writing the data again.
https://phoenix.apache.org/language/index.html#alter

One way is to add a new column and run UPSERT SELECT to copy data from old
column to new column and point your application to use the new column.

OR, As VARCHAR limit is a soft limit and doesn't affect the data structure
internally, you may try updating it in meta table by running below query(*but
use this hack with proper testing and at your own risk*)

UPSERT INTO
SYSTEM.CATALOG(TENANT_ID,TABLE_SCHEM,TABLE_NAME,COLUMN_NAME,COLUMN_FAMILY,COLUMN_SIZE)
SELECT TENANT_ID,TABLE_SCHEM,TABLE_NAME,COLUMN_NAME,COLUMN_FAMILY,*15* as
COLUMN_SIZE  from system.catalog where TABLE_NAME='G1V3IN_ADITI' and
TABLE_SCHEM is NULL and COLUMN_NAME='INVOICE' and COLUMN_FAMILY='SBNUM';

Note:- you may need to restart the region servers and the clients to
refresh the cache holding metadata.

Regards,
Ankit Singhal

On Mon, Oct 30, 2017 at 12:39 PM, suprita (JIRA) <jira@apache.org> wrote:

>
>     [ https://issues.apache.org/jira/browse/PHOENIX-4234?page=com.
> atlassian.jira.plugin.system.issuetabpanels:comment-tabpane
> l&focusedCommentId=16224439#comment-16224439 ]
>
> suprita commented on PHOENIX-4234:
> ----------------------------------
>
> Hi Ankit,
>
> Once I Got a response from you regarding phoenix.
>
> Actually I want a quick response ,so posting you my query personally if
> you could answer this along  with posting on Jira group to get immediate
> response if possible for you.
>
> My doubt is described below:
>
> 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.newExcep
> tion(PhoenixParserException.java:33)
>         at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.
> java:111)
>         at org.apache.phoenix.jdbc.PhoenixStatement$PhoenixStatementPar
> ser.parseStatement(PhoenixStatement.java:1283)
>         at org.apache.phoenix.jdbc.PhoenixStatement.parseStatement(Phoe
> nixStatement.java:1364)
>         at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStat
> ement.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(Phoen
> ixSQLParser.java:846)
>         at org.apache.phoenix.parse.PhoenixSQLParser.statement(PhoenixS
> QLParser.java:499)
>         at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.
> java:108)
>         ... 9 more
>
> Please help to solve this.
>
> It would be great help if I get some solution ASAP for this.
>
>
> Thanks
> Suprita Bothra
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message