[
https://issues.apache.org/jira/browse/PHOENIX-1044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14042430#comment-14042430
]
Josh Mahonin commented on PHOENIX-1044:
---------------------------------------
Hi Ravi,
Sorry for the delay. I've done a bit more work on it and I think this only
occurs if the column in the WHERE clause is not the primary key. Here's my
example below:
// DDL
CREATE TABLE TEST_TABLE(ID VARCHAR PRIMARY KEY, FOO VARCHAR, BAR VARCHAR, BAZ
VARCHAR)
UPSERT INTO TEST_TABLE(ID, FOO, BAR, BAZ) VALUES('a', 'a', 'a', 'a')
UPSERT INTO TEST_TABLE(ID, FOO, BAR, BAZ) VALUES('b', 'b', 'b', 'b')
// JDBC
SELECT FOO, BAR FROM TEST_TABLE WHERE ID='a'
> [a, a]
SELECT FOO, BAR FROM TEST_TABLE WHERE BAZ='a'
> [a, a]
// Phoenix-Pig ("selectColumns" set to 'FOO, BAR')
SELECT FOO, BAR FROM TEST_TABLE WHERE ID='a'
> [a, a]
SELECT FOO, BAR FROM TEST_TABLE WHERE BAZ='a'
> []
// Phoenix-Pig workaround ("selectColumns" set to 'FOO, BAR, BAZ')
SELECT FOO, BAR, BAZ FROM TEST_TABLE WHERE BAZ='a'
> [a, a, a]
This may or may not be relevant, but I'm not actually using Pig, I'm using
Apache Spark and using the PhoenixInputFormat to as a Hadoop input format. I'm
using PhoenixHBaseLoader as a reference, but it's possible I've made a mistake
somewhere.
Josh
> Phoenix-Pig: No results returned unless all used columns are selected
> ---------------------------------------------------------------------
>
> Key: PHOENIX-1044
> URL: https://issues.apache.org/jira/browse/PHOENIX-1044
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 5.0.0
> Reporter: Josh Mahonin
> Priority: Minor
>
> Not critical, but a bit frustrating:
> I'm creating a PhoenixPigConfiguration via the following:
> > conf.setSelectColumns("FOO,BAR")
> > conf.setSelectStatement("SELECT FOO, BAR FROM MYTABLE WHERE BAZ=123")
> In SQuirrel, that query returns with results, but the going through Pig, it
> returns nothing.
> I also get the same results if I try like so:
> > conf.setSelectColumns("FOO,BAR,BAZ")
> > conf.setSelectStatement("SELECT FOO, BAR FROM MYTABLE WHERE BAZ=123")
> The workaround is to modify the select statement to also include the 'BAZ'
> column, even though I don't need it for computation:
> > conf.setSelectStatement("SELECT FOO, BAR, BAZ FROM MYTABLE WHERE BAZ=123")
--
This message was sent by Atlassian JIRA
(v6.2#6252)