phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samarth Jain <samarth.j...@gmail.com>
Subject Re: Unexpected dynamic column issues
Date Fri, 07 Apr 2017 22:29:14 GMT
Actually, this is expected behavior with the new column mapping/encoding
feature. With column mapping enabled, Phoenix now uses a different
qualifier than the one derived directly from the column name.

For a column mapped table, when you use a dynamic column here
upsert into TMP_SNACKS(k, c1, "page_title" varchar) values(2,'a','c'), it
cause phoenix to use "page_title" directly as the column qualifier.

However, when you create a view like this:
create view MY_VIEW("page_title" varchar) as select * from TMP_SNACKS

then Phoenix doesn't know that the page_title column was used as a dynamic
column elsewhere. Hence, it goes ahead and uses a mapped column qualifier
for the page_title column on the view.

As a consequence, when you do a SELECT * FROM MY_VIEW, you will only see
the column values for page_title that were directly upserted using the
view. In your test case - upsert into MY_VIEW(k, c1, "page_title")
values(3,'b','c');

And when you do SELECT * FROM TMP_SNACKS, you will only see the column
values for the dynamic column page_title where directly upserted using the
base table. In your test case - upsert into TMP_SNACKS(k, c1, "page_title"
varchar) values(2,'a','c');


If you would like the original behavior, then you would need to turn off
column encoding for your table like I mentioned in the previous email. For
more details on this feature - go to
http://phoenix.apache.org/columnencoding.html









On Thu, Apr 6, 2017 at 6:36 PM, Samarth Jain <samarth@apache.org> wrote:

> Thanks for reporting the issue, Dave. This has to do with the new column
> mapping feature that we rolled out in 4.10. To disable it for your table,
> please create your table like this:
>
> create table TMP_SNACKS(k bigint primary key, c1 varchar)
> COLUMN_ENCODED_BYTES=0;
>
> I will file a JIRA and get a fix out in the next patch release.
>
> On Wed, Apr 5, 2017 at 11:06 AM, Dave <dave-phoenix@dubkat.com> wrote:
>
>> Hello,
>>
>> I'm testing Phoenix 4.10 on HBase 1.2.5 and I'm confused about some
>> behavior of dynamic columns.
>>
>> I am seeing different behavior with views than this post <
>> https://lists.apache.org/thread.html/a3f16f3fd0c125775b48e7
>> f8bab3af161fe3d6c2a0b1a9635780b49e@1456433748@%3Cuser.phoeni
>> x.apache.org%3E> which use Phoenix 4.7. I expected to be able to see the
>> value for "page_title" in the view, but it is blank unless I UPSERT
>> directly into the view:
>>
>> 0: jdbc:phoenix:localhost> create table TMP_SNACKS(k bigint primary key,
>> c1 varchar);
>> No rows affected (1.304 seconds)
>>
>> 0: jdbc:phoenix:localhost> upsert into TMP_SNACKS(k, c1, "page_title"
>> varchar) values(1,'a','b');
>> 1 row affected (0.048 seconds)
>>
>> 0: jdbc:phoenix:localhost> select * from TMP_SNACKS;
>> +----+-----+
>> | K  | C1  |
>> +----+-----+
>> | 1  | a   |
>> +----+-----+
>> 1 row selected (0.039 seconds)
>>
>> 0: jdbc:phoenix:localhost> select * from TMP_SNACKS("page_title" varchar);
>> +----+-----+-------------+
>> | K  | C1  | page_title  |
>> +----+-----+-------------+
>> | 1  | a   | b           |
>> +----+-----+-------------+
>> 1 row selected (0.061 seconds)
>>
>> 0: jdbc:phoenix:localhost> create view MY_VIEW("page_title" varchar) as
>> select * from TMP_SNACKS;
>> No rows affected (0.11 seconds)
>>
>> 0: jdbc:phoenix:localhost> select * from MY_VIEW;
>> +----+-----+-------------+
>> | K  | C1  | page_title  |
>> +----+-----+-------------+
>> | 1  | a   |             |
>> +----+-----+-------------+
>> 1 row selected (0.056 seconds)
>>
>> Unexpected ---^
>>
>> 0: jdbc:phoenix:localhost> upsert into TMP_SNACKS(k, c1, "page_title"
>> varchar) values(2,'a','c');
>> 1 row affected (0.008 seconds)
>>
>> 0: jdbc:phoenix:localhost> select * from MY_VIEW;
>> +----+-----+-------------+
>> | K  | C1  | page_title  |
>> +----+-----+-------------+
>> | 1  | a   |             |
>> | 2  | a   |             |
>> +----+-----+-------------+
>> 2 rows selected (0.048 seconds)
>>
>> Unexpected ---^
>>
>> 0: jdbc:phoenix:localhost> upsert into MY_VIEW(k, c1, "page_title")
>> values(3,'b','c');
>> 1 row affected (0.009 seconds)
>>
>> 0: jdbc:phoenix:localhost> select * from MY_VIEW;
>> +----+-----+-------------+
>> | K  | C1  | page_title  |
>> +----+-----+-------------+
>> | 1  | a   |             |
>> | 2  | a   |             |
>> | 3  | b   | c           |
>> +----+-----+-------------+
>> 3 rows selected (0.058 seconds)
>>
>> Unexpected ---^
>>
>> 0: jdbc:phoenix:localhost> select * from TMP_SNACKS("page_title" varchar);
>> +----+-----+-------------+
>> | K  | C1  | page_title  |
>> +----+-----+-------------+
>> | 1  | a   | c           |
>> | 2  | a   | c           |
>> | 3  | b   |             |
>> +----+-----+-------------+
>> 3 rows selected (0.048 seconds)
>>
>> Unexpected ---^
>>
>>
>> Is this the expected behavior for dynamic columns with views?
>>
>>
>> Thanks!
>>
>> --
>>
>> Dave
>>
>>
>

Mime
View raw message