Robert Roland created PHOENIX-1461:
--------------------------------------
Summary: Unable to retrieve SelectColumnMetadataList using
PhoenixPigConfiguration for ARRAY types
Key: PHOENIX-1461
URL: https://issues.apache.org/jira/browse/PHOENIX-1461
Project: Phoenix
Issue Type: Bug
Affects Versions: 4.3
Environment: HDP 2.2 Preview
Phoenix 4.3.0-SNAPSHOT from git
Reporter: Robert Roland
Using 4.3.0-SNAPSHOT, as of git commit
4a675d84d919cde6bdd81be4ffec643eddf7f317, for the following table declaration:
{noformat}
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']);
{noformat}
I am unable to call getSelectColumnMetadataList successfully in the following
code:
{noformat}
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)
}
{noformat}
You get the following error:
{noformat}
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)
{noformat}
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?)
{noformat}
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 |
+------------+-------------+------------+
{noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)