Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 
 package org.apache.hadoop.hive.ql.exec;
 
FunctionInfo.
 
 public class FunctionInfo {
 
   private final boolean isNative;
 
   private final String displayName;
 
   private GenericUDF genericUDF;
 
   private GenericUDTF genericUDTF;
 
 
   public FunctionInfo(boolean isNativeString displayName,
       GenericUDF genericUDF) {
     this. = isNative;
     this. = displayName;
     this. = genericUDF;
   }
 
   public FunctionInfo(boolean isNativeString displayName,
       GenericUDAFResolver genericUDAFResolver) {
     this. = isNative;
     this. = displayName;
     this. = genericUDAFResolver;
   }
 
   public FunctionInfo(boolean isNativeString displayName,
       GenericUDTF genericUDTF) {
     this. = isNative;
     this. = displayName;
     this. = genericUDTF;
   }

  
Get a new GenericUDF object for the function.
 
   public GenericUDF getGenericUDF() {
     // GenericUDF is stateful - we have to make a copy here
     if ( == null) {
       return null;
     }
     return FunctionRegistry.cloneGenericUDF();
   }

  
Get a new GenericUDTF object for the function.
 
   public GenericUDTF getGenericUDTF() {
     // GenericUDTF is stateful too, copy
     if ( == null) {
       return null;
     }
     return FunctionRegistry.cloneGenericUDTF();
   }

  
Get the GenericUDAFResolver object for the function.
 
     return ;
   }

  
Get the Class of the UDF.
 
   public Class<?> getFunctionClass() {
     if (isGenericUDF()) {
       if ( instanceof GenericUDFBridge) {
         return ((GenericUDFBridge).getUdfClass();
      } else {
        return .getClass();
      }
    } else if (isGenericUDAF()) {
      if ( instanceof GenericUDAFBridge) {
        return ((GenericUDAFBridge).getUDAFClass();
      } else {
        return .getClass();
      }
    } else if (isGenericUDTF()) {
      return .getClass();
    }
    return null;
  }

  
Get the display name for this function. This should be transfered into exprNodeGenericUDFDesc, and will be used as the first parameter to GenericUDF.getDisplayName() call, instead of hard-coding the function name. This will solve the problem of displaying only one name when a udf is registered under 2 names.
  public String getDisplayName() {
    return ;
  }

  
Native functions cannot be unregistered.
  public boolean isNative() {
    return ;
  }

  

Returns:
TRUE if the function is a GenericUDF
  public boolean isGenericUDF() {
    return null != ;
  }

  

Returns:
TRUE if the function is a GenericUDAF
  public boolean isGenericUDAF() {
    return null != ;
  }

  

Returns:
TRUE if the function is a GenericUDTF
  public boolean isGenericUDTF() {
    return null != ;
  }
New to GrepCode? Check out our FAQ X