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 2014/11/14 22:32:36 UTC
[28/58] [abbrv] [partial] incubator-calcite git commit: [CALCITE-306]
Standardize code style for "import package.*; "
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/ScannableTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/ScannableTable.java b/core/src/main/java/org/apache/calcite/schema/ScannableTable.java
index af76df9..908d745 100644
--- a/core/src/main/java/org/apache/calcite/schema/ScannableTable.java
+++ b/core/src/main/java/org/apache/calcite/schema/ScannableTable.java
@@ -14,9 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
-import net.hydromatic.linq4j.Enumerable;
+import org.apache.calcite.DataContext;
+import org.apache.calcite.linq4j.Enumerable;
/**
* Table that can be scanned without creating an intermediate relational
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/Schema.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/Schema.java b/core/src/main/java/org/apache/calcite/schema/Schema.java
index 1ed8743..0c46117 100644
--- a/core/src/main/java/org/apache/calcite/schema/Schema.java
+++ b/core/src/main/java/org/apache/calcite/schema/Schema.java
@@ -14,11 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
-import net.hydromatic.linq4j.expressions.Expression;
+import org.apache.calcite.linq4j.tree.Expression;
-import java.util.*;
+import java.util.Collection;
+import java.util.Set;
/**
* A namespace for tables and functions.
@@ -32,7 +33,7 @@ import java.util.*;
* different numbers or types of parameters.
* For this reason, {@link #getFunctions} returns a list of all
* members with the same name. Calcite will call
- * {@link Schemas#resolve(org.eigenbase.reltype.RelDataTypeFactory, String, java.util.Collection, java.util.List)}
+ * {@link Schemas#resolve(org.apache.calcite.rel.type.RelDataTypeFactory, String, java.util.Collection, java.util.List)}
* to choose the appropriate one.</p>
*
* <p>The most common and important type of member is the one with no
@@ -112,7 +113,7 @@ public interface Schema {
* caching is enabled, Calcite will re-build caches.
*
* <p>The default implementation in
- * {@link net.hydromatic.optiq.impl.AbstractSchema} always returns
+ * {@link org.apache.calcite.schema.impl.AbstractSchema} always returns
* {@code false}.</p>
*
* <p>To control whether Calcite caches the contents of a schema, use the
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java b/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java
index 34622b5..b2a78b2 100644
--- a/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java
+++ b/core/src/main/java/org/apache/calcite/schema/SchemaFactory.java
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
import java.util.Map;
/**
- * Factory for {@link net.hydromatic.optiq.Schema} objects.
+ * Factory for {@link Schema} objects.
*
* <p>A schema factory allows you to include a custom schema in a model file.
* For example, here is a model that contains a custom schema whose tables
@@ -35,7 +35,7 @@ import java.util.Map;
* {
* name: 'SALES',
* type: 'custom',
- * factory: 'net.hydromatic.optiq.impl.csv.CsvSchemaFactory',
+ * factory: 'org.apache.calcite.adapter.csv.CsvSchemaFactory',
* mutable: true,
* operand: {
* directory: 'target/test-classes/sales'
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/SchemaPlus.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/SchemaPlus.java b/core/src/main/java/org/apache/calcite/schema/SchemaPlus.java
index 663974b..58b0d52 100644
--- a/core/src/main/java/org/apache/calcite/schema/SchemaPlus.java
+++ b/core/src/main/java/org/apache/calcite/schema/SchemaPlus.java
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
-import net.hydromatic.optiq.materialize.Lattice;
+import org.apache.calcite.materialize.Lattice;
import com.google.common.collect.ImmutableList;
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/Schemas.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/Schemas.java b/core/src/main/java/org/apache/calcite/schema/Schemas.java
index 00233d7..42df429 100644
--- a/core/src/main/java/org/apache/calcite/schema/Schemas.java
+++ b/core/src/main/java/org/apache/calcite/schema/Schemas.java
@@ -14,55 +14,71 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
-
-import net.hydromatic.linq4j.Enumerable;
-import net.hydromatic.linq4j.QueryProvider;
-import net.hydromatic.linq4j.Queryable;
-import net.hydromatic.linq4j.expressions.*;
-
-import net.hydromatic.optiq.config.OptiqConnectionConfig;
-import net.hydromatic.optiq.config.OptiqConnectionConfigImpl;
-import net.hydromatic.optiq.config.OptiqConnectionProperty;
-import net.hydromatic.optiq.impl.java.JavaTypeFactory;
-import net.hydromatic.optiq.jdbc.*;
-import net.hydromatic.optiq.materialize.Lattice;
-
-import org.eigenbase.reltype.RelDataType;
-import org.eigenbase.reltype.RelDataTypeFactory;
-import org.eigenbase.reltype.RelProtoDataType;
-import org.eigenbase.rex.RexNode;
-import org.eigenbase.sql.type.SqlTypeUtil;
+package org.apache.calcite.schema;
+
+import org.apache.calcite.DataContext;
+import org.apache.calcite.adapter.java.JavaTypeFactory;
+import org.apache.calcite.config.CalciteConnectionConfig;
+import org.apache.calcite.config.CalciteConnectionConfigImpl;
+import org.apache.calcite.config.CalciteConnectionProperty;
+import org.apache.calcite.jdbc.CalciteConnection;
+import org.apache.calcite.jdbc.CalcitePrepare;
+import org.apache.calcite.jdbc.CalciteRootSchema;
+import org.apache.calcite.jdbc.CalciteSchema;
+import org.apache.calcite.linq4j.Enumerable;
+import org.apache.calcite.linq4j.QueryProvider;
+import org.apache.calcite.linq4j.Queryable;
+import org.apache.calcite.linq4j.tree.Expression;
+import org.apache.calcite.linq4j.tree.Expressions;
+import org.apache.calcite.linq4j.tree.MethodCallExpression;
+import org.apache.calcite.linq4j.tree.Types;
+import org.apache.calcite.materialize.Lattice;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.rel.type.RelProtoDataType;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.sql.type.SqlTypeUtil;
+import org.apache.calcite.util.BuiltInMethod;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
-import java.lang.reflect.*;
+import java.lang.reflect.Type;
import java.sql.Connection;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
/**
* Utility functions for schemas.
*/
public final class Schemas {
- private static final com.google.common.base.Function<OptiqSchema.LatticeEntry,
- OptiqSchema.TableEntry> TO_TABLE_ENTRY =
- new com.google.common.base.Function<OptiqSchema.LatticeEntry,
- OptiqSchema.TableEntry>() {
- public OptiqSchema.TableEntry apply(OptiqSchema.LatticeEntry entry) {
- final OptiqSchema.TableEntry starTable = entry.getStarTable();
+ private static final com.google.common.base.Function<
+ CalciteSchema.LatticeEntry,
+ CalciteSchema.TableEntry> TO_TABLE_ENTRY =
+ new com.google.common.base.Function<CalciteSchema.LatticeEntry,
+ CalciteSchema.TableEntry>() {
+ public CalciteSchema.TableEntry apply(
+ CalciteSchema.LatticeEntry entry) {
+ final CalciteSchema.TableEntry starTable = entry.getStarTable();
assert starTable.getTable().getJdbcTableType()
== Schema.TableType.STAR;
return entry.getStarTable();
}
};
- private static final com.google.common.base.Function<OptiqSchema.LatticeEntry,
+ private static final com.google.common.base.Function<
+ CalciteSchema.LatticeEntry,
Lattice> TO_LATTICE =
- new com.google.common.base.Function<OptiqSchema.LatticeEntry, Lattice>() {
- public Lattice apply(OptiqSchema.LatticeEntry entry) {
+ new com.google.common.base.Function<CalciteSchema.LatticeEntry,
+ Lattice>() {
+ public Lattice apply(CalciteSchema.LatticeEntry entry) {
return entry.getLattice();
}
};
@@ -71,14 +87,14 @@ public final class Schemas {
throw new AssertionError("no instances!");
}
- public static OptiqSchema.FunctionEntry resolve(
+ public static CalciteSchema.FunctionEntry resolve(
RelDataTypeFactory typeFactory,
String name,
- Collection<OptiqSchema.FunctionEntry> functionEntries,
+ Collection<CalciteSchema.FunctionEntry> functionEntries,
List<RelDataType> argumentTypes) {
- final List<OptiqSchema.FunctionEntry> matches =
- new ArrayList<OptiqSchema.FunctionEntry>();
- for (OptiqSchema.FunctionEntry entry : functionEntries) {
+ final List<CalciteSchema.FunctionEntry> matches =
+ new ArrayList<CalciteSchema.FunctionEntry>();
+ for (CalciteSchema.FunctionEntry entry : functionEntries) {
if (matches(typeFactory, entry.getFunction(), argumentTypes)) {
matches.add(entry);
}
@@ -89,8 +105,7 @@ public final class Schemas {
case 1:
return matches.get(0);
default:
- throw new RuntimeException(
- "More than one match for " + name
+ throw new RuntimeException("More than one match for " + name
+ " with arguments " + argumentTypes);
}
}
@@ -128,7 +143,7 @@ public final class Schemas {
Expression call =
Expressions.call(
schemaExpression,
- BuiltinMethod.SCHEMA_GET_SUB_SCHEMA.method,
+ BuiltInMethod.SCHEMA_GET_SUB_SCHEMA.method,
Expressions.constant(name));
//CHECKSTYLE: IGNORE 2
//noinspection unchecked
@@ -139,10 +154,10 @@ public final class Schemas {
}
/** Converts a schema expression to a given type by calling the
- * {@link net.hydromatic.optiq.SchemaPlus#unwrap(Class)} method. */
+ * {@link SchemaPlus#unwrap(Class)} method. */
public static Expression unwrap(Expression call, Class type) {
return Expressions.convert_(
- Expressions.call(call, BuiltinMethod.SCHEMA_PLUS_UNWRAP.method,
+ Expressions.call(call, BuiltInMethod.SCHEMA_PLUS_UNWRAP.method,
Expressions.constant(type)),
type);
}
@@ -154,23 +169,23 @@ public final class Schemas {
if (Table.class.isAssignableFrom(clazz)) {
expression = Expressions.call(
expression(schema),
- BuiltinMethod.SCHEMA_GET_TABLE.method,
+ BuiltInMethod.SCHEMA_GET_TABLE.method,
Expressions.constant(tableName));
if (ScannableTable.class.isAssignableFrom(clazz)) {
return Expressions.call(
- BuiltinMethod.SCHEMAS_ENUMERABLE.method,
+ BuiltInMethod.SCHEMAS_ENUMERABLE.method,
Expressions.convert_(expression, ScannableTable.class),
DataContext.ROOT);
}
if (FilterableTable.class.isAssignableFrom(clazz)) {
return Expressions.call(
- BuiltinMethod.SCHEMAS_ENUMERABLE2.method,
+ BuiltInMethod.SCHEMAS_ENUMERABLE2.method,
Expressions.convert_(expression, FilterableTable.class),
DataContext.ROOT);
}
} else {
expression = Expressions.call(
- BuiltinMethod.SCHEMAS_QUERYABLE.method,
+ BuiltInMethod.SCHEMAS_QUERYABLE.method,
DataContext.ROOT,
expression(schema),
Expressions.constant(elementType),
@@ -180,7 +195,7 @@ public final class Schemas {
}
public static DataContext createDataContext(Connection connection) {
- return new DummyDataContext((OptiqConnection) connection);
+ return new DummyDataContext((CalciteConnection) connection);
}
/** Returns a {@link Queryable}, given a fully-qualified table name. */
@@ -211,14 +226,14 @@ public final class Schemas {
return table.asQueryable(root.getQueryProvider(), schema, tableName);
}
- /** Returns an {@link net.hydromatic.linq4j.Enumerable} over the rows of
+ /** Returns an {@link org.apache.calcite.linq4j.Enumerable} over the rows of
* a given table, representing each row as an object array. */
public static Enumerable<Object[]> enumerable(final ScannableTable table,
final DataContext root) {
return table.scan(root);
}
- /** Returns an {@link net.hydromatic.linq4j.Enumerable} over the rows of
+ /** Returns an {@link org.apache.calcite.linq4j.Enumerable} over the rows of
* a given table, not applying any filters, representing each row as an object
* array. */
public static Enumerable<Object[]> enumerable(final FilterableTable table,
@@ -226,8 +241,8 @@ public final class Schemas {
return table.scan(root, ImmutableList.<RexNode>of());
}
- /** Returns an {@link net.hydromatic.linq4j.Enumerable} over object arrays,
- * given a fully-qualified table name which leads to a
+ /** Returns an {@link org.apache.calcite.linq4j.Enumerable} over object
+ * arrays, given a fully-qualified table name which leads to a
* {@link ScannableTable}. */
public static Table table(DataContext root, String... names) {
SchemaPlus schema = root.getRootSchema();
@@ -243,93 +258,94 @@ public final class Schemas {
}
/** Parses and validates a SQL query. For use within Calcite only. */
- public static OptiqPrepare.ParseResult parse(
- final OptiqConnection connection, final OptiqSchema schema,
+ public static CalcitePrepare.ParseResult parse(
+ final CalciteConnection connection, final CalciteSchema schema,
final List<String> schemaPath, final String sql) {
- final OptiqPrepare prepare = OptiqPrepare.DEFAULT_FACTORY.apply();
- final OptiqPrepare.Context context =
+ final CalcitePrepare prepare = CalcitePrepare.DEFAULT_FACTORY.apply();
+ final CalcitePrepare.Context context =
makeContext(connection, schema, schemaPath,
- ImmutableMap.<OptiqConnectionProperty, String>of());
- OptiqPrepare.Dummy.push(context);
+ ImmutableMap.<CalciteConnectionProperty, String>of());
+ CalcitePrepare.Dummy.push(context);
try {
return prepare.parse(context, sql);
} finally {
- OptiqPrepare.Dummy.pop(context);
+ CalcitePrepare.Dummy.pop(context);
}
}
/** Parses and validates a SQL query and converts to relational algebra. For
* use within Calcite only. */
- public static OptiqPrepare.ConvertResult convert(
- final OptiqConnection connection, final OptiqSchema schema,
+ public static CalcitePrepare.ConvertResult convert(
+ final CalciteConnection connection, final CalciteSchema schema,
final List<String> schemaPath, final String sql) {
- final OptiqPrepare prepare = OptiqPrepare.DEFAULT_FACTORY.apply();
- final OptiqPrepare.Context context =
+ final CalcitePrepare prepare = CalcitePrepare.DEFAULT_FACTORY.apply();
+ final CalcitePrepare.Context context =
makeContext(connection, schema, schemaPath,
- ImmutableMap.<OptiqConnectionProperty, String>of());
- OptiqPrepare.Dummy.push(context);
+ ImmutableMap.<CalciteConnectionProperty, String>of());
+ CalcitePrepare.Dummy.push(context);
try {
return prepare.convert(context, sql);
} finally {
- OptiqPrepare.Dummy.pop(context);
+ CalcitePrepare.Dummy.pop(context);
}
}
/** Prepares a SQL query for execution. For use within Calcite only. */
- public static OptiqPrepare.PrepareResult<Object> prepare(
- final OptiqConnection connection, final OptiqSchema schema,
+ public static CalcitePrepare.PrepareResult<Object> prepare(
+ final CalciteConnection connection, final CalciteSchema schema,
final List<String> schemaPath, final String sql,
- final ImmutableMap<OptiqConnectionProperty, String> map) {
- final OptiqPrepare prepare = OptiqPrepare.DEFAULT_FACTORY.apply();
- final OptiqPrepare.Context context =
+ final ImmutableMap<CalciteConnectionProperty, String> map) {
+ final CalcitePrepare prepare = CalcitePrepare.DEFAULT_FACTORY.apply();
+ final CalcitePrepare.Context context =
makeContext(connection, schema, schemaPath, map);
- OptiqPrepare.Dummy.push(context);
+ CalcitePrepare.Dummy.push(context);
try {
return prepare.prepareSql(context, sql, null, Object[].class, -1);
} finally {
- OptiqPrepare.Dummy.pop(context);
+ CalcitePrepare.Dummy.pop(context);
}
}
- public static OptiqPrepare.Context makeContext(
- final OptiqConnection connection, final OptiqSchema schema,
+ public static CalcitePrepare.Context makeContext(
+ final CalciteConnection connection, final CalciteSchema schema,
final List<String> schemaPath,
- final ImmutableMap<OptiqConnectionProperty, String> propValues) {
+ final ImmutableMap<CalciteConnectionProperty, String> propValues) {
if (connection == null) {
- final OptiqPrepare.Context context0 = OptiqPrepare.Dummy.peek();
- final OptiqConnectionConfig config =
+ final CalcitePrepare.Context context0 = CalcitePrepare.Dummy.peek();
+ final CalciteConnectionConfig config =
mutate(context0.config(), propValues);
return makeContext(config, context0.getTypeFactory(),
context0.getDataContext(), schema, schemaPath);
} else {
- final OptiqConnectionConfig config =
+ final CalciteConnectionConfig config =
mutate(connection.config(), propValues);
return makeContext(config, connection.getTypeFactory(),
createDataContext(connection), schema, schemaPath);
}
}
- private static OptiqConnectionConfig mutate(OptiqConnectionConfig config,
- ImmutableMap<OptiqConnectionProperty, String> propValues) {
- for (Map.Entry<OptiqConnectionProperty, String> e : propValues.entrySet()) {
+ private static CalciteConnectionConfig mutate(CalciteConnectionConfig config,
+ ImmutableMap<CalciteConnectionProperty, String> propValues) {
+ for (Map.Entry<CalciteConnectionProperty, String> e
+ : propValues.entrySet()) {
config =
- ((OptiqConnectionConfigImpl) config).set(e.getKey(), e.getValue());
+ ((CalciteConnectionConfigImpl) config).set(e.getKey(), e.getValue());
}
return config;
}
- private static OptiqPrepare.Context makeContext(
- final OptiqConnectionConfig connectionConfig,
+ private static CalcitePrepare.Context makeContext(
+ final CalciteConnectionConfig connectionConfig,
final JavaTypeFactory typeFactory,
final DataContext dataContext,
- final OptiqSchema schema,
+ final CalciteSchema schema,
final List<String> schemaPath) {
- return new OptiqPrepare.Context() {
+ return new CalcitePrepare.Context() {
public JavaTypeFactory getTypeFactory() {
return typeFactory;
}
- public OptiqRootSchema getRootSchema() {
+ public CalciteRootSchema getRootSchema() {
return schema.root();
}
@@ -342,7 +358,7 @@ public final class Schemas {
return schemaPath;
}
- public OptiqConnectionConfig config() {
+ public CalciteConnectionConfig config() {
return connectionConfig;
}
@@ -350,9 +366,9 @@ public final class Schemas {
return dataContext;
}
- public OptiqPrepare.SparkHandler spark() {
+ public CalcitePrepare.SparkHandler spark() {
final boolean enable = config().spark();
- return OptiqPrepare.Dummy.getSparkHandler(enable);
+ return CalcitePrepare.Dummy.getSparkHandler(enable);
}
};
}
@@ -382,38 +398,40 @@ public final class Schemas {
/** Returns the star tables defined in a schema.
*
* @param schema Schema */
- public static List<OptiqSchema.TableEntry> getStarTables(OptiqSchema schema) {
- final List<OptiqSchema.LatticeEntry> list = getLatticeEntries(schema);
+ public static List<CalciteSchema.TableEntry>
+ getStarTables(CalciteSchema schema) {
+ final List<CalciteSchema.LatticeEntry> list = getLatticeEntries(schema);
return Lists.transform(list, TO_TABLE_ENTRY);
}
/** Returns the lattices defined in a schema.
*
* @param schema Schema */
- public static List<Lattice> getLattices(OptiqSchema schema) {
- final List<OptiqSchema.LatticeEntry> list = getLatticeEntries(schema);
+ public static List<Lattice> getLattices(CalciteSchema schema) {
+ final List<CalciteSchema.LatticeEntry> list = getLatticeEntries(schema);
return Lists.transform(list, TO_LATTICE);
}
/** Returns the lattices defined in a schema.
*
* @param schema Schema */
- public static List<OptiqSchema.LatticeEntry> getLatticeEntries(
- OptiqSchema schema) {
- final List<OptiqSchema.LatticeEntry> list = Lists.newArrayList();
+ public static List<CalciteSchema.LatticeEntry> getLatticeEntries(
+ CalciteSchema schema) {
+ final List<CalciteSchema.LatticeEntry> list = Lists.newArrayList();
gatherLattices(schema, list);
return list;
}
- private static void gatherLattices(OptiqSchema schema,
- List<OptiqSchema.LatticeEntry> list) {
+ private static void gatherLattices(CalciteSchema schema,
+ List<CalciteSchema.LatticeEntry> list) {
list.addAll(schema.getLatticeMap().values());
- for (OptiqSchema subSchema : schema.getSubSchemaMap().values()) {
+ for (CalciteSchema subSchema : schema.getSubSchemaMap().values()) {
gatherLattices(subSchema, list);
}
}
- public static OptiqSchema subSchema(OptiqSchema schema, List<String> names) {
+ public static CalciteSchema subSchema(CalciteSchema schema,
+ List<String> names) {
for (String string : names) {
schema = schema.getSubSchema(string, false);
}
@@ -421,7 +439,7 @@ public final class Schemas {
}
/** Generates a table name that is unique within the given schema. */
- public static String uniqueTableName(OptiqSchema schema, String base) {
+ public static String uniqueTableName(CalciteSchema schema, String base) {
String t = Preconditions.checkNotNull(base);
for (int x = 0; schema.getTable(t, true) != null; x++) {
t = base + x;
@@ -431,10 +449,10 @@ public final class Schemas {
/** Dummy data context that has no variables. */
private static class DummyDataContext implements DataContext {
- private final OptiqConnection connection;
+ private final CalciteConnection connection;
private final ImmutableMap<String, Object> map;
- public DummyDataContext(OptiqConnection connection) {
+ public DummyDataContext(CalciteConnection connection) {
this.connection = connection;
this.map =
ImmutableMap.<String, Object>of("timeZone", TimeZone.getDefault());
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/SemiMutableSchema.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/SemiMutableSchema.java b/core/src/main/java/org/apache/calcite/schema/SemiMutableSchema.java
index c39e197..0865cff 100644
--- a/core/src/main/java/org/apache/calcite/schema/SemiMutableSchema.java
+++ b/core/src/main/java/org/apache/calcite/schema/SemiMutableSchema.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
/**
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/Statistic.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/Statistic.java b/core/src/main/java/org/apache/calcite/schema/Statistic.java
index 8286ae3..fa907da 100644
--- a/core/src/main/java/org/apache/calcite/schema/Statistic.java
+++ b/core/src/main/java/org/apache/calcite/schema/Statistic.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
import java.util.BitSet;
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/Statistics.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/Statistics.java b/core/src/main/java/org/apache/calcite/schema/Statistics.java
index ab5f93f..9712e7c 100644
--- a/core/src/main/java/org/apache/calcite/schema/Statistics.java
+++ b/core/src/main/java/org/apache/calcite/schema/Statistics.java
@@ -14,11 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
-import net.hydromatic.optiq.util.BitSets;
+import org.apache.calcite.util.BitSets;
-import java.util.*;
+import java.util.BitSet;
+import java.util.List;
/**
* Utility functions regarding {@link Statistic}.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/Table.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/Table.java b/core/src/main/java/org/apache/calcite/schema/Table.java
index 4e8f76c..b25745e 100644
--- a/core/src/main/java/org/apache/calcite/schema/Table.java
+++ b/core/src/main/java/org/apache/calcite/schema/Table.java
@@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
-import org.eigenbase.reltype.RelDataType;
-import org.eigenbase.reltype.RelDataTypeFactory;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
/**
* Table.
*
- * <p>The typical way for a table to be created is when Calcite interrogates
- * a user-defined schema in order to validate names appearing in a SQL query.
- * Calcite finds the schema by calling {@link Schema#getSubSchema(String)} on the
- * connection's root schema, then gets a table by calling
+ * <p>The typical way for a table to be created is when Calcite interrogates a
+ * user-defined schema in order to validate names appearing in a SQL query.
+ * Calcite finds the schema by calling {@link Schema#getSubSchema(String)} on
+ * the connection's root schema, then gets a table by calling
* {@link Schema#getTable(String)}.</p>
*
* <p>Note that a table does not know its name. It is in fact possible for
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/TableFactory.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/TableFactory.java b/core/src/main/java/org/apache/calcite/schema/TableFactory.java
index ccb0c33..ec0321a 100644
--- a/core/src/main/java/org/apache/calcite/schema/TableFactory.java
+++ b/core/src/main/java/org/apache/calcite/schema/TableFactory.java
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
-import org.eigenbase.reltype.RelDataType;
+import org.apache.calcite.rel.type.RelDataType;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/TableFunction.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/TableFunction.java b/core/src/main/java/org/apache/calcite/schema/TableFunction.java
index fe28921..96ef00b 100644
--- a/core/src/main/java/org/apache/calcite/schema/TableFunction.java
+++ b/core/src/main/java/org/apache/calcite/schema/TableFunction.java
@@ -14,18 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
-import org.eigenbase.reltype.RelDataType;
-import org.eigenbase.reltype.RelDataTypeFactory;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
import java.lang.reflect.Type;
import java.util.List;
/**
* Function that returns a table during execution time.
- * <p>
- * In contrast with {@code TableMacro}, the result of the table is not known
+ *
+ * <p>In contrast with {@code TableMacro}, the result of the table is not known
* until execution.
*/
public interface TableFunction extends Function {
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/TableMacro.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/TableMacro.java b/core/src/main/java/org/apache/calcite/schema/TableMacro.java
index 2a88886..8288909 100644
--- a/core/src/main/java/org/apache/calcite/schema/TableMacro.java
+++ b/core/src/main/java/org/apache/calcite/schema/TableMacro.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
import java.util.List;
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/TranslatableTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/TranslatableTable.java b/core/src/main/java/org/apache/calcite/schema/TranslatableTable.java
index f7d126b..0a254ba 100644
--- a/core/src/main/java/org/apache/calcite/schema/TranslatableTable.java
+++ b/core/src/main/java/org/apache/calcite/schema/TranslatableTable.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq;
+package org.apache.calcite.schema;
-import org.eigenbase.rel.RelNode;
-import org.eigenbase.relopt.RelOptTable;
+import org.apache.calcite.plan.RelOptTable;
+import org.apache.calcite.rel.RelNode;
/**
* Extension to {@link Table} that specifies how it is to be translated to
- * a {@link org.eigenbase.rel.RelNode planner node}.
+ * a {@link org.apache.calcite.rel.RelNode planner node}.
*
* <p>It is optional for a Table to implement this interface. A Table that does
* not implement this interface, a Table will be converted to an
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/AbstractSchema.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/AbstractSchema.java b/core/src/main/java/org/apache/calcite/schema/impl/AbstractSchema.java
index 013a01e..ca3389b 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/AbstractSchema.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/AbstractSchema.java
@@ -14,16 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
-
-import net.hydromatic.linq4j.expressions.Expression;
-
-import net.hydromatic.optiq.*;
-import net.hydromatic.optiq.Table;
-
-import com.google.common.collect.*;
-
-import java.util.*;
+package org.apache.calcite.schema.impl;
+
+import org.apache.calcite.linq4j.tree.Expression;
+import org.apache.calcite.schema.Function;
+import org.apache.calcite.schema.Schema;
+import org.apache.calcite.schema.SchemaPlus;
+import org.apache.calcite.schema.Schemas;
+import org.apache.calcite.schema.Table;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Multimap;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
/**
* Abstract implementation of {@link Schema}.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/AbstractTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/AbstractTable.java b/core/src/main/java/org/apache/calcite/schema/impl/AbstractTable.java
index 82900b6..3a96dc9 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/AbstractTable.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/AbstractTable.java
@@ -14,9 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
+package org.apache.calcite.schema.impl;
-import net.hydromatic.optiq.*;
+import org.apache.calcite.schema.Schema;
+import org.apache.calcite.schema.Statistic;
+import org.apache.calcite.schema.Statistics;
+import org.apache.calcite.schema.Table;
/**
* Abstract base class for implementing {@link Table}.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/AbstractTableQueryable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/AbstractTableQueryable.java b/core/src/main/java/org/apache/calcite/schema/impl/AbstractTableQueryable.java
index 78c04d2..1e8774c 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/AbstractTableQueryable.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/AbstractTableQueryable.java
@@ -14,23 +14,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
+package org.apache.calcite.schema.impl;
-import net.hydromatic.linq4j.*;
-import net.hydromatic.linq4j.expressions.Expression;
-
-import net.hydromatic.optiq.QueryableTable;
-import net.hydromatic.optiq.SchemaPlus;
+import org.apache.calcite.linq4j.AbstractQueryable;
+import org.apache.calcite.linq4j.Linq4j;
+import org.apache.calcite.linq4j.QueryProvider;
+import org.apache.calcite.linq4j.Queryable;
+import org.apache.calcite.linq4j.tree.Expression;
+import org.apache.calcite.schema.QueryableTable;
+import org.apache.calcite.schema.SchemaPlus;
import java.lang.reflect.Type;
import java.util.Iterator;
/**
- * Abstract implementation of {@link net.hydromatic.linq4j.Queryable} for
+ * Abstract implementation of {@link org.apache.calcite.linq4j.Queryable} for
* {@link QueryableTable}.
*
* <p>Not to be confused with
- * {@link net.hydromatic.optiq.impl.java.AbstractQueryableTable}.</p>
+ * {@link org.apache.calcite.adapter.java.AbstractQueryableTable}.</p>
*
* @param <T> element type
*/
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/AggregateFunctionImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/AggregateFunctionImpl.java b/core/src/main/java/org/apache/calcite/schema/impl/AggregateFunctionImpl.java
index 4e3e4c5..a2a4140 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/AggregateFunctionImpl.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/AggregateFunctionImpl.java
@@ -14,14 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
+package org.apache.calcite.schema.impl;
-import net.hydromatic.optiq.*;
-import net.hydromatic.optiq.rules.java.*;
-
-import org.eigenbase.reltype.RelDataType;
-import org.eigenbase.reltype.RelDataTypeFactory;
-import org.eigenbase.util.Util;
+import org.apache.calcite.adapter.enumerable.AggImplementor;
+import org.apache.calcite.adapter.enumerable.RexImpTable;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.schema.AggregateFunction;
+import org.apache.calcite.schema.FunctionParameter;
+import org.apache.calcite.schema.ImplementableAggFunction;
+import org.apache.calcite.util.Util;
import com.google.common.collect.ImmutableList;
@@ -29,7 +31,7 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.List;
-import static org.eigenbase.util.Static.*;
+import static org.apache.calcite.util.Static.RESOURCE;
/**
* Implementation of {@link AggregateFunction} via user-defined class.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/DelegatingSchema.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/DelegatingSchema.java b/core/src/main/java/org/apache/calcite/schema/impl/DelegatingSchema.java
index e3d2cd5..0612a59 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/DelegatingSchema.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/DelegatingSchema.java
@@ -14,18 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
+package org.apache.calcite.schema.impl;
-import net.hydromatic.linq4j.expressions.Expression;
-
-import net.hydromatic.optiq.*;
+import org.apache.calcite.linq4j.tree.Expression;
+import org.apache.calcite.schema.Function;
+import org.apache.calcite.schema.Schema;
+import org.apache.calcite.schema.SchemaPlus;
+import org.apache.calcite.schema.Table;
import java.util.Collection;
import java.util.Set;
/**
- * Implementation of {@link net.hydromatic.optiq.Schema} that delegates to an
- * underlying schema.
+ * Implementation of {@link org.apache.calcite.schema.Schema} that delegates to
+ * an underlying schema.
*/
public class DelegatingSchema implements Schema {
protected final Schema schema;
@@ -39,8 +41,7 @@ public class DelegatingSchema implements Schema {
this.schema = schema;
}
- @Override
- public String toString() {
+ @Override public String toString() {
return "DelegatingSchema(delegate=" + schema + ")";
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/MaterializedViewTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/MaterializedViewTable.java b/core/src/main/java/org/apache/calcite/schema/impl/MaterializedViewTable.java
index aac77b5..5810f76 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/MaterializedViewTable.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/MaterializedViewTable.java
@@ -14,20 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
+package org.apache.calcite.schema.impl;
-import net.hydromatic.optiq.*;
-import net.hydromatic.optiq.impl.java.JavaTypeFactory;
-import net.hydromatic.optiq.jdbc.OptiqConnection;
-import net.hydromatic.optiq.jdbc.OptiqPrepare;
-import net.hydromatic.optiq.jdbc.OptiqSchema;
-import net.hydromatic.optiq.materialize.MaterializationKey;
-import net.hydromatic.optiq.materialize.MaterializationService;
-
-import org.eigenbase.rel.RelNode;
-import org.eigenbase.relopt.RelOptTable;
-import org.eigenbase.reltype.RelDataTypeImpl;
-import org.eigenbase.reltype.RelProtoDataType;
+import org.apache.calcite.adapter.java.JavaTypeFactory;
+import org.apache.calcite.jdbc.CalciteConnection;
+import org.apache.calcite.jdbc.CalcitePrepare;
+import org.apache.calcite.jdbc.CalciteSchema;
+import org.apache.calcite.materialize.MaterializationKey;
+import org.apache.calcite.materialize.MaterializationService;
+import org.apache.calcite.plan.RelOptTable;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.type.RelDataTypeImpl;
+import org.apache.calcite.rel.type.RelProtoDataType;
+import org.apache.calcite.schema.Schemas;
+import org.apache.calcite.schema.Table;
+import org.apache.calcite.schema.TranslatableTable;
import com.google.common.base.Preconditions;
@@ -42,7 +43,7 @@ import java.util.List;
* <p>It can exist in two states: materialized and not materialized. Over time,
* a given materialized view may switch states. How it is expanded depends upon
* its current state. State is managed by
- * {@link net.hydromatic.optiq.materialize.MaterializationService}.</p>
+ * {@link org.apache.calcite.materialize.MaterializationService}.</p>
*/
public class MaterializedViewTable extends ViewTable {
@@ -52,12 +53,12 @@ public class MaterializedViewTable extends ViewTable {
* Internal connection, used to execute queries to materialize views.
* To be used only by Calcite internals. And sparingly.
*/
- public static final OptiqConnection MATERIALIZATION_CONNECTION;
+ public static final CalciteConnection MATERIALIZATION_CONNECTION;
static {
try {
MATERIALIZATION_CONNECTION = DriverManager.getConnection("jdbc:calcite:")
- .unwrap(OptiqConnection.class);
+ .unwrap(CalciteConnection.class);
} catch (SQLException e) {
throw new RuntimeException(e);
}
@@ -73,7 +74,7 @@ public class MaterializedViewTable extends ViewTable {
}
/** Table macro that returns a materialized view. */
- public static MaterializedViewTableMacro create(final OptiqSchema schema,
+ public static MaterializedViewTableMacro create(final CalciteSchema schema,
final String viewSql,
final List<String> viewSchemaPath,
final String tableName) {
@@ -81,10 +82,9 @@ public class MaterializedViewTable extends ViewTable {
tableName);
}
- @Override
- public RelNode toRel(RelOptTable.ToRelContext context,
+ @Override public RelNode toRel(RelOptTable.ToRelContext context,
RelOptTable relOptTable) {
- final OptiqSchema.TableEntry tableEntry =
+ final CalciteSchema.TableEntry tableEntry =
MaterializationService.instance().checkValid(key);
if (tableEntry != null) {
Table materializeTable = tableEntry.getTable();
@@ -101,7 +101,7 @@ public class MaterializedViewTable extends ViewTable {
extends ViewTableMacro {
private final MaterializationKey key;
- private MaterializedViewTableMacro(OptiqSchema schema, String viewSql,
+ private MaterializedViewTableMacro(CalciteSchema schema, String viewSql,
List<String> viewSchemaPath, String suggestedTableName) {
super(schema, viewSql, viewSchemaPath);
this.key = Preconditions.checkNotNull(
@@ -109,10 +109,9 @@ public class MaterializedViewTable extends ViewTable {
schema, null, viewSql, schemaPath, suggestedTableName, true));
}
- @Override
- public TranslatableTable apply(List<Object> arguments) {
+ @Override public TranslatableTable apply(List<Object> arguments) {
assert arguments.isEmpty();
- OptiqPrepare.ParseResult parsed =
+ CalcitePrepare.ParseResult parsed =
Schemas.parse(MATERIALIZATION_CONNECTION, schema, schemaPath,
viewSql);
final List<String> schemaPath1 =
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/ReflectiveFunctionBase.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/ReflectiveFunctionBase.java b/core/src/main/java/org/apache/calcite/schema/impl/ReflectiveFunctionBase.java
index 12e8f90..681b69b 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/ReflectiveFunctionBase.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/ReflectiveFunctionBase.java
@@ -14,13 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
+package org.apache.calcite.schema.impl;
-import net.hydromatic.optiq.Function;
-import net.hydromatic.optiq.FunctionParameter;
-
-import org.eigenbase.reltype.RelDataType;
-import org.eigenbase.reltype.RelDataTypeFactory;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.schema.Function;
+import org.apache.calcite.schema.FunctionParameter;
import com.google.common.collect.ImmutableList;
@@ -122,4 +121,3 @@ public abstract class ReflectiveFunctionBase implements Function {
}
// End ReflectiveFunctionBase.java
-
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/ScalarFunctionImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/ScalarFunctionImpl.java b/core/src/main/java/org/apache/calcite/schema/impl/ScalarFunctionImpl.java
index a451f7a..09dfb67 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/ScalarFunctionImpl.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/ScalarFunctionImpl.java
@@ -14,22 +14,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
+package org.apache.calcite.schema.impl;
-import net.hydromatic.optiq.*;
-import net.hydromatic.optiq.rules.java.*;
-
-import org.eigenbase.reltype.RelDataType;
-import org.eigenbase.reltype.RelDataTypeFactory;
+import org.apache.calcite.adapter.enumerable.CallImplementor;
+import org.apache.calcite.adapter.enumerable.NullPolicy;
+import org.apache.calcite.adapter.enumerable.ReflectiveCallNotNullImplementor;
+import org.apache.calcite.adapter.enumerable.RexImpTable;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.schema.ImplementableFunction;
+import org.apache.calcite.schema.ScalarFunction;
import com.google.common.collect.ImmutableMultimap;
-import java.lang.reflect.*;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
-import static org.eigenbase.util.Static.*;
+import static org.apache.calcite.util.Static.RESOURCE;
/**
-* Implementation of {@link net.hydromatic.optiq.ScalarFunction}.
+* Implementation of {@link org.apache.calcite.schema.ScalarFunction}.
*/
public class ScalarFunctionImpl extends ReflectiveFunctionBase implements
ScalarFunction, ImplementableFunction {
@@ -42,8 +46,8 @@ public class ScalarFunctionImpl extends ReflectiveFunctionBase implements
}
/**
- * Creates {@link net.hydromatic.optiq.ScalarFunction} for each method in a
- * given class.
+ * Creates {@link org.apache.calcite.schema.ScalarFunction} for each method in
+ * a given class.
*/
public static ImmutableMultimap<String, ScalarFunction> createAll(
Class<?> clazz) {
@@ -54,7 +58,7 @@ public class ScalarFunctionImpl extends ReflectiveFunctionBase implements
continue;
}
if (!Modifier.isStatic(method.getModifiers())
- && !ScalarFunctionImpl.classHasPublicZeroArgsConstructor(clazz)) {
+ && !classHasPublicZeroArgsConstructor(clazz)) {
continue;
}
final ScalarFunction function = create(method);
@@ -64,7 +68,7 @@ public class ScalarFunctionImpl extends ReflectiveFunctionBase implements
}
/**
- * Creates {@link net.hydromatic.optiq.ScalarFunction} from given class.
+ * Creates {@link org.apache.calcite.schema.ScalarFunction} from given class.
*
* <p>If a method of the given name is not found or it does not suit,
* returns {@code null}.
@@ -82,7 +86,7 @@ public class ScalarFunctionImpl extends ReflectiveFunctionBase implements
}
/**
- * Creates {@link net.hydromatic.optiq.ScalarFunction} from given method.
+ * Creates {@link org.apache.calcite.schema.ScalarFunction} from given method.
* When {@code eval} method does not suit, {@code null} is returned.
*
* @param method method that is used to implement the function
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/StarTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/StarTable.java b/core/src/main/java/org/apache/calcite/schema/impl/StarTable.java
index a2f31d6..25e7480 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/StarTable.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/StarTable.java
@@ -14,19 +14,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
-
-import net.hydromatic.optiq.Schema;
-import net.hydromatic.optiq.Table;
-import net.hydromatic.optiq.TranslatableTable;
-import net.hydromatic.optiq.materialize.Lattice;
-
-import org.eigenbase.rel.*;
-import org.eigenbase.relopt.*;
-import org.eigenbase.reltype.RelDataType;
-import org.eigenbase.reltype.RelDataTypeFactory;
-import org.eigenbase.util.ImmutableIntList;
-import org.eigenbase.util.Pair;
+package org.apache.calcite.schema.impl;
+
+import org.apache.calcite.materialize.Lattice;
+import org.apache.calcite.plan.Convention;
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelOptCost;
+import org.apache.calcite.plan.RelOptPlanner;
+import org.apache.calcite.plan.RelOptTable;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.TableScan;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.schema.Schema;
+import org.apache.calcite.schema.Table;
+import org.apache.calcite.schema.TranslatableTable;
+import org.apache.calcite.util.ImmutableIntList;
+import org.apache.calcite.util.Pair;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
@@ -119,7 +124,7 @@ public class StarTable extends AbstractTable implements TranslatableTable {
*
* <p>It has infinite cost.
*/
- public static class StarTableScan extends TableAccessRelBase {
+ public static class StarTableScan extends TableScan {
public StarTableScan(RelOptCluster cluster, RelOptTable relOptTable) {
super(cluster, cluster.traitSetOf(Convention.NONE), relOptTable);
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/TableFunctionImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/TableFunctionImpl.java b/core/src/main/java/org/apache/calcite/schema/impl/TableFunctionImpl.java
index f25d9d2..e8b523b 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/TableFunctionImpl.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/TableFunctionImpl.java
@@ -14,17 +14,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
+package org.apache.calcite.schema.impl;
-import net.hydromatic.linq4j.expressions.Expression;
-import net.hydromatic.linq4j.expressions.Expressions;
-
-import net.hydromatic.optiq.*;
-import net.hydromatic.optiq.rules.java.*;
-
-import org.eigenbase.reltype.RelDataType;
-import org.eigenbase.reltype.RelDataTypeFactory;
-import org.eigenbase.rex.RexCall;
+import org.apache.calcite.DataContext;
+import org.apache.calcite.adapter.enumerable.CallImplementor;
+import org.apache.calcite.adapter.enumerable.NullPolicy;
+import org.apache.calcite.adapter.enumerable.ReflectiveCallNotNullImplementor;
+import org.apache.calcite.adapter.enumerable.RexImpTable;
+import org.apache.calcite.adapter.enumerable.RexToLixTranslator;
+import org.apache.calcite.linq4j.tree.Expression;
+import org.apache.calcite.linq4j.tree.Expressions;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.schema.ImplementableFunction;
+import org.apache.calcite.schema.QueryableTable;
+import org.apache.calcite.schema.SchemaPlus;
+import org.apache.calcite.schema.TableFunction;
+import org.apache.calcite.util.BuiltInMethod;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -33,10 +40,10 @@ import java.lang.reflect.Type;
import java.util.Arrays;
import java.util.List;
-import static org.eigenbase.util.Static.RESOURCE;
+import static org.apache.calcite.util.Static.RESOURCE;
/**
- * Implementation of {@link net.hydromatic.optiq.TableFunction} based on a
+ * Implementation of {@link org.apache.calcite.schema.TableFunction} based on a
* method.
*/
public class TableFunctionImpl extends ReflectiveFunctionBase implements
@@ -97,14 +104,14 @@ public class TableFunctionImpl extends ReflectiveFunctionBase implements
translatedOperands);
Expression queryable = Expressions.call(
Expressions.convert_(expr, QueryableTable.class),
- BuiltinMethod.QUERYABLE_TABLE_AS_QUERYABLE.method,
+ BuiltInMethod.QUERYABLE_TABLE_AS_QUERYABLE.method,
Expressions.call(DataContext.ROOT,
- BuiltinMethod.DATA_CONTEXT_GET_QUERY_PROVIDER.method),
+ BuiltInMethod.DATA_CONTEXT_GET_QUERY_PROVIDER.method),
Expressions.constant(null, SchemaPlus.class),
Expressions.constant(call.getOperator().getName(),
String.class));
expr = Expressions.call(queryable,
- BuiltinMethod.QUERYABLE_AS_ENUMERABLE.method);
+ BuiltInMethod.QUERYABLE_AS_ENUMERABLE.method);
return expr;
}
}, NullPolicy.ANY, false);
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/TableMacroImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/TableMacroImpl.java b/core/src/main/java/org/apache/calcite/schema/impl/TableMacroImpl.java
index 4728232..609a16f 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/TableMacroImpl.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/TableMacroImpl.java
@@ -14,9 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
+package org.apache.calcite.schema.impl;
-import net.hydromatic.optiq.*;
+import org.apache.calcite.schema.TableMacro;
+import org.apache.calcite.schema.TranslatableTable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -24,10 +25,11 @@ import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.List;
-import static org.eigenbase.util.Static.*;
+import static org.apache.calcite.util.Static.RESOURCE;
/**
- * Implementation of {@link net.hydromatic.optiq.TableMacro} based on a method.
+ * Implementation of {@link org.apache.calcite.schema.TableMacro} based on a
+ * method.
*/
public class TableMacroImpl extends ReflectiveFunctionBase
implements TableMacro {
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/ViewTable.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/ViewTable.java b/core/src/main/java/org/apache/calcite/schema/impl/ViewTable.java
index 8b710b7..c978a3a 100644
--- a/core/src/main/java/org/apache/calcite/schema/impl/ViewTable.java
+++ b/core/src/main/java/org/apache/calcite/schema/impl/ViewTable.java
@@ -14,21 +14,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.impl;
-
-import net.hydromatic.linq4j.QueryProvider;
-import net.hydromatic.linq4j.Queryable;
-
-import net.hydromatic.optiq.*;
-import net.hydromatic.optiq.impl.java.AbstractQueryableTable;
-import net.hydromatic.optiq.impl.java.JavaTypeFactory;
-import net.hydromatic.optiq.jdbc.*;
-
-import org.eigenbase.rel.RelNode;
-import org.eigenbase.relopt.RelOptTable;
-import org.eigenbase.relopt.RelOptUtil;
-import org.eigenbase.reltype.*;
-import org.eigenbase.util.Util;
+package org.apache.calcite.schema.impl;
+
+import org.apache.calcite.adapter.java.AbstractQueryableTable;
+import org.apache.calcite.adapter.java.JavaTypeFactory;
+import org.apache.calcite.jdbc.CalcitePrepare;
+import org.apache.calcite.jdbc.CalciteSchema;
+import org.apache.calcite.linq4j.QueryProvider;
+import org.apache.calcite.linq4j.Queryable;
+import org.apache.calcite.plan.RelOptTable;
+import org.apache.calcite.plan.RelOptUtil;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.rel.type.RelDataTypeImpl;
+import org.apache.calcite.rel.type.RelProtoDataType;
+import org.apache.calcite.schema.FunctionParameter;
+import org.apache.calcite.schema.Schema;
+import org.apache.calcite.schema.SchemaPlus;
+import org.apache.calcite.schema.Schemas;
+import org.apache.calcite.schema.TableMacro;
+import org.apache.calcite.schema.TranslatableTable;
+import org.apache.calcite.util.Util;
import com.google.common.collect.ImmutableList;
@@ -36,8 +43,6 @@ import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;
-import static net.hydromatic.optiq.impl.MaterializedViewTable.MATERIALIZATION_CONNECTION;
-
/**
* Table whose contents are defined using an SQL statement.
*
@@ -61,7 +66,7 @@ public class ViewTable
/** Table macro that returns a view. */
public static ViewTableMacro viewMacro(SchemaPlus schema,
final String viewSql, final List<String> schemaPath) {
- return new ViewTableMacro(OptiqSchema.from(schema), viewSql, schemaPath);
+ return new ViewTableMacro(CalciteSchema.from(schema), viewSql, schemaPath);
}
@Override public Schema.TableType getJdbcTableType() {
@@ -105,12 +110,12 @@ public class ViewTable
* tree of the view's SQL query. */
static class ViewTableMacro implements TableMacro {
protected final String viewSql;
- protected final OptiqSchema schema;
+ protected final CalciteSchema schema;
/** Typically null. If specified, overrides the path of the schema as the
* context for validating {@code viewSql}. */
protected final List<String> schemaPath;
- ViewTableMacro(OptiqSchema schema, String viewSql,
+ ViewTableMacro(CalciteSchema schema, String viewSql,
List<String> schemaPath) {
this.viewSql = viewSql;
this.schema = schema;
@@ -123,9 +128,9 @@ public class ViewTable
}
public TranslatableTable apply(List<Object> arguments) {
- OptiqPrepare.ParseResult parsed =
- Schemas.parse(MATERIALIZATION_CONNECTION, schema, schemaPath,
- viewSql);
+ CalcitePrepare.ParseResult parsed =
+ Schemas.parse(MaterializedViewTable.MATERIALIZATION_CONNECTION,
+ schema, schemaPath, viewSql);
final List<String> schemaPath1 =
schemaPath != null ? schemaPath : schema.path(null);
final JavaTypeFactory typeFactory = (JavaTypeFactory) parsed.typeFactory;
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/impl/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/impl/package-info.java b/core/src/main/java/org/apache/calcite/schema/impl/package-info.java
new file mode 100644
index 0000000..8b918de
--- /dev/null
+++ b/core/src/main/java/org/apache/calcite/schema/impl/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
+/**
+ * Utilities to help implement Calcite's SPIs.
+ */
+package org.apache.calcite.schema.impl;
+
+// End package-info.java
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/schema/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/schema/package-info.java b/core/src/main/java/org/apache/calcite/schema/package-info.java
new file mode 100644
index 0000000..bded44c
--- /dev/null
+++ b/core/src/main/java/org/apache/calcite/schema/package-info.java
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+
+/**
+ * Schema SPI.
+ *
+ * <p>The interfaces in this package define the objects used by the
+ * SQL validator to validate SQL abstract syntax trees and resolve
+ * identifiers to objects.
+ */
+package org.apache.calcite.schema;
+
+// End package-info.java
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/server/CalciteServer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/server/CalciteServer.java b/core/src/main/java/org/apache/calcite/server/CalciteServer.java
index f33ffaa..ade037d 100644
--- a/core/src/main/java/org/apache/calcite/server/CalciteServer.java
+++ b/core/src/main/java/org/apache/calcite/server/CalciteServer.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.server;
+package org.apache.calcite.server;
/**
* Server.
@@ -22,10 +22,10 @@ package net.hydromatic.optiq.server;
* <p>Represents shared state among connections, and will have monitoring and
* management facilities.
*/
-public interface OptiqServer {
- void removeStatement(OptiqServerStatement optiqServerStatement);
+public interface CalciteServer {
+ void removeStatement(CalciteServerStatement calciteServerStatement);
- void addStatement(OptiqServerStatement optiqServerStatement);
+ void addStatement(CalciteServerStatement calciteServerStatement);
}
-// End OptiqServer.java
+// End CalciteServer.java
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/server/CalciteServerStatement.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/server/CalciteServerStatement.java b/core/src/main/java/org/apache/calcite/server/CalciteServerStatement.java
index 88654d0..61ecf88 100644
--- a/core/src/main/java/org/apache/calcite/server/CalciteServerStatement.java
+++ b/core/src/main/java/org/apache/calcite/server/CalciteServerStatement.java
@@ -14,20 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.hydromatic.optiq.server;
+package org.apache.calcite.server;
-import net.hydromatic.optiq.jdbc.OptiqConnection;
-import net.hydromatic.optiq.jdbc.OptiqPrepare;
+import org.apache.calcite.jdbc.CalciteConnection;
+import org.apache.calcite.jdbc.CalcitePrepare;
/**
* Statement within a Calcite server.
*/
-public interface OptiqServerStatement {
+public interface CalciteServerStatement {
/** Creates a context for preparing a statement for execution. */
- OptiqPrepare.Context createPrepareContext();
+ CalcitePrepare.Context createPrepareContext();
/** Returns the connection. */
- OptiqConnection getConnection();
+ CalciteConnection getConnection();
}
-// End OptiqServerStatement.java
+// End CalciteServerStatement.java
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/server/package-info.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/server/package-info.java b/core/src/main/java/org/apache/calcite/server/package-info.java
index e8dce01..5de3ce7 100644
--- a/core/src/main/java/org/apache/calcite/server/package-info.java
+++ b/core/src/main/java/org/apache/calcite/server/package-info.java
@@ -18,6 +18,6 @@
/**
* Provides a server for hosting Calcite connections.
*/
-package net.hydromatic.optiq.server;
+package org.apache.calcite.server;
// End package-info.java
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/ExplicitOperatorBinding.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/ExplicitOperatorBinding.java b/core/src/main/java/org/apache/calcite/sql/ExplicitOperatorBinding.java
index 38bcf47..0e3bb23 100644
--- a/core/src/main/java/org/apache/calcite/sql/ExplicitOperatorBinding.java
+++ b/core/src/main/java/org/apache/calcite/sql/ExplicitOperatorBinding.java
@@ -14,15 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import java.util.List;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.runtime.CalciteException;
+import org.apache.calcite.runtime.Resources;
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.validate.SqlValidatorException;
-import org.eigenbase.reltype.*;
-import org.eigenbase.resource.Resources;
-import org.eigenbase.sql.parser.*;
-import org.eigenbase.sql.validate.*;
-import org.eigenbase.util.*;
+import java.util.List;
/**
* <code>ExplicitOperatorBinding</code> implements {@link SqlOperatorBinding}
@@ -75,7 +76,7 @@ public class ExplicitOperatorBinding extends SqlOperatorBinding {
return types.get(ordinal);
}
- public EigenbaseException newError(
+ public CalciteException newError(
Resources.ExInst<SqlValidatorException> e) {
if (delegate != null) {
return delegate.newError(e);
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/JoinConditionType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/JoinConditionType.java b/core/src/main/java/org/apache/calcite/sql/JoinConditionType.java
index 087d17e..6521944 100644
--- a/core/src/main/java/org/apache/calcite/sql/JoinConditionType.java
+++ b/core/src/main/java/org/apache/calcite/sql/JoinConditionType.java
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import org.eigenbase.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.parser.SqlParserPos;
/**
* Enumerates the types of condition in a join expression.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/JoinType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/JoinType.java b/core/src/main/java/org/apache/calcite/sql/JoinType.java
index b01e3a3..993c279 100644
--- a/core/src/main/java/org/apache/calcite/sql/JoinType.java
+++ b/core/src/main/java/org/apache/calcite/sql/JoinType.java
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import org.eigenbase.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.parser.SqlParserPos;
/**
* Enumerates the types of join.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlAbstractDateTimeLiteral.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlAbstractDateTimeLiteral.java b/core/src/main/java/org/apache/calcite/sql/SqlAbstractDateTimeLiteral.java
index 5973b4c..0cbf4c3 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlAbstractDateTimeLiteral.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlAbstractDateTimeLiteral.java
@@ -14,14 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import java.util.*;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.calcite.util.ZonelessDate;
+import org.apache.calcite.util.ZonelessTime;
+import org.apache.calcite.util.ZonelessTimestamp;
-import org.eigenbase.reltype.*;
-import org.eigenbase.sql.parser.*;
-import org.eigenbase.sql.type.*;
-import org.eigenbase.util14.*;
+import java.util.Calendar;
+import java.util.TimeZone;
/**
* A SQL literal representing a DATE, TIME or TIMESTAMP value.
@@ -47,7 +51,8 @@ abstract class SqlAbstractDateTimeLiteral extends SqlLiteral {
* Constructs a datetime literal based on a Calendar. If the literal is to
* represent a Timestamp, the Calendar is expected to follow java.sql
* semantics. If the Calendar is to represent a Time or Date, the Calendar
- * is expected to follow {@link ZonelessTime} and {@link ZonelessDate}
+ * is expected to follow {@link org.apache.calcite.util.ZonelessTime}
+ * and {@link org.apache.calcite.util.ZonelessDate}
* semantics.
*/
protected SqlAbstractDateTimeLiteral(
@@ -114,7 +119,8 @@ abstract class SqlAbstractDateTimeLiteral extends SqlLiteral {
}
/**
- * Converts this literal to a {@link ZonelessDate} object.
+ * Converts this literal to a
+ * {@link org.apache.calcite.util.ZonelessDate} object.
*/
protected ZonelessDate getDate() {
ZonelessDate zd = new ZonelessDate();
@@ -123,7 +129,8 @@ abstract class SqlAbstractDateTimeLiteral extends SqlLiteral {
}
/**
- * Converts this literal to a {@link ZonelessTime} object.
+ * Converts this literal to a
+ * {@link org.apache.calcite.util.ZonelessTime} object.
*/
protected ZonelessTime getTime() {
ZonelessTime zt = new ZonelessTime();
@@ -132,7 +139,8 @@ abstract class SqlAbstractDateTimeLiteral extends SqlLiteral {
}
/**
- * Converts this literal to a {@link ZonelessTimestamp} object.
+ * Converts this literal to a
+ * {@link org.apache.calcite.util.ZonelessTimestamp} object.
*/
protected ZonelessTimestamp getTimestamp() {
ZonelessTimestamp zt = new ZonelessTimestamp();
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlAbstractStringLiteral.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlAbstractStringLiteral.java b/core/src/main/java/org/apache/calcite/sql/SqlAbstractStringLiteral.java
index 7433d53..377479b 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlAbstractStringLiteral.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlAbstractStringLiteral.java
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import java.util.List;
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.type.SqlTypeName;
-import org.eigenbase.sql.parser.*;
-import org.eigenbase.sql.type.*;
+import java.util.List;
/**
* Abstract base for character and binary string literals.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlAccessEnum.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlAccessEnum.java b/core/src/main/java/org/apache/calcite/sql/SqlAccessEnum.java
index d419605..fbbfc25 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlAccessEnum.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlAccessEnum.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
/**
* Enumeration representing different access types
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlAccessType.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlAccessType.java b/core/src/main/java/org/apache/calcite/sql/SqlAccessType.java
index 6940b6c..5da1b56 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlAccessType.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlAccessType.java
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import java.util.*;
+import java.util.EnumSet;
/**
* SqlAccessType is represented by a set of allowed access types
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlAggFunction.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlAggFunction.java b/core/src/main/java/org/apache/calcite/sql/SqlAggFunction.java
index 8d02a5c..6949d94 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlAggFunction.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlAggFunction.java
@@ -14,18 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import org.eigenbase.rel.*;
-import org.eigenbase.sql.type.*;
-import org.eigenbase.sql.validate.*;
+import org.apache.calcite.sql.type.SqlOperandTypeChecker;
+import org.apache.calcite.sql.type.SqlOperandTypeInference;
+import org.apache.calcite.sql.type.SqlReturnTypeInference;
+import org.apache.calcite.sql.validate.SqlValidator;
+import org.apache.calcite.sql.validate.SqlValidatorScope;
/**
* Abstract base class for the definition of an aggregate function: an operator
* which aggregates sets of values into a result.
*/
-public abstract class SqlAggFunction extends SqlFunction
- implements Aggregation {
+public abstract class SqlAggFunction extends SqlFunction {
//~ Constructors -----------------------------------------------------------
/** Creates a built-in SqlAggFunction. */
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlAsOperator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlAsOperator.java b/core/src/main/java/org/apache/calcite/sql/SqlAsOperator.java
index 371d3b7..1d260cc 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlAsOperator.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlAsOperator.java
@@ -14,17 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import java.util.List;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.sql.type.InferTypes;
+import org.apache.calcite.sql.type.OperandTypes;
+import org.apache.calcite.sql.type.ReturnTypes;
+import org.apache.calcite.sql.util.SqlBasicVisitor;
+import org.apache.calcite.sql.util.SqlVisitor;
+import org.apache.calcite.sql.validate.SqlMonotonicity;
+import org.apache.calcite.sql.validate.SqlValidator;
+import org.apache.calcite.sql.validate.SqlValidatorScope;
+import org.apache.calcite.util.Util;
-import org.eigenbase.reltype.*;
-import org.eigenbase.sql.type.*;
-import org.eigenbase.sql.util.*;
-import org.eigenbase.sql.validate.*;
-import org.eigenbase.util.Util;
+import java.util.List;
-import static org.eigenbase.util.Static.RESOURCE;
+import static org.apache.calcite.util.Static.RESOURCE;
/**
* The <code>AS</code> operator associates an expression with an alias.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java b/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java
index 584d1f8..2e5bf00 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlBasicCall.java
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import java.util.List;
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.util.UnmodifiableArrayList;
-import org.eigenbase.sql.parser.SqlParserPos;
-import org.eigenbase.util.UnmodifiableArrayList;
+import java.util.List;
/**
* Implementation of {@link SqlCall} that keeps its operands in an array.
@@ -83,8 +83,7 @@ public class SqlBasicCall extends SqlCall {
return (S) operands[i];
}
- @Override
- public int operandCount() {
+ @Override public int operandCount() {
return operands.length;
}
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlBinaryOperator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlBinaryOperator.java b/core/src/main/java/org/apache/calcite/sql/SqlBinaryOperator.java
index a518ca8..0c0b491 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlBinaryOperator.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlBinaryOperator.java
@@ -14,19 +14,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import java.math.*;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.sql.fun.SqlStdOperatorTable;
+import org.apache.calcite.sql.type.SqlOperandTypeChecker;
+import org.apache.calcite.sql.type.SqlOperandTypeInference;
+import org.apache.calcite.sql.type.SqlReturnTypeInference;
+import org.apache.calcite.sql.type.SqlTypeUtil;
+import org.apache.calcite.sql.validate.SqlMonotonicity;
+import org.apache.calcite.sql.validate.SqlValidator;
+import org.apache.calcite.sql.validate.SqlValidatorScope;
+import org.apache.calcite.util.Util;
-import java.nio.charset.*;
+import java.math.BigDecimal;
+import java.nio.charset.Charset;
-import org.eigenbase.reltype.*;
-import org.eigenbase.sql.fun.SqlStdOperatorTable;
-import org.eigenbase.sql.type.*;
-import org.eigenbase.sql.validate.*;
-import org.eigenbase.util.*;
-
-import static org.eigenbase.util.Static.RESOURCE;
+import static org.apache.calcite.util.Static.RESOURCE;
/**
* <code>SqlBinaryOperator</code> is a binary operator.
@@ -213,8 +217,7 @@ public class SqlBinaryOperator extends SqlOperator {
return super.getMonotonicity(call, scope);
}
- @Override
- public boolean validRexOperands(int count, boolean fail) {
+ @Override public boolean validRexOperands(int count, boolean fail) {
if (count != 2) {
// Special exception for AND and OR.
if ((this == SqlStdOperatorTable.AND
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlBinaryStringLiteral.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlBinaryStringLiteral.java b/core/src/main/java/org/apache/calcite/sql/SqlBinaryStringLiteral.java
index bf188ad..01ad109 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlBinaryStringLiteral.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlBinaryStringLiteral.java
@@ -14,17 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import java.util.List;
-
-import org.eigenbase.sql.parser.*;
-import org.eigenbase.sql.type.*;
-import org.eigenbase.util.*;
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.calcite.util.BitString;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
+import java.util.List;
+
/**
* A binary (or hexadecimal) string literal.
*
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlCall.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlCall.java b/core/src/main/java/org/apache/calcite/sql/SqlCall.java
index 19cc161..07f5f5b 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlCall.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlCall.java
@@ -14,14 +14,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
-
-import java.util.*;
-
-import org.eigenbase.reltype.*;
-import org.eigenbase.sql.parser.*;
-import org.eigenbase.sql.util.*;
-import org.eigenbase.sql.validate.*;
+package org.apache.calcite.sql;
+
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.sql.parser.SqlParserPos;
+import org.apache.calcite.sql.util.SqlVisitor;
+import org.apache.calcite.sql.validate.SqlMoniker;
+import org.apache.calcite.sql.validate.SqlMonotonicity;
+import org.apache.calcite.sql.validate.SqlValidator;
+import org.apache.calcite.sql.validate.SqlValidatorImpl;
+import org.apache.calcite.sql.validate.SqlValidatorScope;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* A <code>SqlCall</code> is a call to an {@link SqlOperator operator}.
http://git-wip-us.apache.org/repos/asf/incubator-calcite/blob/a0ba73cd/core/src/main/java/org/apache/calcite/sql/SqlCallBinding.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/calcite/sql/SqlCallBinding.java b/core/src/main/java/org/apache/calcite/sql/SqlCallBinding.java
index 33b31da..733a360 100644
--- a/core/src/main/java/org/apache/calcite/sql/SqlCallBinding.java
+++ b/core/src/main/java/org/apache/calcite/sql/SqlCallBinding.java
@@ -14,17 +14,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.eigenbase.sql;
+package org.apache.calcite.sql;
-import java.util.*;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.runtime.CalciteException;
+import org.apache.calcite.runtime.Resources;
+import org.apache.calcite.sql.fun.SqlStdOperatorTable;
+import org.apache.calcite.sql.validate.SelectScope;
+import org.apache.calcite.sql.validate.SqlValidator;
+import org.apache.calcite.sql.validate.SqlValidatorException;
+import org.apache.calcite.sql.validate.SqlValidatorNamespace;
+import org.apache.calcite.sql.validate.SqlValidatorScope;
+import org.apache.calcite.sql.validate.SqlValidatorUtil;
+import org.apache.calcite.util.Util;
-import org.eigenbase.reltype.*;
-import org.eigenbase.resource.Resources;
-import org.eigenbase.sql.fun.*;
-import org.eigenbase.sql.validate.*;
-import org.eigenbase.util.*;
+import java.util.List;
-import static org.eigenbase.util.Static.RESOURCE;
+import static org.apache.calcite.util.Static.RESOURCE;
/**
* <code>SqlCallBinding</code> implements {@link SqlOperatorBinding} by
@@ -166,7 +172,7 @@ public class SqlCallBinding extends SqlOperatorBinding {
return validator.getParentCursor(paramName);
}
- public EigenbaseException newError(
+ public CalciteException newError(
Resources.ExInst<SqlValidatorException> e) {
return validator.newValidationError(call, e);
}
@@ -176,7 +182,7 @@ public class SqlCallBinding extends SqlOperatorBinding {
*
* @return signature exception
*/
- public EigenbaseException newValidationSignatureError() {
+ public CalciteException newValidationSignatureError() {
return validator.newValidationError(call,
RESOURCE.canNotApplyOp2Type(getOperator().getName(),
call.getCallSignature(validator, scope),
@@ -190,7 +196,7 @@ public class SqlCallBinding extends SqlOperatorBinding {
* @param ex underlying exception
* @return wrapped exception
*/
- public EigenbaseException newValidationError(
+ public CalciteException newValidationError(
Resources.ExInst<SqlValidatorException> ex) {
return validator.newValidationError(call, ex);
}