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

Unable to retrieve SelectColumnMetadataList using PhoenixPigConfiguration for ARRAY types

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.3.0
    • None
    • None
    • None
    • HDP 2.2 Preview
      Phoenix 4.3.0-SNAPSHOT from git

    Description

      Using 4.3.0-SNAPSHOT, as of git commit 4a675d84d919cde6bdd81be4ffec643eddf7f317, for the following table declaration:

      CREATE TABLE ARRAY_TEST_TABLE (ID BIGINT NOT NULL PRIMARY KEY, VCARRAY VARCHAR[]);
      
      UPSERT INTO ARRAY_TEST_TABLE (ID, VCARRAY) VALUES (1, ARRAY['String1', 'String2', 'String3']);
      

      I am unable to call getSelectColumnMetadataList successfully in the following code:

      val phoenixConf = new PhoenixPigConfiguration(new Configuration())
      
      phoenixConf.setSelectStatement("SELECT * FROM ARRAY_TEST_TABLE")
      phoenixConf.setSelectColumns("ID,VCARRAY")
      phoenixConf.setSchemaType(SchemaType.QUERY)
      phoenixConf.configure("127.0.0.1", "ARRAY_TEST_TABLE", 100)
      
      val columns = phoenixConf.getSelectColumnMetadataList
      
      for (column <- columns.asScala) {
        println(column.getPDataType)
      }
      

      You get the following error:

      java.sql.SQLException: ERROR 201 (22000): Illegal data. Unsupported sql type: 2003
      org.apache.phoenix.schema.IllegalDataException: java.sql.SQLException: ERROR 201 (22000): Illegal data. Unsupported sql type: 2003
        at org.apache.phoenix.schema.PDataType.newIllegalDataException(PDataType.java:5769)
        at org.apache.phoenix.schema.PDataType.fromTypeId(PDataType.java:7334)
        at org.apache.phoenix.util.ColumnInfo.getPDataType(ColumnInfo.java:49)
        at org.apache.phoenix.util.ColumnInfo.toString(ColumnInfo.java:66)
        at com.google.common.base.Joiner.toString(Joiner.java:539)
        at com.google.common.base.Joiner$2.appendTo(Joiner.java:304)
        at com.google.common.base.Joiner.appendTo(Joiner.java:184)
        at com.google.common.base.Joiner.join(Joiner.java:240)
        at com.google.common.base.Joiner.join(Joiner.java:230)
        at org.apache.phoenix.pig.util.ColumnInfoToStringEncoderDecoder.encode(ColumnInfoToStringEncoderDecoder.java:49)
        at org.apache.phoenix.pig.PhoenixPigConfiguration$PhoenixPigConfigurationUtil.getSelectColumnMetadataList(PhoenixPigConfiguration.java:270)
        at org.apache.phoenix.pig.PhoenixPigConfiguration.getSelectColumnMetadataList(PhoenixPigConfiguration.java:157)
      

      Taking a look inside the SYSTEM.CATALOG table, the types there don't match the error: (Also, that -5 data_type for a BIGINT seems odd?)

      0: jdbc:phoenix:localhost:2181:/hbase-unsecur> select table_name, column_name, data_type from system.catalog where table_name = 'ARRAY_TEST_TABLE';
      +------------+-------------+------------+
      | TABLE_NAME | COLUMN_NAME | DATA_TYPE  |
      +------------+-------------+------------+
      | ARRAY_TEST_TABLE | null        | null       |
      | ARRAY_TEST_TABLE | ID          | -5         |
      | ARRAY_TEST_TABLE | VCARRAY     | 3012       |
      +------------+-------------+------------+
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              robertroland Robert Roland
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: