phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mac (JIRA)" <>
Subject [jira] [Created] (PHOENIX-2963) Exception with functional indexes over UDFs
Date Fri, 03 Jun 2016 05:01:04 GMT
Mac created PHOENIX-2963:

             Summary: Exception with functional indexes over UDFs
                 Key: PHOENIX-2963
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.5.2
         Environment: HBase1.0
            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.
        at org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.resolveFunction(
        at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(
        at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(
        at org.apache.phoenix.parse.FunctionParseNode.accept(
        at org.apache.phoenix.parse.IndexExpressionParseNodeRewriter.<init>(
        at org.apache.phoenix.optimize.QueryOptimizer.addPlan(
        at org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(
        at org.apache.phoenix.optimize.QueryOptimizer.optimize(
        at org.apache.phoenix.optimize.QueryOptimizer.optimize(
        at org.apache.phoenix.jdbc.PhoenixStatement$
        at org.apache.phoenix.jdbc.PhoenixStatement$
        at org.apache.phoenix.jdbc.PhoenixStatement.executeQuery(
        at org.apache.phoenix.jdbc.PhoenixStatement.execute(
        at sqlline.Commands.execute(
        at sqlline.Commands.sql(
        at sqlline.SqlLine.dispatch(
        at sqlline.SqlLine.begin(
        at sqlline.SqlLine.start(
        at sqlline.SqlLine.main(
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

View raw message