You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Mac (JIRA)" <ji...@apache.org> on 2016/06/03 05:01:04 UTC
[jira] [Created] (PHOENIX-2963) Exception with functional indexes
over UDFs
Mac created PHOENIX-2963:
----------------------------
Summary: Exception with functional indexes over UDFs
Key: PHOENIX-2963
URL: https://issues.apache.org/jira/browse/PHOENIX-2963
Project: Phoenix
Issue Type: Bug
Affects Versions: 4.5.2
Environment: HBase1.0
Phoenix-4.5.2
Reporter: Mac
Priority: Critical
One exception i have met but not sure if it is an issue. here are the steps
1. Create a function
CREATE FUNCTION geohash_1(double, double) returns varchar as 'co.mac.test.GeoHashFunction' using jar '/Users/mac/Downloads/phoenix-4.5.2-HBase-1.0/phoenix-plugins/target/phoenix-plugins-4.5.2-HBase-1.0.jar’;
1. Create a Geohash UDF and use this to create the index
CREATE INDEX geohash_mac_test_3 ON MAC_TEST_3(geohash_1(lng, lat));
> this is to make the index work when we query like select A from MAC_TEST_3 where GEOHASH_1(LNG, LAT) = ‘wts22xxgfg';
2. Use the select statement without geohash UDF: select * from MAC_TEST_3 where A=‘aaa’
Exception happen here:
--------------------------
Error: ERROR 6001 (42F01): Function undefined. functionName=GEOHASH_1 (state=42F01,code=6001)
org.apache.phoenix.schema.FunctionNotFoundException: ERROR 6001 (42F01): Function undefined. functionName=GEOHASH_1
at org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.resolveFunction(FromCompiler.java:561)
at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:321)
at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:141)
at org.apache.phoenix.parse.FunctionParseNode.accept(FunctionParseNode.java:86)
at org.apache.phoenix.parse.IndexExpressionParseNodeRewriter.<init>(IndexExpressionParseNodeRewriter.java:56)
at org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:238)
at org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:152)
at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:94)
at org.apache.phoenix.optimize.QueryOptimizer.optimize(QueryOptimizer.java:80)
at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:262)
at org.apache.phoenix.jdbc.PhoenixStatement$1.call(PhoenixStatement.java:256)
at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53)
at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(PhoenixStatement.java:255)
at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:1436)
at sqlline.Commands.execute(Commands.java:822)
at sqlline.Commands.sql(Commands.java:732)
at sqlline.SqlLine.dispatch(SqlLine.java:808)
at sqlline.SqlLine.begin(SqlLine.java:681)
at sqlline.SqlLine.start(SqlLine.java:398)
at sqlline.SqlLine.main(SqlLine.java:292)
-----------------------------------------------
but if i use the UPPER function to create index, things work well. I did a simple DEBUG, and find the difference is here
Somehow QueryPlan thinks the GEOHASH_1 is a UDFParseNode, but UPPER is a FunctionParseNode. Is this because I manually call “CREATE FUNCTION” For the geohash_1?
----------------------------------
public Expression visitLeave(FunctionParseNode node, List<Expression> children) throws SQLException {
PFunction function = null;
if(node instanceof UDFParseNode) {
function = context.getResolver().resolveFunction(node.getName());
BuiltInFunctionInfo info = new BuiltInFunctionInfo(function);
node = new UDFParseNode(node.getName(), node.getChildren(), info);
}
children = node.validate(children, context);
Expression expression = null;
if (function == null) {
-----------------------------------------
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)