Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-3074

Phoenix Bulkload fails when Table name contains '-' (hyphen)

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.7.0
    • Fix Version/s: 4.7.0
    • Component/s: None
    • Labels:

      Description

      Bulk load fails from csv to Phoenix table when Phoenix table contains ‘-‘ (hyphen) in table name. [Phoenix 4.7.0]

      Below is the steps to reproduce the issue.

      Step-1: create table with '-' hyphen. Use double quote around table name.
      CREATE TABLE "PHOENIX-TEST" (ID INTEGER PRIMARY KEY, NAME VARCHAR);

      Step-2:
      sudo -u hadoop HADOOP_CLASSPATH=/usr/lib/hbase/hbase-protocol.jar:/usr/lib/hbase/conf/ hadoop jar /usr/lib/phoenix/phoenix-client.jar org.apache.phoenix.mapreduce.CsvBulkLoadTool -Dfs.permissions.umask-mode=000 -t "PHOENIX-TEST" --input "/user/test/PHOENIX-TEST.csv" -d $'\t'

      Below is the stack trace for the error. Ultimately it removes any double or single quotes around table name from the bulk load command.

      2016-07-14 10:20:47,153 WARN [main] org.apache.hadoop.metrics2.impl.MetricsSystemImpl: MapTask metrics system already initialized!
      2016-07-14 10:20:48,703 INFO [main] org.apache.phoenix.util.UpsertExecutor: Upserting SQL data with UPSERT INTO PHOENIX-TEST ("ID", "0"."NAME") VALUES (?, ?)
      2016-07-14 10:20:48,704 INFO [main] org.apache.hadoop.mapred.MapTask: Starting flush of map output
      2016-07-14 10:20:48,711 INFO [main] org.apache.hadoop.io.compress.CodecPool: Got brand-new compressor [.snappy]
      2016-07-14 10:20:48,718 WARN [main] org.apache.hadoop.mapred.YarnChild: Exception running child : java.lang.RuntimeException: org.apache.phoenix.exception.PhoenixParserException: ERROR 601 (42P00): Syntax error. Encountered "-" at line 1, column 17.
      at org.apache.phoenix.util.UpsertExecutor.createStatement(UpsertExecutor.java:83)
      at org.apache.phoenix.util.UpsertExecutor.<init>(UpsertExecutor.java:94)
      at org.apache.phoenix.util.csv.CsvUpsertExecutor.<init>(CsvUpsertExecutor.java:63)
      at org.apache.phoenix.mapreduce.CsvToKeyValueMapper.buildUpsertExecutor(CsvToKeyValueMapper.java:85)
      at org.apache.phoenix.mapreduce.FormatToBytesWritableMapper.setup(FormatToBytesWritableMapper.java:142)
      at org.apache.phoenix.mapreduce.CsvToKeyValueMapper.setup(CsvToKeyValueMapper.java:67)
      at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:143)
      at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:796)
      at org.apache.hadoop.mapred.MapTask.run(MapTask.java:342)
      at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:164)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.security.auth.Subject.doAs(Subject.java:415)
      at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
      at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
      Caused by: org.apache.phoenix.exception.PhoenixParserException: ERROR 601 (42P00): Syntax error. Encountered "-" at line 1, column 17.
      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:1185)
      at org.apache.phoenix.jdbc.PhoenixStatement.parseStatement(PhoenixStatement.java:1268)
      at org.apache.phoenix.jdbc.PhoenixPreparedStatement.<init>(PhoenixPreparedStatement.java:94)
      at org.apache.phoenix.jdbc.PhoenixConnection.prepareStatement(PhoenixConnection.java:715)
      at org.apache.phoenix.util.UpsertExecutor.createStatement(UpsertExecutor.java:81)
      ... 13 more
      Caused by: NoViableAltException(94@[])
      at org.apache.phoenix.parse.PhoenixSQLParser.upsert_node(PhoenixSQLParser.java:4723)
      at org.apache.phoenix.parse.PhoenixSQLParser.oneStatement(PhoenixSQLParser.java:775)
      at org.apache.phoenix.parse.PhoenixSQLParser.statement(PhoenixSQLParser.java:500)
      at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:108)
      ... 18 more

        Attachments

        1. phoenix_hyphen.patch
          4 kB
          Kalyan

          Activity

            People

            • Assignee:
              kalyanhadoop Kalyan
              Reporter:
              DhGuna Dharmesh
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: