phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Terrell <sterr...@oculus360.us>
Subject Re: select all dynamic columns by primary key if columns names are unknown
Date Tue, 02 Feb 2016 23:08:16 GMT
Regarding the use of views to make dynamic fields appear as static fields,
I have been unable to get them to work with dynamic fields.  I am using
Phoenix 3.2.2.

0: jdbc:phoenix:localhost> create view TMP_DYNA as select * from
COLLECTIONS("category_hierarchy" varchar);

REDError: ERROR 602 (42P00): Syntax error. Missing "EOF" at line 1, column
50. (state=42P00,code=602)NORMAL
org.apache.phoenix.exception.PhoenixParserException: ERROR 602 (42P00):
Syntax error. Missing "EOF" at line 1, column 50.
at
org.apache.phoenix.exception.PhoenixParserException.newException(PhoenixParserException.java:33)
at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:111)
at
org.apache.phoenix.jdbc.PhoenixStatement$PhoenixStatementParser.parseStatement(PhoenixStatement.java:898)
at
org.apache.phoenix.jdbc.PhoenixStatement.parseStatement(PhoenixStatement.java:979)
at
org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1042)
at sqlline.Commands.execute(Commands.java:822)
at sqlline.Commands.sql(Commands.java:732)
at sqlline.SqlLine.dispatch(SqlLine.java:808)
at sqlline.SqlLine.begin(SqlLine.java:681)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:292)
Caused by: MissingTokenException(inserted [@-1,0:0='<missing
EOF>',<-1>,1:49] at ()
at
org.apache.phoenix.parse.PhoenixSQLParser.recoverFromMismatchedToken(PhoenixSQLParser.java:317)
at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:115)
at
org.apache.phoenix.parse.PhoenixSQLParser.statement(PhoenixSQLParser.java:465)
at org.apache.phoenix.parse.SQLParser.parseStatement(SQLParser.java:108)
... 9 more


On Tue, Feb 2, 2016 at 4:30 PM, Serega Sheypak <serega.sheypak@gmail.com>
wrote:

> It's not my usecase unfortunately...
> I have to log links between identities. Link presented as:
> id1, source1, id2, source2 means
> id1 came from source1 and id2 came from source2 and these ids are linked
> (a kind cross-site auth)
> the problem is that I set (id1, source1) as composite primary key and
> write a table
>
> id1, source1, id2, source2
> id2, source2, id1, source1
> I can pull all linked ids and "source" part of key gives me a chance to
> avoid id collisions that come from different sources.
>
> query select from ... where id = id1 involves scan that takes "forever"
> (>200ms)
> I want to eliminate scan and apply access by key.
>
> I would keeps my data is:
> id - the single predefined PK column
> all other columns are dynamic, where column name = source and value =
> source:id
> I can get all links at once using single key access.
>
> I can easilly implement in HBase, but Phoenix doesn't allow me to select
> all "columns" from column familiy
>
>
>
>
> 2016-02-02 23:11 GMT+01:00 James Taylor <jamestaylor@apache.org>:
>
>> I encourage you to use views[1] instead. You can dynamically add/remove
>> columns from a view and this way Phoenix keeps track of it for you and you
>> get all the other standard features.
>> Thanks,
>> James
>>
>> [1] https://phoenix.apache.org/views.html
>>
>> On Tue, Feb 2, 2016 at 1:42 PM, Serega Sheypak <serega.sheypak@gmail.com>
>> wrote:
>>
>>> It super overhead, you have to query twice...
>>>
>>> 2016-02-02 22:34 GMT+01:00 Steve Terrell <sterrell@oculus360.us>:
>>>
>>>> I would like to know as well.  Today when I upsert and create dynamic
>>>> columns, I have to also create a second table to keep track of the dynamic
>>>> field names and data types that were upserted so that the person writing
>>>> queries for the first table can know what's fields are available.
>>>>
>>>> Also would like to know if there is a way to do bulk upserting with
>>>> dynamic fields.
>>>>
>>>> On Tue, Feb 2, 2016 at 3:27 PM, Serega Sheypak <
>>>> serega.sheypak@gmail.com> wrote:
>>>>
>>>>> Hi, is it possible to select all dynamic columns if you don't know
>>>>> their names in advance?
>>>>> Example:
>>>>>
>>>>> I have a table with single defined column named PK, which is a primary
>>>>> key
>>>>>
>>>>> Someone runs query:
>>>>>
>>>>> UNSERT INTO MY_TBL(PK, C1, C2, C3) VALUES('x', '1', '2', '3')
>>>>>
>>>>> where C1, C2, C3 are dynamic columns
>>>>>
>>>>> then I want to select all columns using query:
>>>>> select * from MY_TBL where PK = 'x'
>>>>> But this query won't return C1, C2, C3 columns.
>>>>>
>>>>>
>>>>
>>>
>>
>

Mime
View raw message