This is an automated email from the ASF dual-hosted git repository.

jcamacho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/master by this push:
     new c978304  [CALCITE-2782] Use server time zone by default if time zone 
is not specified in the user connection string (Justin Szeluga)
c978304 is described below

commit c978304cbceb35fb09cb49b91d38d14ce18a3e17
Author: Justin Szeluga <[email protected]>
AuthorDate: Tue Jan 15 13:15:15 2019 -0500

    [CALCITE-2782] Use server time zone by default if time zone is not 
specified in the user connection string (Justin Szeluga)
    
    Close apache/calcite#1001
---
 .../java/org/apache/calcite/config/CalciteConnectionConfig.java    | 2 ++
 .../org/apache/calcite/config/CalciteConnectionConfigImpl.java     | 5 +++++
 .../java/org/apache/calcite/config/CalciteConnectionProperty.java  | 7 +++++--
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git 
a/core/src/main/java/org/apache/calcite/config/CalciteConnectionConfig.java 
b/core/src/main/java/org/apache/calcite/config/CalciteConnectionConfig.java
index b366aea..7952d7d 100644
--- a/core/src/main/java/org/apache/calcite/config/CalciteConnectionConfig.java
+++ b/core/src/main/java/org/apache/calcite/config/CalciteConnectionConfig.java
@@ -70,6 +70,8 @@ public interface CalciteConnectionConfig extends 
ConnectionConfig {
   <T> T typeSystem(Class<T> typeSystemClass, T defaultTypeSystem);
   /** @see CalciteConnectionProperty#CONFORMANCE */
   SqlConformance conformance();
+  /** @see CalciteConnectionProperty#TIME_ZONE */
+  @Override String timeZone();
 }
 
 // End CalciteConnectionConfig.java
diff --git 
a/core/src/main/java/org/apache/calcite/config/CalciteConnectionConfigImpl.java 
b/core/src/main/java/org/apache/calcite/config/CalciteConnectionConfigImpl.java
index 6c176b8..8a97d4d 100644
--- 
a/core/src/main/java/org/apache/calcite/config/CalciteConnectionConfigImpl.java
+++ 
b/core/src/main/java/org/apache/calcite/config/CalciteConnectionConfigImpl.java
@@ -183,6 +183,11 @@ public class CalciteConnectionConfigImpl extends 
ConnectionConfigImpl
     return CalciteConnectionProperty.CONFORMANCE.wrap(properties)
         .getEnum(SqlConformanceEnum.class);
   }
+
+  @Override public String timeZone() {
+    return CalciteConnectionProperty.TIME_ZONE.wrap(properties)
+            .getString();
+  }
 }
 
 // End CalciteConnectionConfigImpl.java
diff --git 
a/core/src/main/java/org/apache/calcite/config/CalciteConnectionProperty.java 
b/core/src/main/java/org/apache/calcite/config/CalciteConnectionProperty.java
index dea9200..bd17fc7 100644
--- 
a/core/src/main/java/org/apache/calcite/config/CalciteConnectionProperty.java
+++ 
b/core/src/main/java/org/apache/calcite/config/CalciteConnectionProperty.java
@@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
+import java.util.TimeZone;
 
 import static org.apache.calcite.avatica.ConnectionConfigImpl.PropEnv;
 
@@ -128,8 +129,10 @@ public enum CalciteConnectionProperty implements 
ConnectionProperty {
    * generates code that implements the Enumerable interface. */
   SPARK("spark", Type.BOOLEAN, false, false),
 
-  /** Time zone, for example 'gmt-3'. Default is the JVM's time zone. */
-  TIME_ZONE("timeZone", Type.STRING, null, false),
+  /** Returns the time zone from the connect string, for example 'gmt-3'.
+   * If the time zone is not set then the JVM time zone is returned.
+   * Never null. */
+  TIME_ZONE("timeZone", Type.STRING, TimeZone.getDefault().getID(), false),
 
   /** If the planner should try de-correlating as much as it is possible.
    * If true (the default), Calcite de-correlates the plan. */

Reply via email to