You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by Ahmed Hussien <aa...@gmail.com> on 2014/07/17 10:39:05 UTC

How can we add new keywords to Phoenix?

Hello,
Good Day...
I'm working in a project that requires adding new keywords to the 
regular SQL statements and we decided to use Phoenix over hbase.
I actually have three (3) types of keywords, and I'll Give you an 
example for them below:

1-  Select (KEYWORD) attribute from table;
2- Select (KEYWORD1) attribute from table1 where ((KEYWORD2) 
table1.attribute1= (KEYWORD3)table2.attribute2);
3- Select (KEYWORD1) attribute from table1 where ((KEYWORD2) 
table1.attribute1= value);

KEYWORD is some kind of properties for an attribute which we added in 
our project.
Say for example i want to select the last approved value for a specific 
attribute from a specific table, the keyword here is lastApproved so the 
query would be:

Select lastApproved attribute from table;

Knowing That I have filters for Hbase the do the selection process, and 
all I want to do is to integrate this to pheonix as an SQL command.

The Questions are:
1- Which types are supported in Phoenix?
2- What is the most easy way to implement these keywords?
3- Does built in functions support the three types?
4- if you have a detailed guide could you please send it to me


I know that your mission in Phoenix is to be ANSI compatible. but 
actually this is a project requirment. The user have lots of conditions 
and predicate parameters, so we are using some keywords to make it much 
more simple for the user in this specific project.
I really appriciate it, if you just guide me from where should I start 
and what are the classes I should edit with a very short discription, 
this would be greate.


Ahmed

Re: HBase cell versions

Posted by James Taylor <ja...@apache.org>.
Phoenix allows you to do "point-in-time" or "flashback" queries by
specifying a timestamp at connection time. Phoenix does not support
returning multiple versions of the same row in a single query, though
we have a JIRA in place for that if anyone is interested in
contributing toward that feature:
https://issues.apache.org/jira/browse/PHOENIX-590

See our FAQ for more info:
http://phoenix.apache.org/faq.html#Can_phoenix_work_on_tables_with_arbitrary_timestamp_as_flexible_as_HBase_API

Thanks,
James

On Sun, Jul 20, 2014 at 1:53 AM, Ahmed Hussien <aa...@gmail.com> wrote:
> Does Phoenix support Hbase cell version?
> i.e can I use the phoenix shell to view different versions of a
> Family:Column ? How?
> thanks
> Ahmed

HBase cell versions

Posted by Ahmed Hussien <aa...@gmail.com>.
Does Phoenix support Hbase cell version?
i.e can I use the phoenix shell to view different versions of a 
Family:Column ? How?
thanks
Ahmed

Re: How can we add new keywords to Phoenix?

Posted by James Taylor <ja...@apache.org>.
Answers inline. Thanks,
James

On Thu, Jul 17, 2014 at 1:39 AM, Ahmed Hussien <aa...@gmail.com> wrote:
> Hello,
> Good Day...
> I'm working in a project that requires adding new keywords to the regular
> SQL statements and we decided to use Phoenix over hbase.
> I actually have three (3) types of keywords, and I'll Give you an example
> for them below:
>
> 1-  Select (KEYWORD) attribute from table;
> 2- Select (KEYWORD1) attribute from table1 where ((KEYWORD2)
> table1.attribute1= (KEYWORD3)table2.attribute2);
> 3- Select (KEYWORD1) attribute from table1 where ((KEYWORD2)
> table1.attribute1= value);
>
> KEYWORD is some kind of properties for an attribute which we added in our
> project.
> Say for example i want to select the last approved value for a specific
> attribute from a specific table, the keyword here is lastApproved so the
> query would be:
>
> Select lastApproved attribute from table;
>
> Knowing That I have filters for Hbase the do the selection process, and all
> I want to do is to integrate this to pheonix as an SQL command.
>
> The Questions are:
> 1- Which types are supported in Phoenix?
> 2- What is the most easy way to implement these keywords?
> 3- Does built in functions support the three types?
> 4- if you have a detailed guide could you please send it to me

Our detailed guide is on our website: http://phoenix.apache.org/
In particular, take a look at our reference guide:
http://phoenix.apache.org/language/index.html,
http://phoenix.apache.org/language/functions.html,
http://phoenix.apache.org/language/datatypes.html

There's also a step-by-step guide I wrote on adding built-in functions
here: http://phoenix-hbase.blogspot.com/2013/04/how-to-add-your-own-built-in-function.html

>
>
> I know that your mission in Phoenix is to be ANSI compatible. but actually
> this is a project requirment. The user have lots of conditions and predicate
> parameters, so we are using some keywords to make it much more simple for
> the user in this specific project.
> I really appriciate it, if you just guide me from where should I start and
> what are the classes I should edit with a very short discription, this would
> be greate.

Changing the SQL grammar does not sound like a project requirement to
me, but rather a means to implement a requirement. SQL has been around
a long time and has withstood the test of time well, IMHO. The typical
way to solve the requirement to "make it much simpler for users in
this specific project to specify conditions and predicates" is to have
a layer above SQL and the Phoenix JDBC driver that generates SQL. I'd
encourage you to take that route, as as you've said, this is outside
of the mission of the Apache Phoenix project.

>
>
> Ahmed