You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2015/08/07 21:07:18 UTC
phoenix git commit: PHOENIX-2163 Measure performance of
Phoenix/Calcite querying: implementing POWER and SQRT
Repository: phoenix
Updated Branches:
refs/heads/calcite ca91c5d9a -> 39dff45c3
PHOENIX-2163 Measure performance of Phoenix/Calcite querying: implementing POWER and SQRT
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/39dff45c
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/39dff45c
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/39dff45c
Branch: refs/heads/calcite
Commit: 39dff45c3d785c46601a63892bf5c33c2fb681cb
Parents: ca91c5d
Author: maryannxue <we...@intel.com>
Authored: Fri Aug 7 15:07:08 2015 -0400
Committer: maryannxue <we...@intel.com>
Committed: Fri Aug 7 15:07:08 2015 -0400
----------------------------------------------------------------------
.../apache/phoenix/calcite/CalciteUtils.java | 29 ++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/39dff45c/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
index a28e395..62a8d2e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/CalciteUtils.java
@@ -14,6 +14,8 @@ import org.apache.calcite.rex.RexNode;
import org.apache.calcite.sql.SqlAggFunction;
import org.apache.calcite.sql.SqlFunction;
import org.apache.calcite.sql.SqlKind;
+import org.apache.calcite.sql.SqlOperator;
+import org.apache.calcite.sql.fun.SqlStdOperatorTable;
import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.calcite.util.NlsString;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
@@ -48,8 +50,10 @@ import org.apache.phoenix.expression.function.CountAggregateFunction;
import org.apache.phoenix.expression.function.FunctionExpression;
import org.apache.phoenix.expression.function.MaxAggregateFunction;
import org.apache.phoenix.expression.function.MinAggregateFunction;
+import org.apache.phoenix.expression.function.PowerFunction;
import org.apache.phoenix.expression.function.RoundDecimalExpression;
import org.apache.phoenix.expression.function.RoundTimestampExpression;
+import org.apache.phoenix.expression.function.SqrtFunction;
import org.apache.phoenix.schema.SortOrder;
import org.apache.phoenix.schema.TypeMismatchException;
import org.apache.phoenix.schema.types.PDataType;
@@ -506,8 +510,29 @@ public class CalciteUtils {
throw new RuntimeException(e);
}
}
-
- });
+
+ });
+ EXPRESSION_MAP.put(SqlKind.OTHER_FUNCTION, new ExpressionFactory() {
+ @Override
+ public Expression newExpression(RexNode node,
+ Implementor implementor) {
+ RexCall call = (RexCall) node;
+ List<Expression> children = convertChildren(call, implementor);
+ SqlOperator op = call.getOperator();
+ try {
+ if (op == SqlStdOperatorTable.SQRT) {
+ return new SqrtFunction(children);
+ } else if (op == SqlStdOperatorTable.POWER) {
+ return new PowerFunction(children);
+ }
+ } catch (SQLException e) {
+ throw new RuntimeException(e);
+ }
+
+ throw new UnsupportedOperationException(
+ "Unsupported SqlFunction: " + op.getName());
+ }
+ });
}
private static final Map<String, FunctionFactory> FUNCTION_MAP = Maps