phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ankit Singhal <ankitsingha...@gmail.com>
Subject Re: phoenix query modtime
Date Fri, 23 Jun 2017 15:02:46 GMT
Ah, you are trying to use the row_timestamp feature, not sure if there is a
way from SQL if that column is not in pk.

but if you are open to using an unexposed API, here is some snippet (please
use them at your discretion as these APIs are internal and have no
guarantee to be consistent in versions )

 PreparedStatement statement = conn.preparedStatement("SELECT * FROM " +
tableName);
 QueryPlan plan = statement.unwrap(PhoenixStatement.class).getQueryPlan();
 Scan scan = plan.getContext().getScan();
 scan.setTimeRange(minStamp, maxStamp);
 rs = statement.executeQuery();


On Fri, Jun 23, 2017 at 8:05 PM, Nan Xu <nanxu1980@gmail.com> wrote:

> sorry, maybe I did not make it clear, I have a hbase table, already
> formatted with phoenix format and has composite key, I can query all the
> columns I want, but I can not query the hbase modtime in phoenix query, any
> way to do this?
>
> Nan
>
> On Fri, Jun 23, 2017 at 1:23 AM, Ankit Singhal <ankitsinghal59@gmail.com>
> wrote:
>
>> If you have composite columns in your row key of HBase table and they are
>> not formed through Phoenix then you can't access an individual column of
>> primary key by Phoenix SQL too.
>> Try composing the whole PK and use them in a filter or may check if you
>> can use regex functions[1] or LIKE operator.
>>
>> [1] https://phoenix.apache.org/language/functions.html#regexp_substr
>>
>> On Fri, Jun 23, 2017 at 4:29 AM, Nan Xu <nanxu1980@gmail.com> wrote:
>>
>>> I have a phoenix table created on existing hbase table, and want to
>>> query something like
>>> select * from mytable where modtime>'2010-01-01',
>>>
>>> how do I query phoenix like this? seems it doesn't have a modtime column
>>> if I don't do the modtime mapping, which I can not do because it has to be
>>> part of the primary key.
>>>
>>> Thanks,
>>> Nan
>>>
>>
>>
>

Mime
View raw message