[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type

2019-06-02 Thread Muhammad Gelbana (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16853916#comment-16853916
 ] 

Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 8:34 AM:
---

My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented, as I'll have to acquire the {{}} and act accordingly. Is 
it possible to easily return the column type name as TEXT if I follow that 
approach ?

I still have to provide casting rules to support casting types to that 
identifier.


was (Author: mgelbana):
My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented, as I'll have to acquire the {{}} and act accordingly. Is 
it possible to easily return the column type name as TEXT if I follow that 
approach ?

> Babel parser should parse the PostgreSQL TEXT type
> --
>
> Key: CALCITE-3108
> URL: https://issues.apache.org/jira/browse/CALCITE-3108
> Project: Calcite
>  Issue Type: Bug
>  Components: babel, core
>Affects Versions: 1.19.0
>Reporter: Muhammad Gelbana
>Assignee: Muhammad Gelbana
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.20.0
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The 
> following query would fail in parsing and execution.
> {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type

2019-06-02 Thread Muhammad Gelbana (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16853916#comment-16853916
 ] 

Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 10:12 AM:


My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented and I prefer that.

I tried figuring out how can I do what you suggested and I found I can it by 
exposing that type through the exposed schemas. But I can't find a way to do so 
for the root schema to get the example query to work.


was (Author: mgelbana):
My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented, as I'll have to acquire the {{}} and act accordingly. Is 
it possible to easily return the column type name as TEXT if I follow that 
approach ?

I still have to provide casting rules to support casting types to that 
identifier.

> Babel parser should parse the PostgreSQL TEXT type
> --
>
> Key: CALCITE-3108
> URL: https://issues.apache.org/jira/browse/CALCITE-3108
> Project: Calcite
>  Issue Type: Bug
>  Components: babel, core
>Affects Versions: 1.19.0
>Reporter: Muhammad Gelbana
>Assignee: Muhammad Gelbana
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.20.0
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The 
> following query would fail in parsing and execution.
> {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type

2019-06-02 Thread Muhammad Gelbana (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16853916#comment-16853916
 ] 

Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 10:53 AM:


My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented and I prefer that.

I found I can do what you suggested by exposing that type through the exposed 
schemas. But I can't find a way to do so for the root schema to get the example 
query to work.


was (Author: mgelbana):
My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented and I prefer that.

I tried figuring out how can I do what you suggested and I found I can it by 
exposing that type through the exposed schemas. But I can't find a way to do so 
for the root schema to get the example query to work.

> Babel parser should parse the PostgreSQL TEXT type
> --
>
> Key: CALCITE-3108
> URL: https://issues.apache.org/jira/browse/CALCITE-3108
> Project: Calcite
>  Issue Type: Bug
>  Components: babel, core
>Affects Versions: 1.19.0
>Reporter: Muhammad Gelbana
>Assignee: Muhammad Gelbana
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.20.0
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The 
> following query would fail in parsing and execution.
> {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type

2019-06-02 Thread Muhammad Gelbana (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16853916#comment-16853916
 ] 

Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 12:31 PM:


My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented and I prefer that.

I managed to support the TEXT type by adding the type to the root schema:
{code:java}
Connection connection = DriverManager.getConnection("jdbc:calcite:", info);

connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT",
 new RelProtoDataType() {

@Override
public RelDataType apply(RelDataTypeFactory factory) {
return 
factory.createTypeWithNullability(factory.createJavaType(String.class), false);
// return 
factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), 
false);
// return factory.createJavaType(String.class); // Failes: 
Cannot be nullable
}
});
{code}
And it worked but the returned column type name is {{VARCHAR}}, not {{TEXT}} as 
what would be returned form a real PostgreSQL. How could I direct Calcite to 
use the type name I provided to the .add method instead of the concluded one 
(ie. {{VARCHAR}}) ?


was (Author: mgelbana):
My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented and I prefer that.

I found I can do what you suggested by exposing that type through the exposed 
schemas. But I can't find a way to do so for the root schema to get the example 
query to work.

> Babel parser should parse the PostgreSQL TEXT type
> --
>
> Key: CALCITE-3108
> URL: https://issues.apache.org/jira/browse/CALCITE-3108
> Project: Calcite
>  Issue Type: Bug
>  Components: babel, core
>Affects Versions: 1.19.0
>Reporter: Muhammad Gelbana
>Assignee: Muhammad Gelbana
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.20.0
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The 
> following query would fail in parsing and execution.
> {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type

2019-06-02 Thread Muhammad Gelbana (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16853916#comment-16853916
 ] 

Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 12:32 PM:


My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented and I prefer that.

I managed to support the TEXT type by adding the type to the root schema:
{code:java}
Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT",
 new RelProtoDataType() {

@Override
public RelDataType apply(RelDataTypeFactory factory) {
return 
factory.createTypeWithNullability(factory.createJavaType(String.class), false);
// return 
factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), 
false);
// return factory.createJavaType(String.class); // Failes: 
Cannot be nullable
}
});
{code}
And it worked but the returned column type name is {{VARCHAR}}, not {{TEXT}} as 
what would be returned form a real PostgreSQL. How could I direct Calcite to 
use the type name I provided to the .add method instead of the concluded one 
(ie. {{VARCHAR}}) ?


was (Author: mgelbana):
My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented and I prefer that.

I managed to support the TEXT type by adding the type to the root schema:
{code:java}
Connection connection = DriverManager.getConnection("jdbc:calcite:", info);

connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT",
 new RelProtoDataType() {

@Override
public RelDataType apply(RelDataTypeFactory factory) {
return 
factory.createTypeWithNullability(factory.createJavaType(String.class), false);
// return 
factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), 
false);
// return factory.createJavaType(String.class); // Failes: 
Cannot be nullable
}
});
{code}
And it worked but the returned column type name is {{VARCHAR}}, not {{TEXT}} as 
what would be returned form a real PostgreSQL. How could I direct Calcite to 
use the type name I provided to the .add method instead of the concluded one 
(ie. {{VARCHAR}}) ?

> Babel parser should parse the PostgreSQL TEXT type
> --
>
> Key: CALCITE-3108
> URL: https://issues.apache.org/jira/browse/CALCITE-3108
> Project: Calcite
>  Issue Type: Bug
>  Components: babel, core
>Affects Versions: 1.19.0
>Reporter: Muhammad Gelbana
>Assignee: Muhammad Gelbana
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.20.0
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The 
> following query would fail in parsing and execution.
> {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (CALCITE-3108) Babel parser should parse the PostgreSQL TEXT type

2019-06-02 Thread Muhammad Gelbana (JIRA)


[ 
https://issues.apache.org/jira/browse/CALCITE-3108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16853916#comment-16853916
 ] 

Muhammad Gelbana edited comment on CALCITE-3108 at 6/2/19 12:33 PM:


My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented and I prefer that.

I managed to support the TEXT type by adding the type to the root schema:
{code:java}
Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT",
 new RelProtoDataType() {

@Override
public RelDataType apply(RelDataTypeFactory factory) {
return 
factory.createTypeWithNullability(factory.createJavaType(String.class), false);
// return 
factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), 
false);
// return factory.createJavaType(String.class); // Failes: 
Cannot be nullable
}
});
{code}
And it worked but the returned column type name is {{VARCHAR}}, not {{TEXT}} as 
what would be returned form a real PostgreSQL. How could I direct Calcite to 
use the type name I provided to the {{.add}} method (ie. {{TEXT}}) instead of 
the concluded one (ie. {{VARCHAR}}) ?


was (Author: mgelbana):
My branches got mixed up and I added this feature to an unmurged PR that 
supports the {{::}} operator. Please refer to the description for the updated 
sample query.

I added {{TEXT}} as a keyword so the returned result set column type name would 
be {{TEXT}} as returned from a PostgreSQL DB.

I don't usually like touching the parser so you're suggestion sounds more Java 
oriented and I prefer that.

I managed to support the TEXT type by adding the type to the root schema:
{code:java}
Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
connection.unwrap(CalciteConnection.class).getRootSchema().unwrap(CalciteSchema.class).add("TEXT",
 new RelProtoDataType() {

@Override
public RelDataType apply(RelDataTypeFactory factory) {
return 
factory.createTypeWithNullability(factory.createJavaType(String.class), false);
// return 
factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR), 
false);
// return factory.createJavaType(String.class); // Failes: 
Cannot be nullable
}
});
{code}
And it worked but the returned column type name is {{VARCHAR}}, not {{TEXT}} as 
what would be returned form a real PostgreSQL. How could I direct Calcite to 
use the type name I provided to the .add method instead of the concluded one 
(ie. {{VARCHAR}}) ?

> Babel parser should parse the PostgreSQL TEXT type
> --
>
> Key: CALCITE-3108
> URL: https://issues.apache.org/jira/browse/CALCITE-3108
> Project: Calcite
>  Issue Type: Bug
>  Components: babel, core
>Affects Versions: 1.19.0
>Reporter: Muhammad Gelbana
>Assignee: Muhammad Gelbana
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.20.0
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Casting to PostgreSQL TEXT (ie. VARCHAR) isn't currently supported. The 
> following query would fail in parsing and execution.
> {code:sql}SELECT CAST(EXPR$0 AS text) FROM (VALUES (1, 2, 3)){code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)