You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Chris Atkinson <ch...@ocado.com> on 2016/03/11 12:44:07 UTC

Suggested PATCH Oracle does not support CHARACTER SET for VARCHAR data type

Suggested fix for joining two varchar fields of differing length:
Error: DATA_READ ERROR: The JDBC storage plugin failed while trying setup
the SQL query.

sql SELECT *
FROM (SELECT "DESCRIPTION", CAST("DESCRIPTION" AS VARCHAR(20) CHARACTER SET
"ISO-8859-1") "$f2"
FROM "UTPDBA"."A_TABLE") "t"
INNER JOIN "UTPDBA"."B_TABLE" ON "t"."$f2" = "B_TABLE"."DESCRIPTION20"
plugin utd_utpdba
Fragment 0:0

[Error Id: 2f9a1975-fa57-4b07-8642-4dca3d03ae39 on x.x.x.x:31010]

  (java.sql.SQLSyntaxErrorException) ORA-00907: missing right parenthesis

---

 core/src/main/java/org/apache/calcite/sql/SqlDialect.java | 1 +

 1 file changed, 1 insertion(+)


diff --git a/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
b/core/src/main/java/org/apache/calcite/sql/SqlDialect.java

index 88c6d63..2e38d42 100644

--- a/core/src/main/java/org/apache/calcite/sql/SqlDialect.java

+++ b/core/src/main/java/org/apache/calcite/sql/SqlDialect.java

@@ -465,6 +465,7 @@ public boolean supportsCharSet() {

     case HSQLDB:

     case PHOENIX:

     case POSTGRESQL:

+    case ORACLE:

       return false;

     default:

       return true;

--

-- 


Notice:  This email is confidential and may contain copyright material of 
members of the Ocado Group. Opinions and views expressed in this message 
may not necessarily reflect the opinions and views of the members of the 
Ocado Group. 

 

If you are not the intended recipient, please notify us immediately and 
delete all copies of this message. Please note that it is your 
responsibility to scan this message for viruses. 

 

Fetch and Sizzle are trading names of Speciality Stores Limited, a member 
of the Ocado Group.

 

References to the “Ocado Group” are to Ocado Group plc (registered in 
England and Wales with number 7098618) and its subsidiary undertakings (as 
that expression is defined in the Companies Act 2006) from time to time.  
The registered office of Ocado Group plc is Titan Court, 3 Bishops Square, 
Hatfield Business Park, Hatfield, Herts. AL10 9NE.

Re: Suggested PATCH Oracle does not support CHARACTER SET for VARCHAR data type

Posted by Julian Hyde <jh...@apache.org>.
Many thanks, Chris. I will review.

Julian


> On Mar 14, 2016, at 4:11 AM, Chris Atkinson <ch...@ocado.com> wrote:
> 
> https://github.com/apache/calcite/pull/211/files <https://github.com/apache/calcite/pull/211/files>

Re: Suggested PATCH Oracle does not support CHARACTER SET for VARCHAR data type

Posted by Chris Atkinson <ch...@ocado.com>.
Ok... this is in Jira/github

https://github.com/apache/calcite/pull/211/files

On 14 March 2016 at 09:55, Chris Atkinson <ch...@ocado.com> wrote:

> The code generates a casts to ensure a match in varchar length during a join (in Oracle SQL this explicit cast is not required but that's a different issue):
>
> create table myschema.a_table(
>   description varchar2(10)
> );
>
> create table myschema.b_table(
>   description20 varchar2(20)
> );
>
> When the join is attempted
>
> 0: jdbc:drill:zk=local> select *
> . . . . . . . . . . . >   from utd_utpdba.UTPDBA.A_TABLE
> . . . . . . . . . . . >  inner join utd_utpdba.UTPDBA.B_TABLE
> . . . . . . . . . . . >     on A_TABLE.DESCRIPTION = B_TABLE.DESCRIPTION20;
>
> The following CAST pattern is not acceptable to Oracle (11.2)
>
> Error: DATA_READ ERROR: The JDBC storage plugin failed while trying setup
> the SQL query.
>
> sql SELECT *
> FROM (SELECT "DESCRIPTION", CAST("DESCRIPTION" AS VARCHAR(20) CHARACTER SET
> "ISO-8859-1") "$f2"
> FROM "UTPDBA"."A_TABLE") "t"
> INNER JOIN "UTPDBA"."B_TABLE" ON "t"."$f2" = "B_TABLE"."DESCRIPTION20"
> plugin utd_utpdba
> Fragment 0:0
>
> [Error Id: 2f9a1975-fa57-4b07-8642-4dca3d03ae39 on x.x.x.x:31010]
>
>   (java.sql.SQLSyntaxErrorException) ORA-00907: missing right parenthesis
>
>     oracle.jdbc.driver.T4CTTIoer.processError():450
> ....
>     java.lang.Thread.run():745 (state=,code=0)
>
>
>
> On 11 March 2016 at 18:38, Julian Hyde <jh...@apache.org> wrote:
>
>> Chris,
>>
>> Thanks for the patch. Can you please log a JIRA case for this and either
>> attach the patch file to the JIRA or create a github pull request to
>> https://github.com/apache/calcite/. (Sorry to seem pedantic but Apache
>> doesn’t consider an to be adequate consent for an IP submission, and
>> keeping IP clean is very important to us.)
>>
>> Do you believe this problem occurs whenever you try to join two character
>> fields of different length?
>>
>> Julian
>>
>>
>> > On Mar 11, 2016, at 3:44 AM, Chris Atkinson <ch...@ocado.com>
>> wrote:
>> >
>> > Suggested fix for joining two varchar fields of differing length:
>> > Error: DATA_READ ERROR: The JDBC storage plugin failed while trying
>> setup
>> > the SQL query.
>> >
>> > sql SELECT *
>> > FROM (SELECT "DESCRIPTION", CAST("DESCRIPTION" AS VARCHAR(20) CHARACTER
>> SET
>> > "ISO-8859-1") "$f2"
>> > FROM "UTPDBA"."A_TABLE") "t"
>> > INNER JOIN "UTPDBA"."B_TABLE" ON "t"."$f2" = "B_TABLE"."DESCRIPTION20"
>> > plugin utd_utpdba
>> > Fragment 0:0
>> >
>> > [Error Id: 2f9a1975-fa57-4b07-8642-4dca3d03ae39 on x.x.x.x:31010]
>> >
>> >  (java.sql.SQLSyntaxErrorException) ORA-00907: missing right parenthesis
>> >
>> > ---
>> >
>> > core/src/main/java/org/apache/calcite/sql/SqlDialect.java | 1 +
>> >
>> > 1 file changed, 1 insertion(+)
>> >
>> >
>> > diff --git a/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
>> > b/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
>> >
>> > index 88c6d63..2e38d42 100644
>> >
>> > --- a/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
>> >
>> > +++ b/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
>> >
>> > @@ -465,6 +465,7 @@ public boolean supportsCharSet() {
>> >
>> >     case HSQLDB:
>> >
>> >     case PHOENIX:
>> >
>> >     case POSTGRESQL:
>> >
>> > +    case ORACLE:
>> >
>> >       return false;
>> >
>> >     default:
>> >
>> >       return true;
>> >
>> > --
>> >
>> > --
>> >
>> >
>> > Notice:  This email is confidential and may contain copyright material
>> of
>> > members of the Ocado Group. Opinions and views expressed in this message
>> > may not necessarily reflect the opinions and views of the members of the
>> > Ocado Group.
>> >
>> >
>> >
>> > If you are not the intended recipient, please notify us immediately and
>> > delete all copies of this message. Please note that it is your
>> > responsibility to scan this message for viruses.
>> >
>> >
>> >
>> > Fetch and Sizzle are trading names of Speciality Stores Limited, a
>> member
>> > of the Ocado Group.
>> >
>> >
>> >
>> > References to the “Ocado Group” are to Ocado Group plc (registered in
>> > England and Wales with number 7098618) and its subsidiary undertakings
>> (as
>> > that expression is defined in the Companies Act 2006) from time to time.
>> > The registered office of Ocado Group plc is Titan Court, 3 Bishops
>> Square,
>> > Hatfield Business Park, Hatfield, Herts. AL10 9NE.
>>
>>
>

-- 


Notice:  This email is confidential and may contain copyright material of 
members of the Ocado Group. Opinions and views expressed in this message 
may not necessarily reflect the opinions and views of the members of the 
Ocado Group. 

 

If you are not the intended recipient, please notify us immediately and 
delete all copies of this message. Please note that it is your 
responsibility to scan this message for viruses. 

 

Fetch and Sizzle are trading names of Speciality Stores Limited, a member 
of the Ocado Group.

 

References to the “Ocado Group” are to Ocado Group plc (registered in 
England and Wales with number 7098618) and its subsidiary undertakings (as 
that expression is defined in the Companies Act 2006) from time to time.  
The registered office of Ocado Group plc is Titan Court, 3 Bishops Square, 
Hatfield Business Park, Hatfield, Herts. AL10 9NE.

Re: Suggested PATCH Oracle does not support CHARACTER SET for VARCHAR data type

Posted by Chris Atkinson <ch...@ocado.com>.
The code generates a casts to ensure a match in varchar length during
a join (in Oracle SQL this explicit cast is not required but that's a
different issue):

create table myschema.a_table(
  description varchar2(10)
);

create table myschema.b_table(
  description20 varchar2(20)
);

When the join is attempted

0: jdbc:drill:zk=local> select *
. . . . . . . . . . . >   from utd_utpdba.UTPDBA.A_TABLE
. . . . . . . . . . . >  inner join utd_utpdba.UTPDBA.B_TABLE
. . . . . . . . . . . >     on A_TABLE.DESCRIPTION = B_TABLE.DESCRIPTION20;

The following CAST pattern is not acceptable to Oracle (11.2)

Error: DATA_READ ERROR: The JDBC storage plugin failed while trying setup
the SQL query.

sql SELECT *
FROM (SELECT "DESCRIPTION", CAST("DESCRIPTION" AS VARCHAR(20) CHARACTER SET
"ISO-8859-1") "$f2"
FROM "UTPDBA"."A_TABLE") "t"
INNER JOIN "UTPDBA"."B_TABLE" ON "t"."$f2" = "B_TABLE"."DESCRIPTION20"
plugin utd_utpdba
Fragment 0:0

[Error Id: 2f9a1975-fa57-4b07-8642-4dca3d03ae39 on x.x.x.x:31010]

  (java.sql.SQLSyntaxErrorException) ORA-00907: missing right parenthesis

    oracle.jdbc.driver.T4CTTIoer.processError():450
....
    java.lang.Thread.run():745 (state=,code=0)



On 11 March 2016 at 18:38, Julian Hyde <jh...@apache.org> wrote:

> Chris,
>
> Thanks for the patch. Can you please log a JIRA case for this and either
> attach the patch file to the JIRA or create a github pull request to
> https://github.com/apache/calcite/. (Sorry to seem pedantic but Apache
> doesn’t consider an to be adequate consent for an IP submission, and
> keeping IP clean is very important to us.)
>
> Do you believe this problem occurs whenever you try to join two character
> fields of different length?
>
> Julian
>
>
> > On Mar 11, 2016, at 3:44 AM, Chris Atkinson <ch...@ocado.com>
> wrote:
> >
> > Suggested fix for joining two varchar fields of differing length:
> > Error: DATA_READ ERROR: The JDBC storage plugin failed while trying setup
> > the SQL query.
> >
> > sql SELECT *
> > FROM (SELECT "DESCRIPTION", CAST("DESCRIPTION" AS VARCHAR(20) CHARACTER
> SET
> > "ISO-8859-1") "$f2"
> > FROM "UTPDBA"."A_TABLE") "t"
> > INNER JOIN "UTPDBA"."B_TABLE" ON "t"."$f2" = "B_TABLE"."DESCRIPTION20"
> > plugin utd_utpdba
> > Fragment 0:0
> >
> > [Error Id: 2f9a1975-fa57-4b07-8642-4dca3d03ae39 on x.x.x.x:31010]
> >
> >  (java.sql.SQLSyntaxErrorException) ORA-00907: missing right parenthesis
> >
> > ---
> >
> > core/src/main/java/org/apache/calcite/sql/SqlDialect.java | 1 +
> >
> > 1 file changed, 1 insertion(+)
> >
> >
> > diff --git a/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
> > b/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
> >
> > index 88c6d63..2e38d42 100644
> >
> > --- a/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
> >
> > +++ b/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
> >
> > @@ -465,6 +465,7 @@ public boolean supportsCharSet() {
> >
> >     case HSQLDB:
> >
> >     case PHOENIX:
> >
> >     case POSTGRESQL:
> >
> > +    case ORACLE:
> >
> >       return false;
> >
> >     default:
> >
> >       return true;
> >
> > --
> >
> > --
> >
> >
> > Notice:  This email is confidential and may contain copyright material of
> > members of the Ocado Group. Opinions and views expressed in this message
> > may not necessarily reflect the opinions and views of the members of the
> > Ocado Group.
> >
> >
> >
> > If you are not the intended recipient, please notify us immediately and
> > delete all copies of this message. Please note that it is your
> > responsibility to scan this message for viruses.
> >
> >
> >
> > Fetch and Sizzle are trading names of Speciality Stores Limited, a member
> > of the Ocado Group.
> >
> >
> >
> > References to the “Ocado Group” are to Ocado Group plc (registered in
> > England and Wales with number 7098618) and its subsidiary undertakings
> (as
> > that expression is defined in the Companies Act 2006) from time to time.
> > The registered office of Ocado Group plc is Titan Court, 3 Bishops
> Square,
> > Hatfield Business Park, Hatfield, Herts. AL10 9NE.
>
>

-- 


Notice:  This email is confidential and may contain copyright material of 
members of the Ocado Group. Opinions and views expressed in this message 
may not necessarily reflect the opinions and views of the members of the 
Ocado Group. 

 

If you are not the intended recipient, please notify us immediately and 
delete all copies of this message. Please note that it is your 
responsibility to scan this message for viruses. 

 

Fetch and Sizzle are trading names of Speciality Stores Limited, a member 
of the Ocado Group.

 

References to the “Ocado Group” are to Ocado Group plc (registered in 
England and Wales with number 7098618) and its subsidiary undertakings (as 
that expression is defined in the Companies Act 2006) from time to time.  
The registered office of Ocado Group plc is Titan Court, 3 Bishops Square, 
Hatfield Business Park, Hatfield, Herts. AL10 9NE.

Re: Suggested PATCH Oracle does not support CHARACTER SET for VARCHAR data type

Posted by Julian Hyde <jh...@apache.org>.
Chris,

Thanks for the patch. Can you please log a JIRA case for this and either attach the patch file to the JIRA or create a github pull request to https://github.com/apache/calcite/. (Sorry to seem pedantic but Apache doesn’t consider an to be adequate consent for an IP submission, and keeping IP clean is very important to us.)

Do you believe this problem occurs whenever you try to join two character fields of different length?

Julian


> On Mar 11, 2016, at 3:44 AM, Chris Atkinson <ch...@ocado.com> wrote:
> 
> Suggested fix for joining two varchar fields of differing length:
> Error: DATA_READ ERROR: The JDBC storage plugin failed while trying setup
> the SQL query.
> 
> sql SELECT *
> FROM (SELECT "DESCRIPTION", CAST("DESCRIPTION" AS VARCHAR(20) CHARACTER SET
> "ISO-8859-1") "$f2"
> FROM "UTPDBA"."A_TABLE") "t"
> INNER JOIN "UTPDBA"."B_TABLE" ON "t"."$f2" = "B_TABLE"."DESCRIPTION20"
> plugin utd_utpdba
> Fragment 0:0
> 
> [Error Id: 2f9a1975-fa57-4b07-8642-4dca3d03ae39 on x.x.x.x:31010]
> 
>  (java.sql.SQLSyntaxErrorException) ORA-00907: missing right parenthesis
> 
> ---
> 
> core/src/main/java/org/apache/calcite/sql/SqlDialect.java | 1 +
> 
> 1 file changed, 1 insertion(+)
> 
> 
> diff --git a/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
> b/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
> 
> index 88c6d63..2e38d42 100644
> 
> --- a/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
> 
> +++ b/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
> 
> @@ -465,6 +465,7 @@ public boolean supportsCharSet() {
> 
>     case HSQLDB:
> 
>     case PHOENIX:
> 
>     case POSTGRESQL:
> 
> +    case ORACLE:
> 
>       return false;
> 
>     default:
> 
>       return true;
> 
> --
> 
> -- 
> 
> 
> Notice:  This email is confidential and may contain copyright material of 
> members of the Ocado Group. Opinions and views expressed in this message 
> may not necessarily reflect the opinions and views of the members of the 
> Ocado Group. 
> 
> 
> 
> If you are not the intended recipient, please notify us immediately and 
> delete all copies of this message. Please note that it is your 
> responsibility to scan this message for viruses. 
> 
> 
> 
> Fetch and Sizzle are trading names of Speciality Stores Limited, a member 
> of the Ocado Group.
> 
> 
> 
> References to the “Ocado Group” are to Ocado Group plc (registered in 
> England and Wales with number 7098618) and its subsidiary undertakings (as 
> that expression is defined in the Companies Act 2006) from time to time.  
> The registered office of Ocado Group plc is Titan Court, 3 Bishops Square, 
> Hatfield Business Park, Hatfield, Herts. AL10 9NE.