[
https://issues.apache.org/jira/browse/PHOENIX-2584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15106883#comment-15106883
]
maghamravikiran commented on PHOENIX-2584:
------------------------------------------
Thanks [~prkommireddi] for the comments.
[~jamestaylor]
I didn't push the patch yesterday as I noticed a bug in the code. I am
working on fixing it. The test which fail are
{code}
@Test
public void testTimeForSQLQuery() throws Exception {
//create the table
String ddl = "CREATE TABLE TIME_T (MYKEY VARCHAR,DATE_STP TIME
CONSTRAINT PK PRIMARY KEY (MYKEY)) ";
conn.createStatement().execute(ddl);
final String dml = "UPSERT INTO TIME_T VALUES('foo',TO_TIME('2008-05-16
00:30:00'))";
conn.createStatement().execute(dml);
conn.commit();
//sql query
final String sqlQuery = " SELECT mykey, minute(DATE_STP) FROM TIME_T ";
pigServer.registerQuery(String.format(
"A = load 'hbase://query/%s' using
org.apache.phoenix.pig.PhoenixHBaseLoader('%s');", sqlQuery,
zkQuorum));
final Iterator<Tuple> iterator = pigServer.openIterator("A");
while (iterator.hasNext()) {
Tuple tuple = iterator.next();
assertEquals("foo", tuple.get(0));
assertEquals(30, tuple.get(1));
}
}
{code}
Here , we use a Phoenix Function minute() in the SQL Query. The code in
PhoenixHbaseLoader makes a call(added in this patch) to fetch the ColumnInfo of
each column in the SELECT expression and is failing to determine the data type
for column *minute(DATE_STP)* . I added this call to determine the exact data
type of a Phoenix Array.
{code}
PhoenixHBaseLoader.java
private void initializePhoenixPigConfiguration(final String location, final
Configuration configuration) throws IOException {
...
...
...
// newly added call to get a List<ColumnInfo>.
this.columnInfoList =
PhoenixConfigurationUtil.getSelectColumnMetadataList(this.config);
{code}
> Support Array datatype in phoenix-pig module
> --------------------------------------------
>
> Key: PHOENIX-2584
> URL: https://issues.apache.org/jira/browse/PHOENIX-2584
> Project: Phoenix
> Issue Type: Bug
> Reporter: maghamravikiran
> Assignee: maghamravikiran
> Fix For: 4.7.0
>
> Attachments: PHOENIX-2584-1.patch, PHOENIX-2584.patch
>
>
> The plan is to map an array data type column to a Tuple in Pig.
>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)