[jira] [Commented] (CALCITE-1998) Hive - Version specific handling for NULLS FIRST/ NULLS LAST

2017-10-06 Thread Julian Hyde (JIRA)

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

Julian Hyde commented on CALCITE-1998:
--

An observation about the emulateNullDirection (not this particular change).

To implement "select ... from t order by x nulls first", I notice that we would 
generate "select ... from t order by isnull(x), x" when "select ... from t 
order by x" would have the same effect and be more efficient (because Hive 
sorts nulls low). (For "select ... from t order by x desc nulls first", we 
can't improve on "select ... from t order by isnull(x), x desc".)

To make that optimization, the {{SqlDialect.emulateNullDirection(SqlNode node, 
boolean nullsFirst)}} method would need to be told whether it is an ascending 
or descending sort, i.e. would need an extra boolean parameter.

> Hive - Version specific handling for NULLS FIRST/ NULLS LAST
> 
>
> Key: CALCITE-1998
> URL: https://issues.apache.org/jira/browse/CALCITE-1998
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.15.0
>Reporter: Abbas Gadhia
>Assignee: Julian Hyde
>Priority: Minor
> Fix For: 1.15.0
>
>
> This JIRA is for PR https://github.com/apache/calcite/pull/545
> We are making the HiveSqlDialect version aware for the NULLS FIRST and NULLS 
> LAST feature. In https://issues.apache.org/jira/browse/HIVE-12994 , the 
> authors clarified that the default NullCollation for Hive is 
> "NullDirection.LOW". Currently, the DEFAULT set in Calcite for Hive is 
> NullCollation.HIGH
> In this PR, we are making 2 changes.
> # Change the default NullCollation from HIGH to LOW
> # Add NullCollation emulation in the HiveSqlDialect when the version of the 
> dialect is less that 2.1.0 or when the version is blank. 
> We're also adding a new Dialect "BigQuerySqlDialect" with the "quoteString" 
> as "`" based on 
> https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CALCITE-1998) Hive - Version specific handling for NULLS FIRST/ NULLS LAST

2017-10-06 Thread Julian Hyde (JIRA)

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

Julian Hyde commented on CALCITE-1998:
--

You don't need to parse version strings. JDBC makes major and minor versions 
available (as int values).

BigSqlQueryDialect.DEFAULT creates a Hive dialect by mistake.

I don't feel strongly whether Hive dialect should look at the version in the 
constructor or in the emulateNullDirection method. But don't add any fields to 
SqlDialect, only to the Hive sub-class.

> Hive - Version specific handling for NULLS FIRST/ NULLS LAST
> 
>
> Key: CALCITE-1998
> URL: https://issues.apache.org/jira/browse/CALCITE-1998
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.15.0
>Reporter: Abbas Gadhia
>Assignee: Julian Hyde
>Priority: Minor
> Fix For: 1.15.0
>
>
> This JIRA is for PR https://github.com/apache/calcite/pull/545
> We are making the HiveSqlDialect version aware for the NULLS FIRST and NULLS 
> LAST feature. In https://issues.apache.org/jira/browse/HIVE-12994 , the 
> authors clarified that the default NullCollation for Hive is 
> "NullDirection.LOW". Currently, the DEFAULT set in Calcite for Hive is 
> NullCollation.HIGH
> In this PR, we are making 2 changes.
> # Change the default NullCollation from HIGH to LOW
> # Add NullCollation emulation in the HiveSqlDialect when the version of the 
> dialect is less that 2.1.0 or when the version is blank. 
> We're also adding a new Dialect "BigQuerySqlDialect" with the "quoteString" 
> as "`" based on 
> https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (CALCITE-2003) Avoid global synchronization around openConnection in JdbcMeta

2017-10-06 Thread Josh Elser (JIRA)
Josh Elser created CALCITE-2003:
---

 Summary: Avoid global synchronization around openConnection in 
JdbcMeta
 Key: CALCITE-2003
 URL: https://issues.apache.org/jira/browse/CALCITE-2003
 Project: Calcite
  Issue Type: Bug
  Components: avatica
Reporter: Josh Elser
Assignee: Josh Elser
 Fix For: avatica-1.11.0


Had a report from a user where opening new connections to Avatica were stuck. 
Upon investigation, there was a single thread which had grabbed the local on 
the JdbcMeta instance in {{JdbcMeta#openConnection(ConnectionHandle)}}, but was 
not returning out of the {{DriverManager.getConnection(...)}} call.

Using the {{ConcurrentMap}} API over the Guava {{Cache}} API gives us enough 
flexibility that we can handle this safely without the total synchronization.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Comment Edited] (CALCITE-1998) Hive - Version specific handling for NULLS FIRST/ NULLS LAST

2017-10-06 Thread Julian Hyde (JIRA)

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

Julian Hyde edited comment on CALCITE-1998 at 10/6/17 5:20 PM:
---

An observation about the {{SqlDialect.emulateNullDirection(SqlNode node, 
boolean nullsFirst)}} method (not this particular change).

To implement "select ... from t order by x nulls first", I notice that we would 
generate "select ... from t order by isnull\(x), x" when "select ... from t 
order by x" would have the same effect and be more efficient (because Hive 
sorts nulls low). (For "select ... from t order by x desc nulls first", we 
can't improve on "select ... from t order by isnull\(x), x desc".)

To make that optimization, {{emulateNullDirection}} would need to be told 
whether it is an ascending or descending sort, i.e. would need an extra 
parameter, {{boolean desc}}.


was (Author: julianhyde):
An observation about the emulateNullDirection (not this particular change).

To implement "select ... from t order by x nulls first", I notice that we would 
generate "select ... from t order by isnull(x), x" when "select ... from t 
order by x" would have the same effect and be more efficient (because Hive 
sorts nulls low). (For "select ... from t order by x desc nulls first", we 
can't improve on "select ... from t order by isnull(x), x desc".)

To make that optimization, the {{SqlDialect.emulateNullDirection(SqlNode node, 
boolean nullsFirst)}} method would need to be told whether it is an ascending 
or descending sort, i.e. would need an extra boolean parameter.

> Hive - Version specific handling for NULLS FIRST/ NULLS LAST
> 
>
> Key: CALCITE-1998
> URL: https://issues.apache.org/jira/browse/CALCITE-1998
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.15.0
>Reporter: Abbas Gadhia
>Assignee: Julian Hyde
>Priority: Minor
> Fix For: 1.15.0
>
>
> This JIRA is for PR https://github.com/apache/calcite/pull/545
> We are making the HiveSqlDialect version aware for the NULLS FIRST and NULLS 
> LAST feature. In https://issues.apache.org/jira/browse/HIVE-12994 , the 
> authors clarified that the default NullCollation for Hive is 
> "NullDirection.LOW". Currently, the DEFAULT set in Calcite for Hive is 
> NullCollation.HIGH
> In this PR, we are making 2 changes.
> # Change the default NullCollation from HIGH to LOW
> # Add NullCollation emulation in the HiveSqlDialect when the version of the 
> dialect is less that 2.1.0 or when the version is blank. 
> We're also adding a new Dialect "BigQuerySqlDialect" with the "quoteString" 
> as "`" based on 
> https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (CALCITE-2001) JDBC driver should return "SYSTEM TABLE" rather than "SYSTEM_TABLE"

2017-10-06 Thread Julian Hyde (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-2001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde updated CALCITE-2001:
-
Labels: breaking-api  (was: )

> JDBC driver should return "SYSTEM TABLE" rather than "SYSTEM_TABLE"
> ---
>
> Key: CALCITE-2001
> URL: https://issues.apache.org/jira/browse/CALCITE-2001
> Project: Calcite
>  Issue Type: Bug
>Reporter: Julian Hyde
>Assignee: Julian Hyde
>  Labels: breaking-api
> Fix For: 1.15.0
>
>
> JDBC driver should return "SYSTEM TABLE" rather than "SYSTEM_TABLE". Per 
> DRILL-5844, JDBC recommends that table types have spaces in them.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Resolved] (CALCITE-2001) JDBC driver should return "SYSTEM TABLE" rather than "SYSTEM_TABLE"

2017-10-06 Thread Julian Hyde (JIRA)

 [ 
https://issues.apache.org/jira/browse/CALCITE-2001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Hyde resolved CALCITE-2001.
--
   Resolution: Fixed
Fix Version/s: 1.15.0

Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/7546ef2d. This 
is a (minor) breaking change.

> JDBC driver should return "SYSTEM TABLE" rather than "SYSTEM_TABLE"
> ---
>
> Key: CALCITE-2001
> URL: https://issues.apache.org/jira/browse/CALCITE-2001
> Project: Calcite
>  Issue Type: Bug
>Reporter: Julian Hyde
>Assignee: Julian Hyde
> Fix For: 1.15.0
>
>
> JDBC driver should return "SYSTEM TABLE" rather than "SYSTEM_TABLE". Per 
> DRILL-5844, JDBC recommends that table types have spaces in them.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CALCITE-2003) Avoid global synchronization around openConnection in JdbcMeta

2017-10-06 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on CALCITE-2003:
-

Github user risdenk commented on the issue:

https://github.com/apache/calcite-avatica/pull/17
  
@joshelser Did you see https://github.com/apache/calcite/pull/542? Any 
chance it is a surefire issue?


> Avoid global synchronization around openConnection in JdbcMeta
> --
>
> Key: CALCITE-2003
> URL: https://issues.apache.org/jira/browse/CALCITE-2003
> Project: Calcite
>  Issue Type: Bug
>  Components: avatica
>Reporter: Josh Elser
>Assignee: Josh Elser
> Fix For: avatica-1.11.0
>
>
> Had a report from a user where opening new connections to Avatica were stuck. 
> Upon investigation, there was a single thread which had grabbed the local on 
> the JdbcMeta instance in {{JdbcMeta#openConnection(ConnectionHandle)}}, but 
> was not returning out of the {{DriverManager.getConnection(...)}} call.
> Using the {{ConcurrentMap}} API over the Guava {{Cache}} API gives us enough 
> flexibility that we can handle this safely without the total synchronization.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CALCITE-1998) Hive - Version specific handling for NULLS FIRST/ NULLS LAST

2017-10-06 Thread Abbas Gadhia (JIRA)

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

Abbas Gadhia commented on CALCITE-1998:
---

{noformat}
I don't think it's a good idea to put the product version in the dialect
{noformat}
I agree. I'll make the change.

{noformat}
I'm also not sure about the dependency, the version checking can be easily 
implemented within the code base
{noformat}
If you look at 
[this|https://stackoverflow.com/questions/198431/how-do-you-compare-two-version-strings-in-java]
 stackoverflow question, the different answers there show that there's a bit of 
complexity into this that I would rather not reinvent. I know that Hadoop chose 
to copy paste this exact class i.e 
{code:java}
ComparableVersion
{code}
 into their code base to avoid the "maven-artifact" dependency. We can do the 
same


> Hive - Version specific handling for NULLS FIRST/ NULLS LAST
> 
>
> Key: CALCITE-1998
> URL: https://issues.apache.org/jira/browse/CALCITE-1998
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.15.0
>Reporter: Abbas Gadhia
>Assignee: Julian Hyde
>Priority: Minor
> Fix For: 1.15.0
>
>
> This JIRA is for PR https://github.com/apache/calcite/pull/545
> We are making the HiveSqlDialect version aware for the NULLS FIRST and NULLS 
> LAST feature. In https://issues.apache.org/jira/browse/HIVE-12994 , the 
> authors clarified that the default NullCollation for Hive is 
> "NullDirection.LOW". Currently, the DEFAULT set in Calcite for Hive is 
> NullCollation.HIGH
> In this PR, we are making 2 changes.
> # Change the default NullCollation from HIGH to LOW
> # Add NullCollation emulation in the HiveSqlDialect when the version of the 
> dialect is less that 2.1.0 or when the version is blank. 
> We're also adding a new Dialect "BigQuerySqlDialect" with the "quoteString" 
> as "`" based on 
> https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (CALCITE-1998) Hive - Version specific handling for NULLS FIRST/ NULLS LAST

2017-10-06 Thread Christian Beikov (JIRA)

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

Christian Beikov commented on CALCITE-1998:
---

I don't think it's a good idea to put the product version in the dialect. Just 
let the constructor of the dialect determine capabilities based on version 
rather then recheck the capabilities based on version every time. I'm also not 
sure about the dependency, the version checking can be easily implemented 
within the code base.

> Hive - Version specific handling for NULLS FIRST/ NULLS LAST
> 
>
> Key: CALCITE-1998
> URL: https://issues.apache.org/jira/browse/CALCITE-1998
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.15.0
>Reporter: Abbas Gadhia
>Assignee: Julian Hyde
>Priority: Minor
> Fix For: 1.15.0
>
>
> This JIRA is for PR https://github.com/apache/calcite/pull/545
> We are making the HiveSqlDialect version aware for the NULLS FIRST and NULLS 
> LAST feature. In https://issues.apache.org/jira/browse/HIVE-12994 , the 
> authors clarified that the default NullCollation for Hive is 
> "NullDirection.LOW". Currently, the DEFAULT set in Calcite for Hive is 
> NullCollation.HIGH
> In this PR, we are making 2 changes.
> # Change the default NullCollation from HIGH to LOW
> # Add NullCollation emulation in the HiveSqlDialect when the version of the 
> dialect is less that 2.1.0 or when the version is blank. 
> We're also adding a new Dialect "BigQuerySqlDialect" with the "quoteString" 
> as "`" based on 
> https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)