Sync changes from https://github.com/julianhyde/phoenix/tree/calcite
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/b005b124 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/b005b124 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/b005b124 Branch: refs/heads/calcite Commit: b005b1246841e677be6890583597531f0c8036c9 Parents: 76a858a Author: maryannxue <maryann...@apache.org> Authored: Tue Dec 2 16:50:32 2014 -0500 Committer: maryannxue <maryann...@apache.org> Committed: Tue Dec 2 16:50:32 2014 -0500 ---------------------------------------------------------------------- phoenix-core/pom.xml | 8 ++++++++ .../phoenix/calcite/PhoenixRelImplementorImpl.java | 6 +++++- .../java/org/apache/phoenix/compile/FromCompiler.java | 3 ++- .../java/org/apache/phoenix/compile/WhereCompiler.java | 2 +- .../java/org/apache/phoenix/parse/SelectStatement.java | 7 +++++++ pom.xml | 11 +++++++++++ 6 files changed, 34 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/b005b124/phoenix-core/pom.xml ---------------------------------------------------------------------- diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml index b98e9b2..70d54e7 100644 --- a/phoenix-core/pom.xml +++ b/phoenix-core/pom.xml @@ -319,6 +319,14 @@ <artifactId>commons-csv</artifactId> </dependency> <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-avatica</artifactId> + </dependency> + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-core</artifactId> + </dependency> + <dependency> <groupId>com.google.code.findbugs</groupId> <artifactId>jsr305</artifactId> </dependency> http://git-wip-us.apache.org/repos/asf/phoenix/blob/b005b124/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixRelImplementorImpl.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixRelImplementorImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixRelImplementorImpl.java index a7d62e2..a833b6b 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixRelImplementorImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixRelImplementorImpl.java @@ -82,10 +82,14 @@ class PhoenixRelImplementorImpl implements PhoenixRel.Implementor { @Override public QueryPlan makePlan() { + try { Integer limit = null; OrderBy orderBy = OrderBy.EMPTY_ORDER_BY; ParallelIteratorFactory iteratorFactory = null; - return new ScanPlan(context, select, tableRef, projector, limit, orderBy, iteratorFactory, true); + return new ScanPlan(context, select, tableRef, projector, limit, orderBy, iteratorFactory, true); + } catch (SQLException e) { + throw new RuntimeException(e); + } } } http://git-wip-us.apache.org/repos/asf/phoenix/blob/b005b124/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java index fb3183a..2c4a578 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/FromCompiler.java @@ -24,6 +24,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import com.google.common.base.Preconditions; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.HTableInterface; import org.apache.phoenix.coprocessor.MetaDataProtocol; @@ -317,7 +318,7 @@ public class FromCompiler { private final int tsAddition; private BaseColumnResolver(PhoenixConnection connection, int tsAddition) { - this.connection = connection; + this.connection = Preconditions.checkNotNull(connection); this.client = connection == null ? null : new MetaDataClient(connection); this.tsAddition = tsAddition; } http://git-wip-us.apache.org/repos/asf/phoenix/blob/b005b124/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java index b3a9c2d..694eb6a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java @@ -232,7 +232,7 @@ public class WhereCompiler { * @param context the shared context during query compilation * @param whereClause the final where clause expression. */ - private static void setScanFilter(StatementContext context, FilterableStatement statement, Expression whereClause, boolean disambiguateWithFamily, boolean hashJoinOptimization) { + public static void setScanFilter(StatementContext context, FilterableStatement statement, Expression whereClause, boolean disambiguateWithFamily, boolean hashJoinOptimization) { Scan scan = context.getScan(); if (LiteralExpression.isFalse(whereClause)) { http://git-wip-us.apache.org/repos/asf/phoenix/blob/b005b124/phoenix-core/src/main/java/org/apache/phoenix/parse/SelectStatement.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/parse/SelectStatement.java b/phoenix-core/src/main/java/org/apache/phoenix/parse/SelectStatement.java index 961846b..1f032a9 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/parse/SelectStatement.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/parse/SelectStatement.java @@ -34,6 +34,13 @@ import org.apache.phoenix.parse.FunctionParseNode.BuiltInFunctionInfo; * @since 0.1 */ public class SelectStatement implements FilterableStatement { + public static final SelectStatement SELECT_STAR = + new SelectStatement( + null, null, false, + Collections.<AliasedNode>singletonList(new AliasedNode(null, WildcardParseNode.INSTANCE)), + null, Collections.<ParseNode>emptyList(), + null, Collections.<OrderByNode>emptyList(), + null, 0, false, false); public static final SelectStatement SELECT_ONE = new SelectStatement( null, null, false, http://git-wip-us.apache.org/repos/asf/phoenix/blob/b005b124/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index a8d1f10..f5fbc5f 100644 --- a/pom.xml +++ b/pom.xml @@ -103,6 +103,7 @@ <htrace.version>2.04</htrace.version> <collections.version>3.2.1</collections.version> <jodatime.version>2.3</jodatime.version> + <calcite.version>1.0.0-incubating-SNAPSHOT</calcite.version> <!-- Test Dependencies --> <mockito-all.version>1.8.5</mockito-all.version> @@ -652,6 +653,16 @@ <artifactId>joda-time</artifactId> <version>${jodatime.version}</version> </dependency> + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-avatica</artifactId> + <version>${calcite.version}</version> + </dependency> + <dependency> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-core</artifactId> + <version>${calcite.version}</version> + </dependency> </dependencies> </dependencyManagement>