phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maryann...@apache.org
Subject [50/50] [abbrv] phoenix git commit: Fix compilation errors and ToExpressionTest after merge
Date Wed, 04 Mar 2015 22:41:25 GMT
Fix compilation errors and ToExpressionTest after merge


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/026f60b1
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/026f60b1
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/026f60b1

Branch: refs/heads/calcite
Commit: 026f60b12764e68f8e60922c276a44c6543f27ce
Parents: b9d24a9
Author: maryannxue <wei.xue@intel.com>
Authored: Wed Mar 4 17:40:22 2015 -0500
Committer: maryannxue <wei.xue@intel.com>
Committed: Wed Mar 4 17:40:22 2015 -0500

----------------------------------------------------------------------
 .../apache/phoenix/calcite/PhoenixTable.java    |  2 +-
 .../calcite/PhoenixToEnumerableConverter.java   |  2 +-
 .../apache/phoenix/compile/FromCompiler.java    |  3 +--
 .../phoenix/calcite/ToExpressionTest.java       | 25 ++++----------------
 4 files changed, 7 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/026f60b1/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
index 9b58d68..730f642 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixTable.java
@@ -14,8 +14,8 @@ import org.apache.calcite.sql.type.SqlTypeName;
 import org.apache.calcite.util.ImmutableBitSet;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.schema.PColumn;
-import org.apache.phoenix.schema.PDataType;
 import org.apache.phoenix.schema.PTable;
+import org.apache.phoenix.schema.types.PDataType;
 
 /**
  * Implementation of Calcite {@link org.apache.calcite.schema.Table} SPI for

http://git-wip-us.apache.org/repos/asf/phoenix/blob/026f60b1/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixToEnumerableConverter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixToEnumerableConverter.java
b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixToEnumerableConverter.java
index fc2af9c..e8949d8 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixToEnumerableConverter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixToEnumerableConverter.java
@@ -62,7 +62,7 @@ public class PhoenixToEnumerableConverter extends ConverterImpl implements
Enume
     }
 
     static Expression stash(EnumerableRelImplementor implementor, Object o, Class clazz)
{
-        ParameterExpression x = implementor.register(o, clazz);
+        ParameterExpression x = (ParameterExpression) implementor.stash(o, clazz);
         MethodCallExpression e =
             Expressions.call(implementor.getRootExpression(),
                 org.apache.calcite.util.BuiltInMethod.DATA_CONTEXT_GET.method,

http://git-wip-us.apache.org/repos/asf/phoenix/blob/026f60b1/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 64024c4..977a3f8 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
@@ -26,7 +26,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-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;
@@ -327,7 +326,7 @@ public class FromCompiler {
         private final int tsAddition;
 
         private BaseColumnResolver(PhoenixConnection connection, int tsAddition) {
-            this.connection = Preconditions.checkNotNull(connection);
+            this.connection = connection;
             this.client = connection == null ? null : new MetaDataClient(connection);
             this.tsAddition = tsAddition;
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/026f60b1/phoenix-core/src/test/java/org/apache/phoenix/calcite/ToExpressionTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/calcite/ToExpressionTest.java b/phoenix-core/src/test/java/org/apache/phoenix/calcite/ToExpressionTest.java
index 91628ff..50ac2a8 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/calcite/ToExpressionTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/calcite/ToExpressionTest.java
@@ -1,41 +1,30 @@
 package org.apache.phoenix.calcite;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
-import java.sql.SQLException;
 import java.util.Collections;
-import java.util.Set;
 
 import org.apache.calcite.jdbc.JavaTypeFactoryImpl;
 import org.apache.calcite.rel.type.RelDataType;
 import org.apache.calcite.rex.RexBuilder;
 import org.apache.calcite.rex.RexInputRef;
-import org.apache.calcite.rex.RexLiteral;
 import org.apache.calcite.rex.RexNode;
 import org.apache.calcite.sql.fun.SqlStdOperatorTable;
 import org.apache.calcite.sql.type.SqlTypeName;
 import org.apache.phoenix.calcite.PhoenixRel.Implementor;
 import org.apache.phoenix.compile.ColumnResolver;
 import org.apache.phoenix.compile.FromCompiler;
-import org.apache.phoenix.compile.GroupByCompiler;
-import org.apache.phoenix.compile.HavingCompiler;
-import org.apache.phoenix.compile.LimitCompiler;
-import org.apache.phoenix.compile.QueryPlan;
 import org.apache.phoenix.compile.StatementContext;
 import org.apache.phoenix.compile.WhereCompiler;
-import org.apache.phoenix.compile.GroupByCompiler.GroupBy;
-import org.apache.phoenix.expression.ColumnExpression;
 import org.apache.phoenix.expression.Expression;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.jdbc.PhoenixStatement;
-import org.apache.phoenix.parse.ParseNode;
 import org.apache.phoenix.parse.SQLParser;
 import org.apache.phoenix.parse.SelectStatement;
 import org.apache.phoenix.parse.SubqueryParseNode;
 import org.apache.phoenix.query.BaseConnectionlessQueryTest;
-import org.apache.phoenix.schema.ColumnRef;
 import org.apache.phoenix.schema.PTable;
 import org.apache.phoenix.schema.PTableKey;
 import org.junit.Test;
@@ -43,13 +32,6 @@ import org.junit.Test;
 
 public class ToExpressionTest extends BaseConnectionlessQueryTest {
 	
-	private static Expression compileExpression(PhoenixStatement statement, StatementContext
context, String selectStmt) throws SQLException {
-		// Re-parse the WHERE clause as we don't store it any where
-        SelectStatement select = new SQLParser(selectStmt).parseQuery();
-        Expression where = WhereCompiler.compile(context, select, null, Collections.<SubqueryParseNode>emptySet());
-        return where;
-	}
-	
 	@Test
 	public void toExpressionTest() throws Exception {
 		final String expectedColName = "K2";
@@ -59,8 +41,9 @@ public class ToExpressionTest extends BaseConnectionlessQueryTest {
 		final PTable table = conn.unwrap(PhoenixConnection.class).getMetaDataCache().getTable(new
PTableKey(null,"T"));
 		PhoenixStatement stmt = conn.createStatement().unwrap(PhoenixStatement.class);
 		String query = "SELECT * FROM T WHERE K2 = 'foo'";
-		QueryPlan plan = stmt.compileQuery(query);
-		Expression where = compileExpression(stmt, plan.getContext(), query);
+        SelectStatement select = new SQLParser(query).parseQuery();
+        ColumnResolver resolver = FromCompiler.getResolverForQuery(select, conn.unwrap(PhoenixConnection.class));
+        Expression where = WhereCompiler.compile(new StatementContext(stmt, resolver), select,
null, Collections.<SubqueryParseNode>emptySet());
 		
 		JavaTypeFactoryImpl typeFactory = new JavaTypeFactoryImpl();
 		RexBuilder builder = new RexBuilder(typeFactory);


Mime
View raw message