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 2019/03/08 18:18:13 UTC
[calcite] 01/03: Cosmetic changes
This is an automated email from the ASF dual-hosted git repository.
jhyde pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git
commit e226ae49f987dde3a64b69cd474152d9adc7c38c
Author: Julian Hyde <jh...@apache.org>
AuthorDate: Thu Mar 7 16:29:23 2019 -0800
Cosmetic changes
Remove duplicate calcite-core:test inclusion in piglet/pom.xml
Remove ubenchmark package-info.java (was freaking out shade) and
suppress the resulting checkstyle warning.
Add RelToSqlConverterStructsTest to CalciteSuite.
---
.../enumerable/EnumerableInterpretable.java | 5 +-
.../calcite/config/CalciteSystemProperty.java | 66 ++++++++++++++--------
.../org/apache/calcite/plan/volcano/RuleQueue.java | 4 +-
.../calcite/rel/metadata/RelMdCollation.java | 11 ++--
.../rel/rules/FilterProjectTransposeRule.java | 12 ++--
.../main/java/org/apache/calcite/rex/RexCall.java | 5 +-
.../java/org/apache/calcite/rex/RexSimplify.java | 4 +-
.../calcite/sql/fun/SqlJsonDepthFunction.java | 17 +++---
.../calcite/sql/fun/SqlJsonTypeFunction.java | 17 +++---
.../org/apache/calcite/plan/RelWriterTest.java | 4 +-
.../calcite/rel/rules/SortRemoveRuleTest.java | 18 +++---
.../apache/calcite/schemas/HrClusteredSchema.java | 8 +--
.../java/org/apache/calcite/test/CalciteSuite.java | 2 +
.../org/apache/calcite/test/RexProgramTest.java | 17 ++----
.../apache/calcite/test/SqlToRelConverterTest.java | 2 +-
.../apache/calcite/test/SqlToRelConverterTest.xml | 2 +-
core/src/test/resources/sql/sub-query.iq | 4 +-
.../elasticsearch/ElasticSearchAdapterTest.java | 3 +-
.../adapter/elasticsearch/Projection2Test.java | 8 +--
.../calcite/linq4j/test/JoinPreserveOrderTest.java | 38 ++++++-------
piglet/pom.xml | 6 --
site/_docs/elasticsearch_adapter.md | 8 ++-
site/develop/index.md | 2 +-
src/main/config/checkstyle/suppressions.xml | 1 +
.../enumerable/CodeGenerationBenchmark.java | 13 ++---
.../calcite/adapter/enumerable/package-info.java | 26 ---------
.../benchmarks/StringConstructBenchmark.java | 13 +++--
27 files changed, 150 insertions(+), 166 deletions(-)
diff --git a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpretable.java b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpretable.java
index 86ed35c..e0bf74f 100644
--- a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpretable.java
+++ b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableInterpretable.java
@@ -92,8 +92,9 @@ public class EnumerableInterpretable extends ConverterImpl
/**
* The cache storing Bindable objects, instantiated via dynamically generated Java classes.
*
- * It allows to re-use Bindable objects for queries appearing relatively often. It is used
- * to avoid the cost of compiling and generating a new class and also instantiating the object.
+ * <p>It allows to re-use Bindable objects for queries appearing relatively
+ * often. It is used to avoid the cost of compiling and generating a new class
+ * and also instantiating the object.
*/
private static final Cache<String, Bindable> BINDABLE_CACHE =
CacheBuilder.newBuilder()
diff --git a/core/src/main/java/org/apache/calcite/config/CalciteSystemProperty.java b/core/src/main/java/org/apache/calcite/config/CalciteSystemProperty.java
index 0660b37..d1f3a5a 100644
--- a/core/src/main/java/org/apache/calcite/config/CalciteSystemProperty.java
+++ b/core/src/main/java/org/apache/calcite/config/CalciteSystemProperty.java
@@ -44,6 +44,7 @@ public final class CalciteSystemProperty<T> {
* are also kept here but under "calcite" namespace.</p>
*/
private static final Properties PROPERTIES = loadProperties();
+
/**
* Whether to run Calcite in debug mode.
*
@@ -54,6 +55,7 @@ public final class CalciteSystemProperty<T> {
*/
public static final CalciteSystemProperty<Boolean> DEBUG =
booleanProperty("calcite.debug", false);
+
/**
* Whether to exploit join commutative property.
*/
@@ -63,22 +65,26 @@ public final class CalciteSystemProperty<T> {
// {@link org.apache.calcite.rel.rules.JoinCommuteRule}.
public static final CalciteSystemProperty<Boolean> COMMUTE =
booleanProperty("calcite.enable.join.commute", false);
+
/**
* Whether to follow the SQL standard strictly.
*/
public static final CalciteSystemProperty<Boolean> STRICT =
booleanProperty("calcite.strict.sql", false);
+
/**
* Whether to include a GraphViz representation when dumping the state of the Volcano planner.
*/
public static final CalciteSystemProperty<Boolean> DUMP_GRAPHVIZ =
booleanProperty("calcite.volcano.dump.graphviz", true);
+
/**
* Whether to include <code>RelSet</code> information when dumping the state of the Volcano
* planner.
*/
public static final CalciteSystemProperty<Boolean> DUMP_SETS =
booleanProperty("calcite.volcano.dump.sets", true);
+
/**
* Whether to run integration tests.
*/
@@ -91,21 +97,25 @@ public final class CalciteSystemProperty<T> {
/**
* Which database to use for tests that require a JDBC data source.
*
- * The property can take one of the following values:
+ * <p>The property can take one of the following values:
+ *
* <ul>
- * <li>HSQLDB(default)</li>
+ * <li>HSQLDB (default)</li>
* <li>H2</li>
* <li>MYSQL</li>
* <li>ORACLE</li>
* <li>POSTGRESQL</li>
* </ul>
- * If the specified value is not included in the previous list the default is used.
*
- * <p>We recommend that casual users use hsqldb, and frequent Calcite developers use MySQL.
- * The test suite runs faster against the MySQL database (mainly because of the 0.1s versus 6s
- * startup time). You have to populate MySQL manually with the foodmart data set, otherwise there
- * will be test failures.</p>
- * */
+ * <p>If the specified value is not included in the previous list, the default
+ * is used.
+ *
+ * <p>We recommend that casual users use hsqldb, and frequent Calcite
+ * developers use MySQL. The test suite runs faster against the MySQL database
+ * (mainly because of the 0.1 second versus 6 seconds startup time). You have
+ * to populate MySQL manually with the foodmart data set, otherwise there will
+ * be test failures.
+ */
public static final CalciteSystemProperty<String> TEST_DB =
stringProperty("calcite.test.db", "HSQLDB",
ImmutableSet.of(
@@ -118,7 +128,8 @@ public final class CalciteSystemProperty<T> {
/**
* Path to the dataset file that should used for integration tests.
*
- * If a path is not set, then one of the following values will be used:
+ * <p>If a path is not set, then one of the following values will be used:
+ *
* <ul>
* <li>../calcite-test-dataset</li>
* <li>../../calcite-test-dataset</li>
@@ -142,28 +153,34 @@ public final class CalciteSystemProperty<T> {
}
return ".";
});
+
/**
* Whether to run slow tests.
*/
public static final CalciteSystemProperty<Boolean> TEST_SLOW =
booleanProperty("calcite.test.slow", false);
+
/**
* Whether to run MongoDB tests.
*/
public static final CalciteSystemProperty<Boolean> TEST_MONGODB =
booleanProperty("calcite.test.mongodb", true);
+
/**
* Whether to run Splunk tests.
*
- * Disabled by default, because we do not expect Splunk to be installed and populated data set.
+ * <p>Disabled by default, because we do not expect Splunk to be installed
+ * and populated with the data set necessary for testing.
*/
public static final CalciteSystemProperty<Boolean> TEST_SPLUNK =
booleanProperty("calcite.test.splunk", false);
+
/**
* Whether to run Druid tests.
*/
public static final CalciteSystemProperty<Boolean> TEST_DRUID =
booleanProperty("calcite.test.druid", true);
+
/**
* Whether to run Cassandra tests.
*/
@@ -172,9 +189,8 @@ public final class CalciteSystemProperty<T> {
/**
* A list of ids designating the queries
- * (from query.json in new.hydromatic:foodmart-queries:0.4.1) that should be run as part of
- * FoodmartTest.
- *
+ * (from query.json in new.hydromatic:foodmart-queries:0.4.1)
+ * that should be run as part of FoodmartTest.
*/
// TODO review zabetak:
// The name of the property is not appropriate. A better alternative would be
@@ -192,9 +208,9 @@ public final class CalciteSystemProperty<T> {
booleanProperty("calcite.opt.allowInfiniteCostConverters", true);
/**
- * Which is the name of the default character set.
+ * The name of the default character set.
*
- * <p>It is used by {@link org.apache.calcite.sql.validate.SqlValidator}.</p>
+ * <p>It is used by {@link org.apache.calcite.sql.validate.SqlValidator}.
*/
// TODO review zabetak:
// What happens if a wrong value is specified?
@@ -202,7 +218,7 @@ public final class CalciteSystemProperty<T> {
stringProperty("calcite.default.charset", "ISO-8859-1");
/**
- * Which is the name of the default national character set.
+ * The name of the default national character set.
*
* <p>It is used with the N'string' construct in
* {@link org.apache.calcite.sql.SqlLiteral#SqlLiteral}
@@ -214,10 +230,10 @@ public final class CalciteSystemProperty<T> {
stringProperty("calcite.default.nationalcharset", "ISO-8859-1");
/**
- * Which is the name of the default collation.
+ * The name of the default collation.
*
* <p>It is used in {@link org.apache.calcite.sql.SqlCollation} and
- * {@link org.apache.calcite.sql.SqlLiteral#SqlLiteral}</p>
+ * {@link org.apache.calcite.sql.SqlLiteral#SqlLiteral}.
*/
// TODO review zabetak:
// What happens if a wrong value is specified?
@@ -225,7 +241,7 @@ public final class CalciteSystemProperty<T> {
stringProperty("calcite.default.collation.name", "ISO-8859-1$en_US");
/**
- * Which is the strength of the default collation.
+ * The strength of the default collation.
*
* <p>It is used in {@link org.apache.calcite.sql.SqlCollation} and
* {@link org.apache.calcite.sql.SqlLiteral#SqlLiteral}.</p>
@@ -236,7 +252,7 @@ public final class CalciteSystemProperty<T> {
stringProperty("calcite.default.collation.strength", "primary");
/**
- * Which is the maximum size of the cache of metadata handlers.
+ * The maximum size of the cache of metadata handlers.
*
* <p>A typical value is the number of queries being concurrently prepared multiplied by the
* number of types of metadata.</p>
@@ -263,6 +279,7 @@ public final class CalciteSystemProperty<T> {
*/
public static final CalciteSystemProperty<Integer> BINDABLE_CACHE_MAX_SIZE =
intProperty("calcite.bindable.cache.maxSize", 0, v -> v >= 0 && v <= Integer.MAX_VALUE);
+
/**
* The concurrency level of the cache used for storing Bindable objects, instantiated via
* dynamically generated Java classes.
@@ -291,9 +308,12 @@ public final class CalciteSystemProperty<T> {
/**
* Returns the value of the system property with the specified name as int, or
* the <code>defaultValue</code> if any of the conditions below hold:
- * (i) the property is not defined;
- * (ii) the property value cannot be transformed to an int;
- * (iii) the property value does not satisfy the checker.
+ *
+ * <ol>
+ * <li>the property is not defined;
+ * <li>the property value cannot be transformed to an int;
+ * <li>the property value does not satisfy the checker.
+ * </ol>
*/
private static CalciteSystemProperty<Integer> intProperty(String key, int defaultValue,
IntPredicate valueChecker) {
diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
index 2a58e8d..ab025e3 100644
--- a/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
+++ b/core/src/main/java/org/apache/calcite/plan/volcano/RuleQueue.java
@@ -106,8 +106,8 @@ class RuleQueue {
* Maps a {@link VolcanoPlannerPhase} to a set of rule descriptions. Named rules
* may be invoked in their corresponding phase.
*
- * See {@link VolcanoPlannerPhaseRuleMappingInitializer} for more information regarding the
- * contents of this Map and how it is initialized.
+ * <p>See {@link VolcanoPlannerPhaseRuleMappingInitializer} for more
+ * information regarding the contents of this Map and how it is initialized.
*/
private final Map<VolcanoPlannerPhase, Set<String>> phaseRuleMapping;
diff --git a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdCollation.java b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdCollation.java
index 5c807f9..aa5df07 100644
--- a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdCollation.java
+++ b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdCollation.java
@@ -146,22 +146,21 @@ public class RelMdCollation
public ImmutableList<RelCollation> collations(EnumerableThetaJoin join,
RelMetadataQuery mq) {
return ImmutableList.copyOf(
- RelMdCollation.enumerableThetaJoin(mq, join.getLeft(), join.getRight(), join.getJoinType())
- );
+ RelMdCollation.enumerableThetaJoin(mq, join.getLeft(), join.getRight(),
+ join.getJoinType()));
}
public ImmutableList<RelCollation> collations(EnumerableCorrelate join,
RelMetadataQuery mq) {
return ImmutableList.copyOf(
- RelMdCollation.enumerableCorrelate(mq, join.getLeft(), join.getRight(), join.getJoinType())
- );
+ RelMdCollation.enumerableCorrelate(mq, join.getLeft(), join.getRight(),
+ join.getJoinType()));
}
public ImmutableList<RelCollation> collations(EnumerableSemiJoin join,
RelMetadataQuery mq) {
return ImmutableList.copyOf(
- RelMdCollation.enumerableSemiJoin(mq, join.getLeft(), join.getRight())
- );
+ RelMdCollation.enumerableSemiJoin(mq, join.getLeft(), join.getRight()));
}
public ImmutableList<RelCollation> collations(Sort sort,
diff --git a/core/src/main/java/org/apache/calcite/rel/rules/FilterProjectTransposeRule.java b/core/src/main/java/org/apache/calcite/rel/rules/FilterProjectTransposeRule.java
index c9b0fd3..4dc14dd 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/FilterProjectTransposeRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/FilterProjectTransposeRule.java
@@ -174,13 +174,13 @@ public class FilterProjectTransposeRule extends RelOptRule {
}
/**
- * Simplifies the filter condition using a simplifier created by the information in the
- * current call.
+ * Simplifies the filter condition using a simplifier created by the
+ * information in the current call.
*
- * The method is an attempt to replicate the simplification behavior of
- * {@link RelBuilder#filter(RexNode...)} which cannot be used in the case of copying nodes. The
- * main difference with the behavior of that method is that it does not drop entirely the filter
- * if the condition is always false.
+ * <p>This method is an attempt to replicate the simplification behavior of
+ * {@link RelBuilder#filter(RexNode...)} which cannot be used in the case of
+ * copying nodes. The main difference with the behavior of that method is that
+ * it does not drop entirely the filter if the condition is always false.
*/
private RexNode simplifyFilterCondition(RexNode condition, RelOptRuleCall call) {
final RexBuilder xBuilder = call.builder().getRexBuilder();
diff --git a/core/src/main/java/org/apache/calcite/rex/RexCall.java b/core/src/main/java/org/apache/calcite/rex/RexCall.java
index 40b38d6..509bab9 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexCall.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexCall.java
@@ -60,8 +60,9 @@ public class RexCall extends RexNode {
/**
* Simple binary operators are those operators which expects operands from the same Domain.
*
- * Example: simple comparisions (=,<)
- * Note: it doesn't contain IN because that is defined on D x D^n
+ * <p>Example: simple comparisions ({@code =}, {@code <}).
+ *
+ * <p>Note: it does not contain {@code IN} because that is defined on D x D^n.
*/
private static final Set<SqlKind> SIMPLE_BINARY_OPS;
diff --git a/core/src/main/java/org/apache/calcite/rex/RexSimplify.java b/core/src/main/java/org/apache/calcite/rex/RexSimplify.java
index ab68011..f6eecd4 100644
--- a/core/src/main/java/org/apache/calcite/rex/RexSimplify.java
+++ b/core/src/main/java/org/apache/calcite/rex/RexSimplify.java
@@ -2036,9 +2036,9 @@ public class RexSimplify {
}
}
- /** Represents a simple Comparision.
+ /** Represents a simple Comparison.
*
- * Left hand side is a {@link RexNode}, right hand side is a literal.
+ * <p>Left hand side is a {@link RexNode}, right hand side is a literal.
*/
private static class Comparison implements Predicate {
final RexNode ref;
diff --git a/core/src/main/java/org/apache/calcite/sql/fun/SqlJsonDepthFunction.java b/core/src/main/java/org/apache/calcite/sql/fun/SqlJsonDepthFunction.java
index 3c9b360..6b7e59b 100644
--- a/core/src/main/java/org/apache/calcite/sql/fun/SqlJsonDepthFunction.java
+++ b/core/src/main/java/org/apache/calcite/sql/fun/SqlJsonDepthFunction.java
@@ -31,18 +31,17 @@ import org.apache.calcite.sql.type.SqlOperandCountRanges;
import org.apache.calcite.sql.type.SqlOperandTypeChecker;
import org.apache.calcite.sql.validate.SqlValidator;
-
/**
* The <code>JSON_DEPTH</code> function.
*/
public class SqlJsonDepthFunction extends SqlFunction {
public SqlJsonDepthFunction() {
super("JSON_DEPTH",
- SqlKind.OTHER_FUNCTION,
- ReturnTypes.INTEGER_NULLABLE,
- null,
- OperandTypes.ANY,
- SqlFunctionCategory.SYSTEM);
+ SqlKind.OTHER_FUNCTION,
+ ReturnTypes.INTEGER_NULLABLE,
+ null,
+ OperandTypes.ANY,
+ SqlFunctionCategory.SYSTEM);
}
@Override public SqlOperandCountRange getOperandCountRange() {
@@ -50,17 +49,17 @@ public class SqlJsonDepthFunction extends SqlFunction {
}
@Override protected void checkOperandCount(SqlValidator validator,
- SqlOperandTypeChecker argType, SqlCall call) {
+ SqlOperandTypeChecker argType, SqlCall call) {
assert call.operandCount() == 1;
}
@Override public SqlCall createCall(SqlLiteral functionQualifier,
- SqlParserPos pos, SqlNode... operands) {
+ SqlParserPos pos, SqlNode... operands) {
return super.createCall(functionQualifier, pos, operands);
}
@Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec,
- int rightPrec) {
+ int rightPrec) {
super.unparse(writer, call, 0, 0);
}
}
diff --git a/core/src/main/java/org/apache/calcite/sql/fun/SqlJsonTypeFunction.java b/core/src/main/java/org/apache/calcite/sql/fun/SqlJsonTypeFunction.java
index 8ab3125..7917c58 100644
--- a/core/src/main/java/org/apache/calcite/sql/fun/SqlJsonTypeFunction.java
+++ b/core/src/main/java/org/apache/calcite/sql/fun/SqlJsonTypeFunction.java
@@ -32,18 +32,17 @@ import org.apache.calcite.sql.type.SqlOperandTypeChecker;
import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.calcite.sql.validate.SqlValidator;
-
/**
* The <code>JSON_TYPE</code> function.
*/
public class SqlJsonTypeFunction extends SqlFunction {
public SqlJsonTypeFunction() {
super("JSON_TYPE",
- SqlKind.OTHER_FUNCTION,
- ReturnTypes.explicit(SqlTypeName.VARCHAR, 20),
- null,
- OperandTypes.ANY,
- SqlFunctionCategory.SYSTEM);
+ SqlKind.OTHER_FUNCTION,
+ ReturnTypes.explicit(SqlTypeName.VARCHAR, 20),
+ null,
+ OperandTypes.ANY,
+ SqlFunctionCategory.SYSTEM);
}
@Override public SqlOperandCountRange getOperandCountRange() {
@@ -51,17 +50,17 @@ public class SqlJsonTypeFunction extends SqlFunction {
}
@Override protected void checkOperandCount(SqlValidator validator,
- SqlOperandTypeChecker argType, SqlCall call) {
+ SqlOperandTypeChecker argType, SqlCall call) {
assert call.operandCount() == 1;
}
@Override public SqlCall createCall(SqlLiteral functionQualifier,
- SqlParserPos pos, SqlNode... operands) {
+ SqlParserPos pos, SqlNode... operands) {
return super.createCall(functionQualifier, pos, operands);
}
@Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec,
- int rightPrec) {
+ int rightPrec) {
super.unparse(writer, call, 0, 0);
}
}
diff --git a/core/src/test/java/org/apache/calcite/plan/RelWriterTest.java b/core/src/test/java/org/apache/calcite/plan/RelWriterTest.java
index 76f7ba1..1cc182e 100644
--- a/core/src/test/java/org/apache/calcite/plan/RelWriterTest.java
+++ b/core/src/test/java/org/apache/calcite/plan/RelWriterTest.java
@@ -382,8 +382,7 @@ public class RelWriterTest {
rexBuilder.makeCall(
SqlWindow.FOLLOWING_OPERATOR,
rexBuilder.makeExactLiteral(BigDecimal.ONE))),
- false, true, false, false)
- ),
+ false, true, false, false)),
ImmutableList.of("field0", "field1", "field2"));
final RelJsonWriter writer = new RelJsonWriter();
project.explain(writer);
@@ -392,7 +391,6 @@ public class RelWriterTest {
assertThat(s, is(XX2));
}
-
/**
* Unit test for {@link org.apache.calcite.rel.externalize.RelJsonReader}.
*/
diff --git a/core/src/test/java/org/apache/calcite/rel/rules/SortRemoveRuleTest.java b/core/src/test/java/org/apache/calcite/rel/rules/SortRemoveRuleTest.java
index a8c430b..00778b9 100644
--- a/core/src/test/java/org/apache/calcite/rel/rules/SortRemoveRuleTest.java
+++ b/core/src/test/java/org/apache/calcite/rel/rules/SortRemoveRuleTest.java
@@ -83,8 +83,8 @@ public final class SortRemoveRuleTest {
* <a href="https://issues.apache.org/jira/browse/CALCITE-2554">[CALCITE-2554]
* Enrich enumerable join operators with order preserving information</a>.
*
- * Since join inputs are sorted, and this join preserves the order of the left input, there
- * shouldn't be any sort operator above the join.
+ * <p>Since join inputs are sorted, and this join preserves the order of the
+ * left input, there shouldn't be any sort operator above the join.
*/
@Test public void removeSortOverEnumerableJoin() throws Exception {
RuleSet prepareRules =
@@ -114,8 +114,8 @@ public final class SortRemoveRuleTest {
* <a href="https://issues.apache.org/jira/browse/CALCITE-2554">[CALCITE-2554]
* Enrich enumerable join operators with order preserving information</a>.
*
- * Since join inputs are sorted, and this join preserves the order of the left input, there
- * shouldn't be any sort operator above the join.
+ * <p>Since join inputs are sorted, and this join preserves the order of the
+ * left input, there shouldn't be any sort operator above the join.
*/
@Test public void removeSortOverEnumerableThetaJoin() throws Exception {
RuleSet prepareRules =
@@ -146,8 +146,8 @@ public final class SortRemoveRuleTest {
* <a href="https://issues.apache.org/jira/browse/CALCITE-2554">[CALCITE-2554]
* Enrich enumerable join operators with order preserving information</a>.
*
- * Since join inputs are sorted, and this join preserves the order of the left input, there
- * shouldn't be any sort operator above the join.
+ * <p>Since join inputs are sorted, and this join preserves the order of the
+ * left input, there shouldn't be any sort operator above the join.
*/
@Test public void removeSortOverEnumerableCorrelate() throws Exception {
RuleSet prepareRules =
@@ -178,8 +178,8 @@ public final class SortRemoveRuleTest {
* <a href="https://issues.apache.org/jira/browse/CALCITE-2554">[CALCITE-2554]
* Enrich enumerable join operators with order preserving information</a>.
*
- * Since join inputs are sorted, and this join preserves the order of the left input, there
- * shouldn't be any sort operator above the join.
+ * <p>Since join inputs are sorted, and this join preserves the order of the
+ * left input, there shouldn't be any sort operator above the join.
*/
@Test public void removeSortOverEnumerableSemiJoin() throws Exception {
RuleSet prepareRules =
@@ -209,6 +209,6 @@ public final class SortRemoveRuleTest {
RelOptUtil.dumpPlan("", rel, SqlExplainFormat.TEXT,
SqlExplainLevel.DIGEST_ATTRIBUTES));
}
-
}
+
// End SortRemoveRuleTest.java
diff --git a/core/src/test/java/org/apache/calcite/schemas/HrClusteredSchema.java b/core/src/test/java/org/apache/calcite/schemas/HrClusteredSchema.java
index e405d44..c559a9c 100644
--- a/core/src/test/java/org/apache/calcite/schemas/HrClusteredSchema.java
+++ b/core/src/test/java/org/apache/calcite/schemas/HrClusteredSchema.java
@@ -66,8 +66,7 @@ public final class HrClusteredSchema extends AbstractSchema {
new Object[]{100, 10, "Bill", 10000, 1000},
new Object[]{110, 10, "Theodore", 11500, 250},
new Object[]{150, 10, "Sebastian", 7000, null},
- new Object[]{200, 20, "Eric", 8000, 500})
- ))
+ new Object[]{200, 20, "Eric", 8000, 500})))
.put("depts",
new PkClusteredTable(
factory ->
@@ -79,8 +78,8 @@ public final class HrClusteredSchema extends AbstractSchema {
Arrays.asList(
new Object[]{10, "Sales"},
new Object[]{30, "Marketing"},
- new Object[]{40, "HR"})
- )).build();
+ new Object[]{40, "HR"})))
+ .build();
}
@Override protected Map<String, Table> getTableMap() {
@@ -127,4 +126,5 @@ public final class HrClusteredSchema extends AbstractSchema {
}
}
+
// End HrClusteredSchema.java
diff --git a/core/src/test/java/org/apache/calcite/test/CalciteSuite.java b/core/src/test/java/org/apache/calcite/test/CalciteSuite.java
index 20f3770..7fa5699 100644
--- a/core/src/test/java/org/apache/calcite/test/CalciteSuite.java
+++ b/core/src/test/java/org/apache/calcite/test/CalciteSuite.java
@@ -34,6 +34,7 @@ import org.apache.calcite.prepare.LookupOperatorOverloadsTest;
import org.apache.calcite.profile.ProfilerTest;
import org.apache.calcite.rel.RelCollationTest;
import org.apache.calcite.rel.RelDistributionTest;
+import org.apache.calcite.rel.rel2sql.RelToSqlConverterStructsTest;
import org.apache.calcite.rel.rel2sql.RelToSqlConverterTest;
import org.apache.calcite.rel.rules.DateRangeRulesTest;
import org.apache.calcite.rel.rules.SortRemoveRuleTest;
@@ -146,6 +147,7 @@ import org.junit.runners.Suite;
SqlLimitsTest.class,
JdbcFrontLinqBackTest.class,
RelToSqlConverterTest.class,
+ RelToSqlConverterStructsTest.class,
SqlOperatorTest.class,
ChunkListTest.class,
FrameworksTest.class,
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 7581d97..813d7e0 100644
--- a/core/src/test/java/org/apache/calcite/test/RexProgramTest.java
+++ b/core/src/test/java/org/apache/calcite/test/RexProgramTest.java
@@ -1743,9 +1743,7 @@ public class RexProgramTest extends RexProgramBuilderBase {
ge(vInt(), literal(1)),
le(vInt(), literal(1))))),
"AND(=(?0.int2, 2), OR(=(?0.int3, 3), AND(>=(?0.int0, 1), <=(?0.int0, 1))))",
- "AND(=(?0.int2, 2), OR(=(?0.int3, 3), =(?0.int0, 1)))"
-
- );
+ "AND(=(?0.int2, 2), OR(=(?0.int3, 3), =(?0.int0, 1)))");
}
@Test public void fieldAccessEqualsHashCode() {
@@ -2570,16 +2568,14 @@ public class RexProgramTest extends RexProgramBuilderBase {
checkSimplify2(
isTrue(isTrue(vBool())),
"IS TRUE(?0.bool0)",
- "?0.bool0"
- );
+ "?0.bool0");
}
@Test public void testRedundantIsFalse() {
checkSimplify2(
isTrue(isFalse(vBool())),
"IS FALSE(?0.bool0)",
- "NOT(?0.bool0)"
- );
+ "NOT(?0.bool0)");
}
@Test public void testRedundantIsNotTrue() {
@@ -2587,8 +2583,7 @@ public class RexProgramTest extends RexProgramBuilderBase {
isNotFalse(isNotTrue(vBool())),
"IS NOT TRUE(?0.bool0)",
"IS NOT TRUE(?0.bool0)",
- "NOT(?0.bool0)"
- );
+ "NOT(?0.bool0)");
}
@Test public void testRedundantIsNotFalse() {
@@ -2596,8 +2591,7 @@ public class RexProgramTest extends RexProgramBuilderBase {
isNotFalse(isNotFalse(vBool())),
"IS NOT FALSE(?0.bool0)",
"IS NOT FALSE(?0.bool0)",
- "?0.bool0"
- );
+ "?0.bool0");
}
/** Unit tests for
@@ -2681,4 +2675,5 @@ public class RexProgramTest extends RexProgramBuilderBase {
}
}
+
// End RexProgramTest.java
diff --git a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
index d3b3f73..bb322d6 100644
--- a/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
+++ b/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
@@ -128,7 +128,7 @@ public class SqlToRelConverterTest extends SqlToRelTestBase {
* struct type alias should not cause IOOBE.</a>.
*/
@Test public void testStructTypeAlias() {
- final String sql = "select t.r AS myRow \n"
+ final String sql = "select t.r AS myRow\n"
+ "from (select row(row(1)) r from dept) t";
sql(sql).ok();
}
diff --git a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
index 23367d9..53d62d8 100644
--- a/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
+++ b/core/src/test/resources/org/apache/calcite/test/SqlToRelConverterTest.xml
@@ -1461,7 +1461,7 @@ LogicalProject(A=[$0], B=[$1], C=[$2], DEPTNO=[$3], NAME=[$4])
</TestCase>
<TestCase name="testStructTypeAlias">
<Resource name="sql">
- <![CDATA[select t.r AS myRow
+ <![CDATA[select t.r AS myRow
from (select row(row(1)) r from dept) t]]>
</Resource>
<Resource name="plan">
diff --git a/core/src/test/resources/sql/sub-query.iq b/core/src/test/resources/sql/sub-query.iq
index 3282fd0..e0533a9 100644
--- a/core/src/test/resources/sql/sub-query.iq
+++ b/core/src/test/resources/sql/sub-query.iq
@@ -1977,7 +1977,7 @@ from "scott".emp;
!ok
-# Test nested subquery in PROJECT within FILTER
+# Test nested sub-query in PROJECT within FILTER
select * from emp where deptno IN (select (select max(deptno) from "scott".emp t1) from "scott".emp t2);
EMPNO | ENAME | JOB | MGR | HIREDATE | SAL | COMM | DEPTNO
-------+--------+----------+------+------------+---------+---------+--------
@@ -1999,7 +1999,7 @@ EnumerableSemiJoin(condition=[=($7, $9)], joinType=[inner])
EnumerableTableScan(table=[[scott, EMP]])
!plan
-# Test nested subquery in FILTER within PROJECT
+# Test nested sub-query in FILTER within PROJECT
select (select max(deptno) from "scott".emp where deptno IN (select deptno from "scott".emp)) from emp ;
EXPR$0
--------
diff --git a/elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/ElasticSearchAdapterTest.java b/elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/ElasticSearchAdapterTest.java
index 8ffdcff..0c028e2 100644
--- a/elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/ElasticSearchAdapterTest.java
+++ b/elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/ElasticSearchAdapterTest.java
@@ -266,7 +266,8 @@ public class ElasticSearchAdapterTest {
/**
* Sorting (and aggregating) directly on items without a view.
*
- * Queries of type: {@code select _MAP['a'] from elastic order by _MAP['b']}
+ * <p>Queries of type:
+ * {@code select _MAP['a'] from elastic order by _MAP['b']}
*/
@Test public void testSortNoSchema() {
CalciteAssert.that()
diff --git a/elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/Projection2Test.java b/elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/Projection2Test.java
index 05a17d1..881bb81 100644
--- a/elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/Projection2Test.java
+++ b/elasticsearch/src/test/java/org/apache/calcite/adapter/elasticsearch/Projection2Test.java
@@ -181,14 +181,14 @@ public class Projection2Test {
// _id field not available implicitly
factory
.query(
- String.format(Locale.ROOT, "select * from \"elastic\".\"%s\"", NAME)
- )
+ String.format(Locale.ROOT, "select * from \"elastic\".\"%s\"",
+ NAME))
.returns(regexMatch("_MAP={a=1, b={a=2, b=3, c={a=foo}}}"));
factory
.query(
- String.format(Locale.ROOT, "select *, _MAP['_id'] from \"elastic\".\"%s\"", NAME)
- )
+ String.format(Locale.ROOT,
+ "select *, _MAP['_id'] from \"elastic\".\"%s\"", NAME))
.returns(regexMatch("_MAP={a=1, b={a=2, b=3, c={a=foo}}}; EXPR$1=\\p{Graph}+"));
}
diff --git a/linq4j/src/test/java/org/apache/calcite/linq4j/test/JoinPreserveOrderTest.java b/linq4j/src/test/java/org/apache/calcite/linq4j/test/JoinPreserveOrderTest.java
index f399a30..ec65be3 100644
--- a/linq4j/src/test/java/org/apache/calcite/linq4j/test/JoinPreserveOrderTest.java
+++ b/linq4j/src/test/java/org/apache/calcite/linq4j/test/JoinPreserveOrderTest.java
@@ -38,26 +38,25 @@ import java.util.List;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-
-
/**
* Test validating the order preserving properties of join algorithms in
- * {@link org.apache.calcite.linq4j.ExtendedEnumerable}. The correctness of the join algorithm is
- * not examined by this set of tests.
+ * {@link org.apache.calcite.linq4j.ExtendedEnumerable}. The correctness of the
+ * join algorithm is not examined by this set of tests.
*
- * To verify that the order of left/right/both input(s) is preserved they must be all ordered by at
- * least one column. The inputs are either sorted on the join or some other column. For the tests to
- * be meaningful the result of the join must not be empty.
+ * <p>To verify that the order of left/right/both input(s) is preserved they
+ * must be all ordered by at least one column. The inputs are either sorted on
+ * the join or some other column. For the tests to be meaningful the result of
+ * the join must not be empty.
*
- * Interesting variants that may affect the join output and thus destroy the order of one or both
- * inputs is when the join column or the sorted column (when join column != sort column)
- * contain nulls or duplicate values.
+ * <p>Interesting variants that may affect the join output and thus destroy the
+ * order of one or both inputs is when the join column or the sorted column
+ * (when join column != sort column) contain nulls or duplicate values.
*
- * In addition, the way that nulls are sorted before the join can also play an important role
- * regarding the order preserving semantics of the join.
+ * <p>In addition, the way that nulls are sorted before the join can also play
+ * an important role regarding the order preserving semantics of the join.
*
- * Last but not least, the type of the join (left/right/full/inner/semi/anti) has a major impact on
- * the preservation of order for the various joins.
+ * <p>Last but not least, the type of the join (left/right/full/inner/semi/anti)
+ * has a major impact on the preservation of order for the various joins.
*/
@RunWith(Parameterized.class)
public final class JoinPreserveOrderTest {
@@ -143,8 +142,7 @@ public final class JoinPreserveOrderTest {
deptOrderColNames.get(j),
deptOrderColSelectors.get(j),
ascendingR,
- nullsFirstR
- );
+ nullsFirstR);
data.add(params);
}
}
@@ -239,8 +237,9 @@ public final class JoinPreserveOrderTest {
left.correlateJoin(
joinType,
emp -> right.where(dept ->
- emp.deptno != null && dept.deptno != null && emp.deptno.equals(dept.deptno)
- ),
+ emp.deptno != null
+ && dept.deptno != null
+ && emp.deptno.equals(dept.deptno)),
RESULT_SELECTOR);
}
@@ -277,8 +276,7 @@ public final class JoinPreserveOrderTest {
left,
right,
emp -> emp.deptno,
- dept -> dept.deptno).select(emp -> Arrays.asList(emp.eid, null)
- );
+ dept -> dept.deptno).select(emp -> Arrays.asList(emp.eid, null));
}
/**
diff --git a/piglet/pom.xml b/piglet/pom.xml
index 8f93cc0..c26d0a2 100644
--- a/piglet/pom.xml
+++ b/piglet/pom.xml
@@ -60,12 +60,6 @@ limitations under the License.
<artifactId>guava</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.calcite</groupId>
- <artifactId>calcite-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
diff --git a/site/_docs/elasticsearch_adapter.md b/site/_docs/elasticsearch_adapter.md
index b9bab31..45f2bed 100644
--- a/site/_docs/elasticsearch_adapter.md
+++ b/site/_docs/elasticsearch_adapter.md
@@ -75,7 +75,7 @@ For example, in the example dataset there is an Elasticsearch type
named `zips` under index named `usa`.
We can issue a simple query to fetch the names of all the states
-stored in the type `zips`.
+stored in the type `zips`.
{% highlight sql %}
sqlline> SELECT * from "zips";
@@ -137,12 +137,14 @@ sqlline> SELECT _MAP['city'], _MAP['state'] from "elasticsearch"."zips" order by
{% endhighlight %}
### Use of Scrolling API
-For queries without aggregate functions (like `COUNT`, `MAX` etc.) elastic adapter
-uses [scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html), by default.
+
+For queries without aggregate functions (like `COUNT`, `MAX` etc.) elastic adapter
+uses [scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html), by default.
This ensures that consistent and full data-set is returned to end user (lazily and in batches). Please note that
scroll is automatically cleared (removed) when all query resuts are consumed.
### Supported versions
+
Currently this adapter supports ElasticSearch versions 2.x (or newer). Generally
we try to follow official [support schedule](https://www.elastic.co/support/eol).
diff --git a/site/develop/index.md b/site/develop/index.md
index 2d863e3..c708978 100644
--- a/site/develop/index.md
+++ b/site/develop/index.md
@@ -83,7 +83,7 @@ If your change had multiple commits, use `git rebase -i master` to
squash them into a single commit, and to bring your code up to date
with the latest on the main line.
-In order to keep the commit history clean and uniform, you should
+In order to keep the commit history clean and uniform, you should
respect the following guidelines.
* Read the messages of previous commits, and follow their style.
* The first line of the commit message must be a concise and useful
diff --git a/src/main/config/checkstyle/suppressions.xml b/src/main/config/checkstyle/suppressions.xml
index e52159d..3cff4a9 100644
--- a/src/main/config/checkstyle/suppressions.xml
+++ b/src/main/config/checkstyle/suppressions.xml
@@ -46,6 +46,7 @@ limitations under the License.
<!-- And likewise in ubenchmark -->
<suppress checks="JavadocPackage" files="StatementTest.java"/>
+ <suppress checks="JavadocPackage" files="CodeGenerationBenchmark.java"/>
<!-- Method names in Resource can have underscores -->
<suppress checks="MethodName" files="CalciteResource.java"/>
diff --git a/ubenchmark/src/main/java/org/apache/calcite/adapter/enumerable/CodeGenerationBenchmark.java b/ubenchmark/src/main/java/org/apache/calcite/adapter/enumerable/CodeGenerationBenchmark.java
index 4c32cde..22d7aac 100644
--- a/ubenchmark/src/main/java/org/apache/calcite/adapter/enumerable/CodeGenerationBenchmark.java
+++ b/ubenchmark/src/main/java/org/apache/calcite/adapter/enumerable/CodeGenerationBenchmark.java
@@ -37,7 +37,6 @@ import org.apache.calcite.runtime.Typed;
import org.apache.calcite.runtime.Utilities;
import org.apache.calcite.tools.RelBuilder;
-
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
@@ -70,11 +69,11 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
/**
- * A benchmark of the main methods that are dynamically
- * generating and compiling Java code at runtime.
+ * A benchmark of the main methods that are dynamically generating and compiling
+ * Java code at runtime.
*
- * The benchmark examines the behavior of existing methods
- * and evaluates the potential of adding a caching layer on top.
+ * <p>The benchmark examines the behavior of existing methods and evaluates the
+ * potential of adding a caching layer on top.
*/
@Fork(value = 1, jvmArgsPrepend = "-Xmx1024m")
@Measurement(iterations = 10, time = 1)
@@ -262,8 +261,8 @@ public class CodeGenerationBenchmark {
PlanInfo info = jState.planInfos[jState.nextPlan()];
Cache<String, Bindable> cache = chState.cache;
- EnumerableInterpretable.StaticFieldDetector detector
- = new EnumerableInterpretable.StaticFieldDetector();
+ EnumerableInterpretable.StaticFieldDetector detector =
+ new EnumerableInterpretable.StaticFieldDetector();
info.classExpr.accept(detector);
if (!detector.containsStaticField) {
return cache.get(
diff --git a/ubenchmark/src/main/java/org/apache/calcite/adapter/enumerable/package-info.java b/ubenchmark/src/main/java/org/apache/calcite/adapter/enumerable/package-info.java
deleted file mode 100644
index 061c3f4..0000000
--- a/ubenchmark/src/main/java/org/apache/calcite/adapter/enumerable/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * JMH benchmarks for Calcite Enumerable adapter
- */
-@PackageMarker
-package org.apache.calcite.adapter.enumerable;
-
-import org.apache.calcite.avatica.util.PackageMarker;
-
-// End package-info.java
diff --git a/ubenchmark/src/main/java/org/apache/calcite/benchmarks/StringConstructBenchmark.java b/ubenchmark/src/main/java/org/apache/calcite/benchmarks/StringConstructBenchmark.java
index c340dbb..f327cc7 100644
--- a/ubenchmark/src/main/java/org/apache/calcite/benchmarks/StringConstructBenchmark.java
+++ b/ubenchmark/src/main/java/org/apache/calcite/benchmarks/StringConstructBenchmark.java
@@ -16,7 +16,6 @@
*/
package org.apache.calcite.benchmarks;
-
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
@@ -36,7 +35,6 @@ import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
-
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
@@ -44,9 +42,11 @@ import java.io.Writer;
import java.util.concurrent.TimeUnit;
/**
- * A benchmark of the most common patterns that are used to construct gradually String objects.
+ * A benchmark of the most common patterns that are used to construct gradually
+ * String objects.
*
- * The benchmark emphasizes on the build patterns that appear in the Calcite project.
+ * <p>The benchmark emphasizes on the build patterns that appear in the Calcite
+ * project.
*/
@Fork(value = 1, jvmArgsPrepend = "-Xmx2048m")
@Measurement(iterations = 10, time = 100, timeUnit = TimeUnit.MILLISECONDS)
@@ -85,8 +85,9 @@ public class StringConstructBenchmark {
/**
* The maximum number of appends before resetting the appender.
*
- * If the value is small then the appender is reinitialized very often, making the instantiation
- * of the appender the dominant operation of the benchmark.
+ * <p>If the value is small then the appender is reinitialized very often,
+ * making the instantiation of the appender the dominant operation of the
+ * benchmark.
*/
@Param({"1", "256", "512", "1024"})
public int maxAppends;