You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Arina Yelchiyeva <ar...@gmail.com> on 2016/02/24 22:23:45 UTC

hive translate function is not working from Drill

Hi all!

Does all Hive functions work in Drill?

I have faced the issue with translate function.
In Hive "select translate(name, 'A', 'B') from users" works fine.
But in Drill "select translate(name, 'A', 'B') from hive.`users`" return
the following error:

org.apache.drill.common.exceptions.UserRemoteException: PARSE ERROR:
Encountered "," at line 1, column 22. Was expecting one of: "USING" ...
"NOT" ... "IN" ... "BETWEEN" ... "LIKE" ... "SIMILAR" ... "=" ... ">" ...
"<" ... "<=" ... ">=" ... "<>" ... "+" ... "-" ... "*" ... "/" ... "||" ...
"AND" ... "OR" ... "IS" ... "MEMBER" ... "SUBMULTISET" ... "MULTISET" ...
"[" ... "." ... "(" ... while parsing SQL query: select translate(name,
'A', 'B') from hive.users ^ [Error Id: ba21956b-3285-4544-b3b2-fab68b95be1f
on localhost:31010]

Am I missing something? Or I should create jira to fix for bug fix?

Kind regards
Arina

Re: hive translate function is not working from Drill

Posted by Arina Yelchiyeva <ar...@gmail.com>.
Sorry, Julian, I guess I wasn't subscribed to Calcite mailing list, that's
why I have missed your reply.
I'll create appropriate Jira and see what I can do.

On Mon, Feb 29, 2016 at 8:48 PM Julian Hyde <jh...@apache.org> wrote:

> Arina: I did reply to your message on dev@calcite. See
> http://mail-archives.apache.org/mod_mbox/calcite-dev/201602.mbox/%3CDB1F2B6D-C23A-45E7-B400-C7458DCD9CF1%40apache.org%3E
> <
> http://mail-archives.apache.org/mod_mbox/calcite-dev/201602.mbox/%3CDB1F2B6D-C23A-45E7-B400-C7458DCD9CF1@apache.org%3E
> >.
>
> It would be great if this feature could be contributed to Calcite, not
> just Drill.
>
> Julian
>
> > On Feb 29, 2016, at 2:26 AM, Arina Yelchiyeva <
> arina.yelchiyeva@gmail.com> wrote:
> >
> > Though translate(expression USING identifier) is an SQL standard,
> translate
> > (expession, from_string, to_string) is widely used among other
> databases. I
> > guess it would be nice if we could allow alternative TRANSLATE syntax in
> > Drill.
> >
> > Asked Calcite community last week if there is a way to complement Calcite
> > parse instructions for TRANSLATE function without Calcite code change.
> But
> > no reply so far.
> >
> > Is it ok if I create Jira to keep track on this issue so at least it
> won't
> > be lost?
> >
> > On Wed, Feb 24, 2016 at 11:52 PM Jinfeng Ni <ji...@gmail.com>
> wrote:
> >
> >> Checked standard SQL reference,  ISO/IEC 9075-2:2011(E), section 6.30
> >>
> >> <character transliteration> ::=
> >>  TRANSLATE <left paren> <character value expression>
> >> USING <transliteration name> <right paren>
> >>
> >> Looks like Calcite follows the standard SQL reference.
> >>
> >>
> >> On Wed, Feb 24, 2016 at 1:46 PM, Jinfeng Ni <ji...@gmail.com>
> wrote:
> >>> Looks like Calcite, the SQL parser that Drill uses, treats translate
> >>> as a build-in function : translate( expression USING identifier).
> >>> That's why you saw the Parser error.
> >>>
> >>>
> >>> [1]
> >>
> https://github.com/apache/calcite/blob/master/core/src/main/codegen/templates/Parser.jj#L3987-L4005
> >>>
> >>> On Wed, Feb 24, 2016 at 1:23 PM, Arina Yelchiyeva
> >>> <ar...@gmail.com> wrote:
> >>>> Hi all!
> >>>>
> >>>> Does all Hive functions work in Drill?
> >>>>
> >>>> I have faced the issue with translate function.
> >>>> In Hive "select translate(name, 'A', 'B') from users" works fine.
> >>>> But in Drill "select translate(name, 'A', 'B') from hive.`users`"
> return
> >>>> the following error:
> >>>>
> >>>> org.apache.drill.common.exceptions.UserRemoteException: PARSE ERROR:
> >>>> Encountered "," at line 1, column 22. Was expecting one of: "USING"
> ...
> >>>> "NOT" ... "IN" ... "BETWEEN" ... "LIKE" ... "SIMILAR" ... "=" ... ">"
> >> ...
> >>>> "<" ... "<=" ... ">=" ... "<>" ... "+" ... "-" ... "*" ... "/" ...
> "||"
> >> ...
> >>>> "AND" ... "OR" ... "IS" ... "MEMBER" ... "SUBMULTISET" ... "MULTISET"
> >> ...
> >>>> "[" ... "." ... "(" ... while parsing SQL query: select
> translate(name,
> >>>> 'A', 'B') from hive.users ^ [Error Id:
> >> ba21956b-3285-4544-b3b2-fab68b95be1f
> >>>> on localhost:31010]
> >>>>
> >>>> Am I missing something? Or I should create jira to fix for bug fix?
> >>>>
> >>>> Kind regards
> >>>> Arina
> >>
>
>

Re: hive translate function is not working from Drill

Posted by Julian Hyde <jh...@apache.org>.
Arina: I did reply to your message on dev@calcite. See http://mail-archives.apache.org/mod_mbox/calcite-dev/201602.mbox/%3CDB1F2B6D-C23A-45E7-B400-C7458DCD9CF1%40apache.org%3E <http://mail-archives.apache.org/mod_mbox/calcite-dev/201602.mbox/%3CDB1F2B6D-C23A-45E7-B400-C7458DCD9CF1@apache.org%3E>.

It would be great if this feature could be contributed to Calcite, not just Drill.

Julian

> On Feb 29, 2016, at 2:26 AM, Arina Yelchiyeva <ar...@gmail.com> wrote:
> 
> Though translate(expression USING identifier) is an SQL standard, translate
> (expession, from_string, to_string) is widely used among other databases. I
> guess it would be nice if we could allow alternative TRANSLATE syntax in
> Drill.
> 
> Asked Calcite community last week if there is a way to complement Calcite
> parse instructions for TRANSLATE function without Calcite code change. But
> no reply so far.
> 
> Is it ok if I create Jira to keep track on this issue so at least it won't
> be lost?
> 
> On Wed, Feb 24, 2016 at 11:52 PM Jinfeng Ni <ji...@gmail.com> wrote:
> 
>> Checked standard SQL reference,  ISO/IEC 9075-2:2011(E), section 6.30
>> 
>> <character transliteration> ::=
>>  TRANSLATE <left paren> <character value expression>
>> USING <transliteration name> <right paren>
>> 
>> Looks like Calcite follows the standard SQL reference.
>> 
>> 
>> On Wed, Feb 24, 2016 at 1:46 PM, Jinfeng Ni <ji...@gmail.com> wrote:
>>> Looks like Calcite, the SQL parser that Drill uses, treats translate
>>> as a build-in function : translate( expression USING identifier).
>>> That's why you saw the Parser error.
>>> 
>>> 
>>> [1]
>> https://github.com/apache/calcite/blob/master/core/src/main/codegen/templates/Parser.jj#L3987-L4005
>>> 
>>> On Wed, Feb 24, 2016 at 1:23 PM, Arina Yelchiyeva
>>> <ar...@gmail.com> wrote:
>>>> Hi all!
>>>> 
>>>> Does all Hive functions work in Drill?
>>>> 
>>>> I have faced the issue with translate function.
>>>> In Hive "select translate(name, 'A', 'B') from users" works fine.
>>>> But in Drill "select translate(name, 'A', 'B') from hive.`users`" return
>>>> the following error:
>>>> 
>>>> org.apache.drill.common.exceptions.UserRemoteException: PARSE ERROR:
>>>> Encountered "," at line 1, column 22. Was expecting one of: "USING" ...
>>>> "NOT" ... "IN" ... "BETWEEN" ... "LIKE" ... "SIMILAR" ... "=" ... ">"
>> ...
>>>> "<" ... "<=" ... ">=" ... "<>" ... "+" ... "-" ... "*" ... "/" ... "||"
>> ...
>>>> "AND" ... "OR" ... "IS" ... "MEMBER" ... "SUBMULTISET" ... "MULTISET"
>> ...
>>>> "[" ... "." ... "(" ... while parsing SQL query: select translate(name,
>>>> 'A', 'B') from hive.users ^ [Error Id:
>> ba21956b-3285-4544-b3b2-fab68b95be1f
>>>> on localhost:31010]
>>>> 
>>>> Am I missing something? Or I should create jira to fix for bug fix?
>>>> 
>>>> Kind regards
>>>> Arina
>> 


Re: hive translate function is not working from Drill

Posted by Arina Yelchiyeva <ar...@gmail.com>.
Though translate(expression USING identifier) is an SQL standard, translate
(expession, from_string, to_string) is widely used among other databases. I
guess it would be nice if we could allow alternative TRANSLATE syntax in
Drill.

Asked Calcite community last week if there is a way to complement Calcite
parse instructions for TRANSLATE function without Calcite code change. But
no reply so far.

Is it ok if I create Jira to keep track on this issue so at least it won't
be lost?

On Wed, Feb 24, 2016 at 11:52 PM Jinfeng Ni <ji...@gmail.com> wrote:

> Checked standard SQL reference,  ISO/IEC 9075-2:2011(E), section 6.30
>
> <character transliteration> ::=
>   TRANSLATE <left paren> <character value expression>
> USING <transliteration name> <right paren>
>
> Looks like Calcite follows the standard SQL reference.
>
>
> On Wed, Feb 24, 2016 at 1:46 PM, Jinfeng Ni <ji...@gmail.com> wrote:
> > Looks like Calcite, the SQL parser that Drill uses, treats translate
> > as a build-in function : translate( expression USING identifier).
> > That's why you saw the Parser error.
> >
> >
> > [1]
> https://github.com/apache/calcite/blob/master/core/src/main/codegen/templates/Parser.jj#L3987-L4005
> >
> > On Wed, Feb 24, 2016 at 1:23 PM, Arina Yelchiyeva
> > <ar...@gmail.com> wrote:
> >> Hi all!
> >>
> >> Does all Hive functions work in Drill?
> >>
> >> I have faced the issue with translate function.
> >> In Hive "select translate(name, 'A', 'B') from users" works fine.
> >> But in Drill "select translate(name, 'A', 'B') from hive.`users`" return
> >> the following error:
> >>
> >> org.apache.drill.common.exceptions.UserRemoteException: PARSE ERROR:
> >> Encountered "," at line 1, column 22. Was expecting one of: "USING" ...
> >> "NOT" ... "IN" ... "BETWEEN" ... "LIKE" ... "SIMILAR" ... "=" ... ">"
> ...
> >> "<" ... "<=" ... ">=" ... "<>" ... "+" ... "-" ... "*" ... "/" ... "||"
> ...
> >> "AND" ... "OR" ... "IS" ... "MEMBER" ... "SUBMULTISET" ... "MULTISET"
> ...
> >> "[" ... "." ... "(" ... while parsing SQL query: select translate(name,
> >> 'A', 'B') from hive.users ^ [Error Id:
> ba21956b-3285-4544-b3b2-fab68b95be1f
> >> on localhost:31010]
> >>
> >> Am I missing something? Or I should create jira to fix for bug fix?
> >>
> >> Kind regards
> >> Arina
>

Re: hive translate function is not working from Drill

Posted by Jinfeng Ni <ji...@gmail.com>.
Checked standard SQL reference,  ISO/IEC 9075-2:2011(E), section 6.30

<character transliteration> ::=
  TRANSLATE <left paren> <character value expression>
USING <transliteration name> <right paren>

Looks like Calcite follows the standard SQL reference.


On Wed, Feb 24, 2016 at 1:46 PM, Jinfeng Ni <ji...@gmail.com> wrote:
> Looks like Calcite, the SQL parser that Drill uses, treats translate
> as a build-in function : translate( expression USING identifier).
> That's why you saw the Parser error.
>
>
> [1] https://github.com/apache/calcite/blob/master/core/src/main/codegen/templates/Parser.jj#L3987-L4005
>
> On Wed, Feb 24, 2016 at 1:23 PM, Arina Yelchiyeva
> <ar...@gmail.com> wrote:
>> Hi all!
>>
>> Does all Hive functions work in Drill?
>>
>> I have faced the issue with translate function.
>> In Hive "select translate(name, 'A', 'B') from users" works fine.
>> But in Drill "select translate(name, 'A', 'B') from hive.`users`" return
>> the following error:
>>
>> org.apache.drill.common.exceptions.UserRemoteException: PARSE ERROR:
>> Encountered "," at line 1, column 22. Was expecting one of: "USING" ...
>> "NOT" ... "IN" ... "BETWEEN" ... "LIKE" ... "SIMILAR" ... "=" ... ">" ...
>> "<" ... "<=" ... ">=" ... "<>" ... "+" ... "-" ... "*" ... "/" ... "||" ...
>> "AND" ... "OR" ... "IS" ... "MEMBER" ... "SUBMULTISET" ... "MULTISET" ...
>> "[" ... "." ... "(" ... while parsing SQL query: select translate(name,
>> 'A', 'B') from hive.users ^ [Error Id: ba21956b-3285-4544-b3b2-fab68b95be1f
>> on localhost:31010]
>>
>> Am I missing something? Or I should create jira to fix for bug fix?
>>
>> Kind regards
>> Arina

Re: hive translate function is not working from Drill

Posted by Jinfeng Ni <ji...@gmail.com>.
Looks like Calcite, the SQL parser that Drill uses, treats translate
as a build-in function : translate( expression USING identifier).
That's why you saw the Parser error.


[1] https://github.com/apache/calcite/blob/master/core/src/main/codegen/templates/Parser.jj#L3987-L4005

On Wed, Feb 24, 2016 at 1:23 PM, Arina Yelchiyeva
<ar...@gmail.com> wrote:
> Hi all!
>
> Does all Hive functions work in Drill?
>
> I have faced the issue with translate function.
> In Hive "select translate(name, 'A', 'B') from users" works fine.
> But in Drill "select translate(name, 'A', 'B') from hive.`users`" return
> the following error:
>
> org.apache.drill.common.exceptions.UserRemoteException: PARSE ERROR:
> Encountered "," at line 1, column 22. Was expecting one of: "USING" ...
> "NOT" ... "IN" ... "BETWEEN" ... "LIKE" ... "SIMILAR" ... "=" ... ">" ...
> "<" ... "<=" ... ">=" ... "<>" ... "+" ... "-" ... "*" ... "/" ... "||" ...
> "AND" ... "OR" ... "IS" ... "MEMBER" ... "SUBMULTISET" ... "MULTISET" ...
> "[" ... "." ... "(" ... while parsing SQL query: select translate(name,
> 'A', 'B') from hive.users ^ [Error Id: ba21956b-3285-4544-b3b2-fab68b95be1f
> on localhost:31010]
>
> Am I missing something? Or I should create jira to fix for bug fix?
>
> Kind regards
> Arina