Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-4866

UDFs get error: org.apache.phoenix.schema.FunctionNotFoundException: ERROR 6001 (42F01): Function undefined

    XMLWordPrintableJSON

Details

    • Important

    Description

       I built an udf `ARRAY_DISTINCT`, When i exec:

      SELECT ARRAY_DISTINCT(ARRAY['A', 'B', 'A', 'C'], TRUE);

      throw error:

       

      org.apache.phoenix.schema.FunctionNotFoundException: ERROR 6001 (42F01): Function undefined. functionName=ARRAY_DISTINCT at org.apache.phoenix.compile.FromCompiler$1.resolveFunction(FromCompiler.java:134) at org.apache.phoenix.compile.ExpressionCompiler.visitLeave(ExpressionCompiler.java:327)
      

       

      However when i exec:

      SELECT ARRAY_DISTINCT(ARRAY['A', 'B', 'A', 'C'], TRUE) FROM TABLE_NAME;

      output:

      ---------------------

      | ARRAY['A','B','C'] |

      ---------------------

      ---------------------

       

      SELECT ARRAY_DISTINCT(array_elements, TRUE) as arr FROM TABLE_NAME;**

      output:

      ---------------------

      | ARR      |

      ---------------------

      | ARRAY['A','B','C'] |**

      ---------------------

       
      The DDL: 

      CREATE FUNCTION ARRAY_DISTINCT(VARCHAR[], BOOLEAN) RETURNS VARCHAR AS 'com.godalgo.udf.ArrayDistinctFunction';

      My Environment:  apache-phoenix-5.0.0-HBase-2.0-bin  hbase-2.0.0 hadoop-3.1.0

       

      I tried the built-in functions which provided by Phoenix, ALL OF THEM ARE OK .

      I had putted ARRAY_DISTINCT's SOURCE TO attachment.

      Attachments

        1. ArrayDistinctFunction.java
          3 kB
          cherish peng
        2. PHOENIX-4866.master.v1.patch
          17 kB
          Richárd Antal

        Activity

          People

            richardantal Richárd Antal
            1024bit cherish peng
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 72h
                72h
                Remaining:
                Remaining Estimate - 72h
                72h
                Logged:
                Time Spent - Not Specified
                Not Specified