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/01/07 18:28:20 UTC
calcite git commit: [CALCITE-1258] JDK 1.9
Repository: calcite
Updated Branches:
refs/heads/master 2b9663752 -> 446c2b761
[CALCITE-1258] JDK 1.9
Upgrade JMH, so that it works on JDK 1.9.
Apparently MEDIUM format strings for date and date-time have changed
in JDK 1.9, so make them explicit.
Upgrade maven-javadoc-plugin, due to [MJAVADOC-442].
Javadoc no longer likes tags: remove @sql.92, @sql.99, @sql.2003,
@pre, @post.
Project: http://git-wip-us.apache.org/repos/asf/calcite/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite/commit/446c2b76
Tree: http://git-wip-us.apache.org/repos/asf/calcite/tree/446c2b76
Diff: http://git-wip-us.apache.org/repos/asf/calcite/diff/446c2b76
Branch: refs/heads/master
Commit: 446c2b7611be33571baff005ceb4651d9fe6ed1f
Parents: 2b96637
Author: Julian Hyde <jh...@apache.org>
Authored: Fri Jan 6 15:30:04 2017 -0800
Committer: Julian Hyde <jh...@apache.org>
Committed: Fri Jan 6 21:09:42 2017 -0800
----------------------------------------------------------------------
core/src/main/codegen/templates/Parser.jj | 3 +-
.../calcite/plan/volcano/VolcanoRuleCall.java | 12 ++---
.../calcite/plan/volcano/VolcanoRuleMatch.java | 18 +++++--
.../rel/type/RelDataTypeFactoryImpl.java | 5 +-
.../rel/type/RelDataTypePrecedenceList.java | 4 +-
.../java/org/apache/calcite/rex/RexOver.java | 10 ++--
.../org/apache/calcite/sql/SqlCollation.java | 9 ++--
.../java/org/apache/calcite/sql/SqlUtil.java | 10 ++--
.../sql/parser/SqlAbstractParserImpl.java | 6 ++-
.../apache/calcite/sql/type/BasicSqlType.java | 8 +--
.../apache/calcite/sql/type/ReturnTypes.java | 18 +++----
.../sql/type/SqlTypeExplicitPrecedenceList.java | 3 +-
.../calcite/sql/type/SqlTypeFactoryImpl.java | 4 +-
.../calcite/sql/validate/SqlValidatorImpl.java | 18 +++----
.../calcite/sql2rel/SqlToRelConverter.java | 4 +-
.../org/apache/calcite/test/SqlLimitsTest.java | 25 +++++-----
pom.xml | 51 ++++----------------
site/_docs/howto.md | 8 +--
18 files changed, 100 insertions(+), 116 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/codegen/templates/Parser.jj
----------------------------------------------------------------------
diff --git a/core/src/main/codegen/templates/Parser.jj b/core/src/main/codegen/templates/Parser.jj
index 4a0bc46..318ed34 100644
--- a/core/src/main/codegen/templates/Parser.jj
+++ b/core/src/main/codegen/templates/Parser.jj
@@ -99,6 +99,7 @@ import org.apache.calcite.sql.parser.SqlParserPos;
import org.apache.calcite.sql.parser.SqlParserUtil;
import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.calcite.sql.validate.SqlConformance;
+import org.apache.calcite.util.Glossary;
import org.apache.calcite.util.Util;
import org.apache.calcite.util.trace.CalciteTrace;
@@ -5649,7 +5650,7 @@ SqlPostfixOperator PostfixRowOperator() :
* by the SQL:2003 standard (see productions for "non-reserved word"
* and "reserved word" in reference below).
*
- * @sql.2003 Part 2 Section 5.2
+ * @see Glossary#SQL2003 SQL:2003 Part 2 Section 5.2
*/
String CommonNonReservedKeyWord() :
{
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java
index 6d129da..8372821 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleCall.java
@@ -240,12 +240,10 @@ public class VolcanoRuleCall extends RelOptRuleCall {
}
/**
- * Applies this rule, with a given relexp in the first slot.
- *
- * @pre operand0.matches(rel)
+ * Applies this rule, with a given relational expression in the first slot.
*/
void match(RelNode rel) {
- assert getOperand0().matches(rel);
+ assert getOperand0().matches(rel) : "precondition";
final int solve = 0;
int operandOrdinal = getOperand0().solveOrder[solve];
this.rels[operandOrdinal] = rel;
@@ -255,11 +253,11 @@ public class VolcanoRuleCall extends RelOptRuleCall {
/**
* Recursively matches operands above a given solve order.
*
- * @param solve Solver order of operand
- * @pre solve > 0
- * @pre solve <= rule.operands.length
+ * @param solve Solve order of operand (> 0 and ≤ the operand count)
*/
private void matchRecurse(int solve) {
+ assert solve > 0;
+ assert solve <= rule.operands.size();
final List<RelOptRuleOperand> operands = getRule().operands;
if (solve == operands.size()) {
// We have matched all operands. Now ask the rule whether it
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleMatch.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleMatch.java b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleMatch.java
index 6a2c8b3..d08451a 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleMatch.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRuleMatch.java
@@ -20,6 +20,7 @@ import org.apache.calcite.plan.RelOptRuleOperand;
import org.apache.calcite.plan.RelTrait;
import org.apache.calcite.plan.RelTraitSet;
import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.util.Litmus;
import java.util.List;
import java.util.Map;
@@ -45,14 +46,11 @@ class VolcanoRuleMatch extends VolcanoRuleCall {
* @param rels List of targets; copied by the constructor, so the client
* can modify it later
* @param nodeInputs Map from relational expressions to their inputs
- * @pre rels[i] != null
*/
VolcanoRuleMatch(VolcanoPlanner volcanoPlanner, RelOptRuleOperand operand0,
RelNode[] rels, Map<RelNode, List<RelNode>> nodeInputs) {
super(volcanoPlanner, operand0, rels.clone(), nodeInputs);
- for (RelNode rel : rels) {
- assert rel != null;
- }
+ assert allNotNull(rels, Litmus.THROW);
// Try to deduce which subset the result will belong to. Assume --
// for now -- that the set is the same as the root relexp.
@@ -185,6 +183,18 @@ class VolcanoRuleMatch extends VolcanoRuleCall {
// The target subset doesn't exist yet.
return null;
}
+
+ /** Returns whether all elements of a given array are not-null;
+ * fails if any are null. */
+ private static <E> boolean allNotNull(E[] es, Litmus litmus) {
+ for (E e : es) {
+ if (e == null) {
+ return litmus.fail("was null", (Object) es);
+ }
+ }
+ return litmus.succeed();
+ }
+
}
// End VolcanoRuleMatch.java
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java
index d739dd9..949c9eb 100644
--- a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java
+++ b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java
@@ -22,6 +22,7 @@ import org.apache.calcite.sql.type.JavaToSqlTypeConversionRules;
import org.apache.calcite.sql.type.SqlTypeFamily;
import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.calcite.sql.type.SqlTypeUtil;
+import org.apache.calcite.util.Glossary;
import org.apache.calcite.util.Util;
import com.google.common.base.Preconditions;
@@ -451,7 +452,7 @@ public abstract class RelDataTypeFactoryImpl implements RelDataTypeFactory {
*
* p and s are capped at their maximum values
*
- * @sql.2003 Part 2 Section 6.26
+ * @see Glossary#SQL2003 SQL:2003 Part 2 Section 6.26
*/
public RelDataType createDecimalProduct(
RelDataType type1,
@@ -513,7 +514,7 @@ public abstract class RelDataTypeFactoryImpl implements RelDataTypeFactory {
* <li>p and s are capped at their maximum values</li>
* </ul>
*
- * @sql.2003 Part 2 Section 6.26
+ * @see Glossary#SQL2003 SQL:2003 Part 2 Section 6.26
*/
public RelDataType createDecimalQuotient(
RelDataType type1,
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/rel/type/RelDataTypePrecedenceList.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypePrecedenceList.java b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypePrecedenceList.java
index e2ecea1..99c8266 100644
--- a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypePrecedenceList.java
+++ b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypePrecedenceList.java
@@ -16,11 +16,13 @@
*/
package org.apache.calcite.rel.type;
+import org.apache.calcite.util.Glossary;
+
/**
* RelDataTypePrecedenceList defines a type precedence list for a particular
* type.
*
- * @sql.99 Part 2 Section 9.5
+ * @see Glossary#SQL99 SQL:1999 Part 2 Section 9.5
*/
public interface RelDataTypePrecedenceList {
//~ Methods ----------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/rex/RexOver.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/rex/RexOver.java b/core/src/main/java/org/apache/calcite/rex/RexOver.java
index 48cff61..d2c4684 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexOver.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexOver.java
@@ -22,6 +22,8 @@ import org.apache.calcite.sql.SqlWindow;
import org.apache.calcite.util.ControlFlowException;
import org.apache.calcite.util.Util;
+import com.google.common.base.Preconditions;
+
import java.util.List;
/**
@@ -52,9 +54,6 @@ public class RexOver extends RexCall {
* @param op Aggregate operator
* @param operands Operands list
* @param window Window specification
- * @pre op.isAggregator()
- * @pre window != null
- * @pre window.getRefName() == null
*/
RexOver(
RelDataType type,
@@ -62,9 +61,8 @@ public class RexOver extends RexCall {
List<RexNode> operands,
RexWindow window) {
super(type, op, operands);
- assert op.isAggregator() : "precondition: op.isAggregator()";
- assert window != null : "precondition: window != null";
- this.window = window;
+ Preconditions.checkArgument(op.isAggregator());
+ this.window = Preconditions.checkNotNull(window);
}
//~ Methods ----------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/sql/SqlCollation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlCollation.java b/core/src/main/java/org/apache/calcite/sql/SqlCollation.java
index 03fd90f..66fd7ac 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlCollation.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlCollation.java
@@ -17,6 +17,7 @@
package org.apache.calcite.sql;
import org.apache.calcite.sql.parser.SqlParserUtil;
+import org.apache.calcite.util.Glossary;
import org.apache.calcite.util.SaffronProperties;
import org.apache.calcite.util.SerializableCharset;
import org.apache.calcite.util.Util;
@@ -50,7 +51,7 @@ public class SqlCollation implements Serializable {
* coercibility characteristic Explicit, with the collating sequence
* specified in the <collate clause>.</blockquote>
*
- * @sql.99 Part 2 Section 4.2.3
+ * @see Glossary#SQL99 SQL:1999 Part 2 Section 4.2.3
*/
public enum Coercibility {
/** Strongest coercibility. */
@@ -127,7 +128,7 @@ public class SqlCollation implements Serializable {
* @return the resulting collation sequence. The "no collating sequence"
* result is returned as null.
*
- * @sql.99 Part 2 Section 4.2.3 Table 2
+ * @see Glossary#SQL99 SQL:1999 Part 2 Section 4.2.3 Table 2
*/
public static SqlCollation getCoercibilityDyadicOperator(
SqlCollation col1,
@@ -148,7 +149,7 @@ public class SqlCollation implements Serializable {
* {@link org.apache.calcite.runtime.CalciteResource#differentCollations}
* if no collating sequence can be deduced
*
- * @sql.99 Part 2 Section 4.2.3 Table 2
+ * @see Glossary#SQL99 SQL:1999 Part 2 Section 4.2.3 Table 2
*/
public static SqlCollation getCoercibilityDyadicOperatorThrows(
SqlCollation col1,
@@ -175,7 +176,7 @@ public class SqlCollation implements Serializable {
* sequence could be deduced throws a
* {@link org.apache.calcite.runtime.CalciteResource#invalidCompare}
*
- * @sql.99 Part 2 Section 4.2.3 Table 3
+ * @see Glossary#SQL99 SQL:1999 Part 2 Section 4.2.3 Table 3
*/
public static String getCoercibilityDyadicComparison(
SqlCollation col1,
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/sql/SqlUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlUtil.java b/core/src/main/java/org/apache/calcite/sql/SqlUtil.java
index ca8fb27..bb76cd7 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlUtil.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlUtil.java
@@ -33,6 +33,7 @@ import org.apache.calcite.sql.type.SqlTypeUtil;
import org.apache.calcite.sql.util.SqlBasicVisitor;
import org.apache.calcite.util.BarfingInvocationHandler;
import org.apache.calcite.util.ConversionUtil;
+import org.apache.calcite.util.Glossary;
import org.apache.calcite.util.NlsString;
import org.apache.calcite.util.Pair;
import org.apache.calcite.util.Util;
@@ -357,7 +358,8 @@ public abstract class SqlUtil {
* @param category whether a function or a procedure. (If a procedure is
* being invoked, the overload rules are simpler.)
* @return matching routine, or null if none found
- * @sql.99 Part 2 Section 10.4
+ *
+ * @see Glossary#SQL99 SQL:1999 Part 2 Section 10.4
*/
public static SqlOperator lookupRoutine(SqlOperatorTable opTab,
SqlIdentifier funcName, List<RelDataType> argTypes,
@@ -401,7 +403,7 @@ public abstract class SqlUtil {
* @param sqlKind the SqlKind of the SqlOperator being looked up
* @param category category of routine to look up
* @return list of matching routines
- * @sql.99 Part 2 Section 10.4
+ * @see Glossary#SQL99 SQL:1999 Part 2 Section 10.4
*/
public static Iterator<SqlOperator> lookupSubjectRoutines(
SqlOperatorTable opTab,
@@ -507,7 +509,7 @@ public abstract class SqlUtil {
}
/**
- * @sql.99 Part 2 Section 10.4 Syntax Rule 6.b.iii.2.B
+ * @see Glossary#SQL99 SQL:1999 Part 2 Section 10.4 Syntax Rule 6.b.iii.2.B
*/
private static Iterator<SqlOperator> filterRoutinesByParameterType(
SqlSyntax syntax,
@@ -570,7 +572,7 @@ public abstract class SqlUtil {
}
/**
- * @sql.99 Part 2 Section 9.4
+ * @see Glossary#SQL99 SQL:1999 Part 2 Section 9.4
*/
private static Iterator<SqlOperator> filterRoutinesByTypePrecedence(
SqlSyntax sqlSyntax,
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java b/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java
index 45f004f..6c7b167 100644
--- a/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java
+++ b/core/src/main/java/org/apache/calcite/sql/parser/SqlAbstractParserImpl.java
@@ -27,6 +27,7 @@ import org.apache.calcite.sql.SqlSyntax;
import org.apache.calcite.sql.SqlUnresolvedFunction;
import org.apache.calcite.sql.fun.SqlStdOperatorTable;
import org.apache.calcite.sql.validate.SqlConformance;
+import org.apache.calcite.util.Glossary;
import org.apache.calcite.util.Util;
import com.google.common.collect.ImmutableList;
@@ -339,8 +340,9 @@ public abstract class SqlAbstractParserImpl {
//~ Methods ----------------------------------------------------------------
/**
- * @return immutable set of all reserved words defined by SQL-92
- * @sql.92 Section 5.2
+ * Returns immutable set of all reserved words defined by SQL-92.
+ *
+ * @see Glossary#SQL92 SQL-92 Section 5.2
*/
public static Set<String> getSql92ReservedWords() {
return SQL_92_RESERVED_WORD_SET;
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/sql/type/BasicSqlType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/type/BasicSqlType.java b/core/src/main/java/org/apache/calcite/sql/type/BasicSqlType.java
index 421960d..eb699ef 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/BasicSqlType.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/BasicSqlType.java
@@ -21,6 +21,8 @@ import org.apache.calcite.sql.SqlCollation;
import org.apache.calcite.util.SerializableCharset;
import org.apache.calcite.util.Util;
+import com.google.common.base.Preconditions;
+
import java.nio.charset.Charset;
/**
@@ -110,14 +112,14 @@ public class BasicSqlType extends AbstractSqlType {
}
/**
- * Constructs a type with charset and collation
+ * Constructs a type with charset and collation.
*
- * @pre SqlTypeUtil.inCharFamily(this)
+ * <p>This must be a character tyoe.
*/
BasicSqlType createWithCharsetAndCollation(
Charset charset,
SqlCollation collation) {
- Util.pre(SqlTypeUtil.inCharFamily(this), "Not an chartype");
+ Preconditions.checkArgument(SqlTypeUtil.inCharFamily(this));
BasicSqlType ret;
try {
ret = (BasicSqlType) this.clone();
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java b/core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java
index 62c9ad3..f0c5564 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java
@@ -27,8 +27,11 @@ import org.apache.calcite.sql.SqlCallBinding;
import org.apache.calcite.sql.SqlCollation;
import org.apache.calcite.sql.SqlOperatorBinding;
import org.apache.calcite.sql.SqlUtil;
+import org.apache.calcite.util.Glossary;
import org.apache.calcite.util.Util;
+import com.google.common.base.Preconditions;
+
import java.util.AbstractList;
import java.util.List;
@@ -295,7 +298,7 @@ public abstract class ReturnTypes {
* of results of aggregations". These rules are used in union, except,
* intersect, case and other places.
*
- * @sql.99 Part 2 Section 9.3
+ * @see Glossary#SQL99 SQL:1999 Part 2 Section 9.3
*/
public static final SqlReturnTypeInference LEAST_RESTRICTIVE =
new SqlReturnTypeInference() {
@@ -496,7 +499,7 @@ public abstract class ReturnTypes {
*
* p and s are capped at their maximum values
*
- * @sql.2003 Part 2 Section 6.26
+ * @see Glossary#SQL2003 SQL:2003 Part 2 Section 6.26
*/
public static final SqlReturnTypeInference DECIMAL_SUM =
new SqlReturnTypeInference() {
@@ -570,11 +573,7 @@ public abstract class ReturnTypes {
*/
public static final SqlReturnTypeInference DYADIC_STRING_SUM_PRECISION =
new SqlReturnTypeInference() {
- /**
- * @pre SqlTypeUtil.sameNamedType(argTypes[0], (argTypes[1]))
- */
- public RelDataType inferReturnType(
- SqlOperatorBinding opBinding) {
+ public RelDataType inferReturnType(SqlOperatorBinding opBinding) {
final RelDataType argType0 = opBinding.getOperandType(0);
final RelDataType argType1 = opBinding.getOperandType(1);
@@ -585,9 +584,8 @@ public abstract class ReturnTypes {
if (!containsAnyType
&& !(SqlTypeUtil.inCharOrBinaryFamilies(argType0)
&& SqlTypeUtil.inCharOrBinaryFamilies(argType1))) {
- Util.pre(
- SqlTypeUtil.sameNamedType(argType0, argType1),
- "SqlTypeUtil.sameNamedType(argTypes[0], argTypes[1])");
+ Preconditions.checkArgument(
+ SqlTypeUtil.sameNamedType(argType0, argType1));
}
SqlCollation pickedCollation = null;
if (!containsAnyType
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/sql/type/SqlTypeExplicitPrecedenceList.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeExplicitPrecedenceList.java b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeExplicitPrecedenceList.java
index 1fc7c9b..58b0707 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeExplicitPrecedenceList.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeExplicitPrecedenceList.java
@@ -18,6 +18,7 @@ package org.apache.calcite.sql.type;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypePrecedenceList;
+import org.apache.calcite.util.Glossary;
import org.apache.calcite.util.ImmutableNullableList;
import org.apache.calcite.util.Util;
@@ -65,7 +66,7 @@ public class SqlTypeExplicitPrecedenceList
/**
* Map from SqlTypeName to corresponding precedence list.
*
- * @sql.2003 Part 2 Section 9.5
+ * @see Glossary#SQL2003 SQL:2003 Part 2 Section 9.5
*/
private static final Map<SqlTypeName, SqlTypeExplicitPrecedenceList>
TYPE_NAME_TO_PRECEDENCE_LIST =
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFactoryImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFactoryImpl.java b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFactoryImpl.java
index 0b9ee4b..e1f8ab2 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFactoryImpl.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/SqlTypeFactoryImpl.java
@@ -23,6 +23,7 @@ import org.apache.calcite.rel.type.RelDataTypeFamily;
import org.apache.calcite.rel.type.RelDataTypeSystem;
import org.apache.calcite.sql.SqlCollation;
import org.apache.calcite.sql.SqlIntervalQualifier;
+import org.apache.calcite.util.Glossary;
import org.apache.calcite.util.Util;
import java.nio.charset.Charset;
@@ -491,7 +492,8 @@ public class SqlTypeFactoryImpl extends RelDataTypeFactoryImpl {
*
* @return false (the default) to provide strict SQL:2003 behavior; true to
* provide pragmatic behavior
- * @sql.2003 Part 2 Section 9.3 Syntax Rule 3.a.iii.3
+ *
+ * @see Glossary#SQL2003 SQL:2003 Part 2 Section 9.3 Syntax Rule 3.a.iii.3
*/
protected boolean shouldRaggedFixedLengthValueUnionBeVariable() {
// TODO jvs 30-Nov-2006: implement SQL-Flagger support
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
index 790fe48..7b2645c 100644
--- a/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
+++ b/core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java
@@ -77,6 +77,7 @@ import org.apache.calcite.sql.type.SqlTypeUtil;
import org.apache.calcite.sql.util.SqlShuttle;
import org.apache.calcite.sql.util.SqlVisitor;
import org.apache.calcite.util.BitString;
+import org.apache.calcite.util.Bug;
import org.apache.calcite.util.ImmutableNullableList;
import org.apache.calcite.util.Litmus;
import org.apache.calcite.util.Pair;
@@ -1521,16 +1522,16 @@ public class SqlValidatorImpl implements SqlValidatorWithHints {
}
/**
- * Derives the type of a node.
- *
- * @post return != null
+ * Derives the type of a node, never null.
*/
RelDataType deriveTypeImpl(
SqlValidatorScope scope,
SqlNode operand) {
DeriveTypeVisitor v = new DeriveTypeVisitor(scope);
final RelDataType type = operand.accept(v);
- return scope.nullifyType(operand, type);
+ // After Guava 17, use Verify.verifyNotNull for Preconditions.checkNotNull
+ Bug.upgrade("guava-17");
+ return Preconditions.checkNotNull(scope.nullifyType(operand, type));
}
public RelDataType deriveConstructorType(
@@ -2155,7 +2156,6 @@ public class SqlValidatorImpl implements SqlValidatorWithHints {
* @param node Query node
* @param alias Name of this query within its parent. Must be specified
* if usingScope != null
- * @pre usingScope == null || alias != null
*/
private void registerQuery(
SqlValidatorScope parentScope,
@@ -2164,6 +2164,7 @@ public class SqlValidatorImpl implements SqlValidatorWithHints {
SqlNode enclosingNode,
String alias,
boolean forceNullable) {
+ Preconditions.checkArgument(usingScope == null || alias != null);
registerQuery(
parentScope,
usingScope,
@@ -2185,7 +2186,6 @@ public class SqlValidatorImpl implements SqlValidatorWithHints {
* if usingScope != null
* @param checkUpdate if true, validate that the update feature is supported
* if validating the update statement
- * @pre usingScope == null || alias != null
*/
private void registerQuery(
SqlValidatorScope parentScope,
@@ -2195,9 +2195,9 @@ public class SqlValidatorImpl implements SqlValidatorWithHints {
String alias,
boolean forceNullable,
boolean checkUpdate) {
- assert node != null;
- assert enclosingNode != null;
- assert usingScope == null || alias != null : usingScope;
+ Preconditions.checkNotNull(node);
+ Preconditions.checkNotNull(enclosingNode);
+ Preconditions.checkArgument(usingScope == null || alias != null);
SqlCall call;
List<SqlNode> operands;
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java b/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
index 78fcac8..fb27449 100644
--- a/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
+++ b/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java
@@ -1475,7 +1475,6 @@ public class SqlToRelConverter {
* approximation (say representing UNKNOWN as FALSE)
* @param notIn Whether the operation is NOT IN
* @return join expression
- * @pre extraExpr == null || extraName != null
*/
private RelOptUtil.Exists convertExists(
SqlNode seek,
@@ -3331,12 +3330,11 @@ public class SqlToRelConverter {
* @param bb Blackboard
* @param rowConstructor Row constructor expression
* @return Relational expression which returns a single row.
- * @pre isRowConstructor(rowConstructor)
*/
private RelNode convertRowConstructor(
Blackboard bb,
SqlCall rowConstructor) {
- assert isRowConstructor(rowConstructor) : rowConstructor;
+ Preconditions.checkArgument(isRowConstructor(rowConstructor));
final List<SqlNode> operands = rowConstructor.getOperandList();
return convertMultisets(operands, bb);
}
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/core/src/test/java/org/apache/calcite/test/SqlLimitsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/calcite/test/SqlLimitsTest.java b/core/src/test/java/org/apache/calcite/test/SqlLimitsTest.java
index 8c58676..7ca1d60 100644
--- a/core/src/test/java/org/apache/calcite/test/SqlLimitsTest.java
+++ b/core/src/test/java/org/apache/calcite/test/SqlLimitsTest.java
@@ -34,6 +34,7 @@ import org.junit.Test;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
@@ -193,18 +194,7 @@ public class SqlLimitsTest {
s = buf.toString();
} else if (o instanceof Calendar) {
Calendar calendar = (Calendar) o;
- DateFormat dateFormat;
- switch (type.getSqlTypeName()) {
- case DATE:
- dateFormat = DateFormat.getDateInstance();
- break;
- case TIME:
- dateFormat = DateFormat.getTimeInstance();
- break;
- default:
- dateFormat = DateFormat.getDateTimeInstance();
- break;
- }
+ DateFormat dateFormat = getDateFormat(type.getSqlTypeName());
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
s = dateFormat.format(calendar.getTime());
} else {
@@ -217,6 +207,17 @@ public class SqlLimitsTest {
pw.print(literal.toSqlString(SqlDialect.DUMMY));
pw.println();
}
+
+ private DateFormat getDateFormat(SqlTypeName typeName) {
+ switch (typeName) {
+ case DATE:
+ return new SimpleDateFormat("MMM d, yyyy");
+ case TIME:
+ return new SimpleDateFormat("hh:mm:ss a");
+ default:
+ return new SimpleDateFormat("MMM d, yyyy hh:mm:ss a");
+ }
+ }
}
// End SqlLimitsTest.java
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f4973fb..f728112 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,10 +89,12 @@ limitations under the License.
<javacc-maven-plugin.version>2.4</javacc-maven-plugin.version>
<jcip-annotations.version>1.0-1</jcip-annotations.version>
<jetty.version>9.2.15.v20160210</jetty.version>
- <jmh.version>1.11.2</jmh.version>
+ <jmh.version>1.12</jmh.version>
<junit.version>4.12</junit.version>
<maven-checkstyle-plugin.version>2.12.1</maven-checkstyle-plugin.version>
<maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
+ <!-- Apache 18 has 2.10.3, but need 2.10.4 for [MJAVADOC-442]. -->
+ <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
<maven-scm-provider.version>1.9.4</maven-scm-provider.version>
<maven-shade-plugin.version>2.1</maven-shade-plugin.version>
<mockito-all.version>1.10.19</mockito-all.version>
@@ -548,29 +550,6 @@ limitations under the License.
<link>https://docs.oracle.com/javase/8/docs/api/</link>
</links>
<excludePackageNames>org.apache.calcite.benchmarks.generated,org.apache.calcite.sql.parser.impl,org.apache.calcite.sql.parser.parserextensiontesting,org.apache.calcite.piglet.parser,org.openjdk.jmh</excludePackageNames>
- <tags>
- <tag>
- <name>sql.92</name>
- <placement>a</placement>
- <head>SQL 92 spec:</head>
- </tag>
- <tag>
- <name>sql.99</name>
- <placement>a</placement>
- <head>SQL 99 spec:</head>
- </tag>
- <tag>
- <name>sql.2003</name>
- <placement>a</placement>
- <head>SQL 2003 spec:</head>
- </tag>
- <tag>
- <name>pre</name>
- </tag>
- <tag>
- <name>post</name>
- </tag>
- </tags>
<show>private</show>
</configuration>
</plugin>
@@ -694,6 +673,11 @@ limitations under the License.
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>${maven-javadoc-plugin.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven-shade-plugin.version}</version>
</plugin>
@@ -731,29 +715,12 @@ limitations under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
+ <version>${maven-javadoc-plugin.version}</version>
<configuration>
<links>
<link>https://docs.oracle.com/javase/8/docs/api/</link>
</links>
<excludePackageNames>org.apache.calcite.benchmarks.generated,org.apache.calcite.sql.parser.impl,org.apache.calcite.sql.parser.parserextensiontesting,org.apache.calcite.piglet.parser,org.openjdk.jmh</excludePackageNames>
- <tags>
- <tag>
- <name>sql.92</name>
- <placement>a</placement>
- <head>SQL 92 spec:</head>
- </tag>
- <tag>
- <name>sql.99</name>
- <placement>a</placement>
- <head>SQL 99 spec:</head>
- </tag>
- <tag>
- <name>sql.2003</name>
- <placement>a</placement>
- <head>SQL 2003 spec:</head>
- </tag>
- </tags>
- <additionalparam>-tag sql.2003:a:xxx</additionalparam>
<notimestamp>true</notimestamp>
<windowtitle>Apache Calcite API</windowtitle>
</configuration>
http://git-wip-us.apache.org/repos/asf/calcite/blob/446c2b76/site/_docs/howto.md
----------------------------------------------------------------------
diff --git a/site/_docs/howto.md b/site/_docs/howto.md
index 0c34da0..5a89cc4 100644
--- a/site/_docs/howto.md
+++ b/site/_docs/howto.md
@@ -32,7 +32,7 @@ adapters.
## Building from a source distribution
Prerequisites are maven (3.2.1 or later)
-and Java (JDK 1.7 or later, 1.8 preferred) on your path.
+and Java (JDK 1.7, 1.8 or 1.9) on your path.
Unpack the source distribution `.tar.gz` or `.zip` file,
`cd` to the root directory of the unpacked source,
@@ -781,15 +781,15 @@ The old releases will remain available in the
[release archive](http://archive.apache.org/dist/calcite/).
Add a release note by copying
-[site/_posts/2015-11-10-release-1.5.0.md]({{ site.sourceRoot }}/site/_posts/2015-11-10-release-1.5.0.md),
-generate the javadoc and copy to `site/target/apidocs` and `site/target/testapidocs`,
+[site/_posts/2016-10-12-release-1.10.0.md]({{ site.sourceRoot }}/site/_posts/2016-10-12-release-1.10.0.md),
+generate the javadoc using `mvn site` and copy to `site/target/apidocs` and `site/target/testapidocs`,
[publish the site](#publish-the-web-site),
and check that it appears in the contents in [news](http://localhost:4000/news/).
After 24 hours, announce the release by sending an email to
[announce@apache.org](https://mail-archives.apache.org/mod_mbox/www-announce/).
You can use
-[the 1.6.0 announcement](https://mail-archives.apache.org/mod_mbox/www-announce/201601.mbox/%3C8DB4C1E5-B322-4A33-8E8F-9858FA6A1119%40apache.org%3E)
+[the 1.10.0 announcement](https://mail-archives.apache.org/mod_mbox/calcite-dev/201610.mbox/%3C11A13D1A-8364-4A34-A11B-A8E5EA57A740%40apache.org%3E)
as a template. Be sure to include a brief description of the project.
## Publishing the web site (for Calcite committers)