[
https://issues.apache.org/jira/browse/PHOENIX-4791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16519920#comment-16519920
]
Tulasi P commented on PHOENIX-4791:
-----------------------------------
When processing arrays, it looks like there seems to be an issue with
{noformat}
TupleProjector#projectResults(Tuple tuple, boolean
useNewValueQualifier){noformat}
Here is the code from HashJoinRegionScanner that projects a tuple to convert it
ProjectedValueTuple:
{code:java}
if (joinInfo.forceProjection()) {
tuple = projector.projectResults(tuple, useNewValueColumnQualifier);
}
{code}
Input tuple before projection:
{code:java}
[cell: 123/0:_0/1529611481252/Put/vlen=1/seqid=22, key: 123, family: 0,
qualifier: _0, value: x]
[cell: 123/_v:\x00\x00\x00\x02/LATEST_TIMESTAMP/Put/vlen=6/seqid=0, key: 123,
family: _v, qualifier: ^@^@^@^B, value: pqrt^@^O]
{code}
Output tuple after projection:
{code:java}
[cell: 123/_v:\x00\x00\x00\x01/LATEST_TIMESTAMP/Put/vlen=2/seqid=0, key: 123,
family: _v, qualifier: ^@^@^@^A, value: ^@^@]
{code}
In the above example, "pqrt" are char(1) elements from an array that are
initially part of "value" of the rowkey but the output tuple is missing that
data. I don't seem similar behavior with non-array columns.
Looking at the values of tuples before and after projection, it seems array
elements are nullified during projection?
> Array elements are nullified with joins
> ---------------------------------------
>
> Key: PHOENIX-4791
> URL: https://issues.apache.org/jira/browse/PHOENIX-4791
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 4.11.0, 4.12.0, 4.13.0, 4.14.0
> Reporter: Tulasi P
> Priority: Major
> Fix For: 5.0.0, 4.15.0
>
>
> Returning elements of an array from a table that is part of a join causes
> array elements to be nullified.
> {noformat}
> create table array_test_1 (id integer not null primary key, arr tinyint[5]);
> upsert into array_test_1 values (1001, array[0, 0, 0, 0, 0]);
> upsert into array_test_1 values (1002, array[0, 0, 0, 0, 1]);
> upsert into array_test_1 values (1003, array[0, 0, 0, 1, 1]);
> upsert into array_test_1 values (1004, array[0, 0, 1, 1, 1]);
> upsert into array_test_1 values (1005, array[1, 1, 1, 1, 1]);
> {noformat}
>
> {noformat}
> create table test_table_1 (id integer not null primary key, val varchar);
> upsert into test_table_1 values (1001, 'abc');
> upsert into test_table_1 values (1002, 'def');
> upsert into test_table_1 values (1003, 'ghi');{noformat}
> {noformat}
> 0: jdbc:phoenix:localhost> select t1.id, t2.val, t1.arr[1], t1.arr[2],
> t1.arr[3] from array_test_1 as t1 join test_table_1 as t2 on t1.id = t2.id;
> +--------+---------+---------+------------------------+---------------+
> | T1.ID | T2.VAL | ARRAY_ELEM(T1.ARR, 1) | ARRAY_ELEM(T1.ARR, 2) |
> ARRAY_ELEM(T1.ARR, 3) |
> +--------+---------+---------+-----------------+------------------------+
> | 1001 | abc | null | null | null |
> | 1002 | def | null | null | null |
> | 1003 | ghi | null | null | null |
> +--------+---------+--------+------------------------+-----------------+
> 3 rows selected (0.056 seconds)
> {noformat}
> However, directly selecting array elements from the array returns data
> correctly.
> {noformat}
> 0: jdbc:phoenix:localhost> select [t1.id, t1.arr[1], t1.arr[2], t1.arr[3]
> from array_test_1 as t1;
> +-------+--------+-------------+-------------+
> | ID | ARRAY_ELEM(ARR, 1) | ARRAY_ELEM(ARR, 2) | ARRAY_ELEM(ARR, 3) |
> +-------+--------+-------------+-------------+
> | 1001 | 0 | 0 | 0 |
> | 1002 | 0 | 0 | 0 |
> | 1003 | 0 | 0 | 0 |
> | 1004 | 0 | 0 | 1 |
> | 1005 | 1 | 1 | 1 |
> +-------+-------+--------------+--------------+
> 5 rows selected (0.044 seconds)
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)