You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Jan Van Besien (JIRA)" <ji...@apache.org> on 2016/02/08 09:57:39 UTC

[jira] [Created] (PHOENIX-2664) Upgrade from 4.1.0 to 4.6.0 fails

Jan Van Besien created PHOENIX-2664:
---------------------------------------

             Summary: Upgrade from 4.1.0 to 4.6.0 fails
                 Key: PHOENIX-2664
                 URL: https://issues.apache.org/jira/browse/PHOENIX-2664
             Project: Phoenix
          Issue Type: Bug
            Reporter: Jan Van Besien


Upgrade from 4.1.0 to 4.6.0 fails with the following exception.

{code}
org.apache.phoenix.query.ConnectionQueryServicesImpl: Add column failed due to:org.apache.phoenix.exception.PhoenixParserException: ERROR 601 (42P00): Syntax error. Encountered "," at line 1, column 49.
Error: ERROR 601 (42P00): Syntax error. Encountered "," at line 1, column 49. (state=42P00,code=601)
org.apache.phoenix.exception.PhoenixParserException: ERROR 601 (42P00): Syntax error. Encountered "," at line 1, column 49.
at org.apache.phoenix.exception.PhoenixParserException.newException(PhoenixParserException.j
ava:33)
	at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:111)
	at org.apache.phoenix.jdbc.PhoenixStatement$PhoenixStatementParser.parseStatement(PhoenixStatement.java:1285)
	at org.apache.phoenix.jdbc.PhoenixStatement.parseStatement(PhoenixStatement.java:1366)
	at org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1416)
	at org.apache.phoenix.query.ConnectionQueryServicesImpl.addColumn(ConnectionQueryServicesImpl.java:1866)
	at org.apache.phoenix.query.ConnectionQueryServicesImpl.addColumnsIfNotExists(ConnectionQueryServicesImpl.java:1892)
	at org.apache.phoenix.query.ConnectionQueryServicesImpl.access$500(ConnectionQueryServicesImpl.java:179)
	at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:1978)
	at org.apache.phoenix.query.ConnectionQueryServicesImpl$12.call(ConnectionQueryServicesImpl.java:1898)
	at org.apache.phoenix.util.PhoenixContextExecutor.call(PhoenixContextExecutor.java:78)
	at org.apache.phoenix.query.ConnectionQueryServicesImpl.init(ConnectionQueryServicesImpl.java:1898)
	at org.apache.phoenix.jdbc.PhoenixDriver.getConnectionQueryServices(PhoenixDriver.java:180)
	at org.apache.phoenix.jdbc.PhoenixEmbeddedDriver.connect(PhoenixEmbeddedDriver.java:132)
	at org.apache.phoenix.jdbc.PhoenixDriver.connect(PhoenixDriver.java:151)
	at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157)
	at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203)
	at sqlline.Commands.connect(Commands.java:1064)
	at sqlline.Commands.connect(Commands.java:996)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:36)
	at sqlline.SqlLine.dispatch(SqlLine.java:804)
	at sqlline.SqlLine.initArgs(SqlLine.java:588)
	at sqlline.SqlLine.begin(SqlLine.java:656)
	at sqlline.SqlLine.start(SqlLine.java:398)
	at sqlline.SqlLine.main(SqlLine.java:292)
Caused by: NoViableAltException(28@[])
	at org.apache.phoenix.parse.PhoenixSQLParser.column_name(PhoenixSQLParser.java:2397)
	at org.apache.phoenix.parse.PhoenixSQLParser.column_def(PhoenixSQLParser.java:3707)
	at org.apache.phoenix.parse.PhoenixSQLParser.column_defs(PhoenixSQLParser.java:3631)
	at org.apache.phoenix.parse.PhoenixSQLParser.alter_table_node(PhoenixSQLParser.java:3337)
	at org.apache.phoenix.parse.PhoenixSQLParser.oneStatement(PhoenixSQLParser.java:847)
	at org.apache.phoenix.parse.PhoenixSQLParser.statement(PhoenixSQLParser.java:500)
	at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:108)
	... 27 more
{code}

Looking at the code in ConnectionQueryServicesImpl#init, it seems there are multiple places where string concatenation on the columnsToAdd string happens without checking what the current content of that string is, resulting in a string that starts with a comma.

I should add that our 4.1.0 version actually has some custom patches, but the code seems to suggest it will fail with a vanilla 4.1.0 as well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)