You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by jh...@apache.org on 2017/09/08 22:16:15 UTC
[2/2] calcite git commit: Annotate interface SqlDialect.Handler
(added in [CALCITE-1841]) as "experimental" until we settle [CALCITE-1913]
Annotate interface SqlDialect.Handler (added in [CALCITE-1841]) as "experimental" until we settle [CALCITE-1913]
Allow annotation Experimental to apply to constructors.
Also fix a couple of issues from [CALCITE-1947]:
* Long(long) constructor is deprecated in JDK 1.9;
* java.sql.Types.TIME_WITH_TIMEZONE dnd TIMESTAMP_WITH_TIMEZONE don't
exist until JDK 1.8.
Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/67071b6b
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/67071b6b
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/67071b6b
Branch: refs/heads/master
Commit: 67071b6b0ba52eeb953badfff39fa10d85b80bf5
Parents: 1f04d55
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Sep 8 13:09:48 2017 -0700
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Sep 8 15:05:11 2017 -0700
----------------------------------------------------------------------
core/src/main/java/org/apache/calcite/sql/SqlDialect.java | 6 +++++-
.../main/java/org/apache/calcite/sql/type/SqlTypeFamily.java | 4 ++--
core/src/test/java/org/apache/calcite/test/RexProgramTest.java | 2 +-
.../java/org/apache/calcite/linq4j/function/Experimental.java | 3 ++-
4 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite/blob/67071b6b/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
----------------------------------------------------------------------
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 306ed6e..6bc25ca 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlDialect.java
@@ -18,6 +18,7 @@ package org.apache.calcite.sql;
import org.apache.calcite.avatica.util.DateTimeUtils;
import org.apache.calcite.config.NullCollation;
+import org.apache.calcite.linq4j.function.Experimental;
import org.apache.calcite.rel.RelFieldCollation;
import org.apache.calcite.sql.dialect.HsqldbHandler;
import org.apache.calcite.sql.dialect.MssqlHandler;
@@ -133,7 +134,7 @@ public class SqlDialect {
NullCollation.HIGH, DEFAULT_HANDLER);
}
- @Deprecated // to be removed before 2.0
+ /** Creates a SqlDialect with the default handler. */
public SqlDialect(DatabaseProduct databaseProduct, String databaseProductName,
String identifierQuoteString, NullCollation nullCollation) {
this(databaseProduct, databaseProductName, identifierQuoteString,
@@ -151,6 +152,7 @@ public class SqlDialect {
* @param nullCollation Whether NULL values appear first or last
* @param handler Handler for un-parsing
*/
+ @Experimental
public SqlDialect(DatabaseProduct databaseProduct, String databaseProductName,
String identifierQuoteString, NullCollation nullCollation,
Handler handler) {
@@ -717,12 +719,14 @@ public class SqlDialect {
*
* <p>Instances are stateless and therefore immutable.
*/
+ @Experimental
public interface Handler {
void unparseCall(SqlWriter writer, SqlCall call, int leftPrec,
int rightPrec);
}
/** Base class for dialect handlers. */
+ @Experimental
public static class BaseHandler implements Handler {
public void unparseCall(SqlWriter writer, SqlCall call,
int leftPrec, int rightPrec) {
http://git-wip-us.apache.org/repos/asf/calcite/blob/67071b6b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java
index af1733b..5501316 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFamily.java
@@ -99,9 +99,9 @@ public enum SqlTypeFamily implements RelDataTypeFamily {
.put(Types.DATE, DATE)
.put(Types.TIME, TIME)
- .put(Types.TIME_WITH_TIMEZONE, TIME)
+ .put(ExtraSqlTypes.TIME_WITH_TIMEZONE, TIME)
.put(Types.TIMESTAMP, TIMESTAMP)
- .put(Types.TIMESTAMP_WITH_TIMEZONE, TIMESTAMP)
+ .put(ExtraSqlTypes.TIMESTAMP_WITH_TIMEZONE, TIMESTAMP)
.put(Types.BOOLEAN, BOOLEAN)
.put(ExtraSqlTypes.REF_CURSOR, CURSOR)
http://git-wip-us.apache.org/repos/asf/calcite/blob/67071b6b/core/src/test/java/org/apache/calcite/test/RexProgramTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/RexProgramTest.java b/core/src/test/java/org/apache/calcite/test/RexProgramTest.java
index ccecc98..f82a265 100644
--- a/core/src/test/java/org/apache/calcite/test/RexProgramTest.java
+++ b/core/src/test/java/org/apache/calcite/test/RexProgramTest.java
@@ -125,7 +125,7 @@ public class RexProgramTest {
this.map =
ImmutableMap.<String, Object>of(
Variable.TIME_ZONE.camelName, TimeZone.getTimeZone("America/Los_Angeles"),
- Variable.CURRENT_TIMESTAMP.camelName, new Long(1311120000000L));
+ Variable.CURRENT_TIMESTAMP.camelName, 1311120000000L);
}
public SchemaPlus getRootSchema() {
http://git-wip-us.apache.org/repos/asf/calcite/blob/67071b6b/linq4j/src/main/java/org/apache/calcite/linq4j/function/Experimental.java
----------------------------------------------------------------------
diff --git a/linq4j/src/main/java/org/apache/calcite/linq4j/function/Experimental.java b/linq4j/src/main/java/org/apache/calcite/linq4j/function/Experimental.java
index 630384d..768096d 100644
--- a/linq4j/src/main/java/org/apache/calcite/linq4j/function/Experimental.java
+++ b/linq4j/src/main/java/org/apache/calcite/linq4j/function/Experimental.java
@@ -20,6 +20,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PACKAGE;
@@ -33,7 +34,7 @@ import static java.lang.annotation.ElementType.TYPE;
* <p>And yes, it is flagged experimental. We may move it elsewhere in future,
* when we re-think the maturity model.
*/
-@Target({PACKAGE, TYPE, FIELD, METHOD })
+@Target({PACKAGE, TYPE, FIELD, METHOD, CONSTRUCTOR })
@Retention(RetentionPolicy.SOURCE)
@Experimental
public @interface Experimental {