PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.1-rc2/hive/external/ql/src/java/org/apache/hadoop/hive/ql/exec/UDFMethodResolver.java

#
Java | 49 lines | 7 code | 5 blank | 37 comment | 0 complexity | 841adba5bca47330a90d657d0e2ec95a MD5 | raw file
 1/**
 2 * Licensed to the Apache Software Foundation (ASF) under one
 3 * or more contributor license agreements.  See the NOTICE file
 4 * distributed with this work for additional information
 5 * regarding copyright ownership.  The ASF licenses this file
 6 * to you under the Apache License, Version 2.0 (the
 7 * "License"); you may not use this file except in compliance
 8 * with the License.  You may obtain a copy of the License at
 9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19package org.apache.hadoop.hive.ql.exec;
20
21import java.lang.reflect.Method;
22import java.util.List;
23
24import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
25
26/**
27 * The UDF Method resolver interface. A user can plugin a resolver to their UDF
28 * by implementing the functions in this interface. Note that the resolver is
29 * stored in the UDF class as an instance variable. We did not use a static
30 * variable because many resolvers maintain the class of the enclosing UDF as
31 * state and are called from a base class e.g. UDFBaseCompare. This makes it
32 * very easy to write UDFs that want to do resolution similar to the comparison
33 * operators. Such UDFs just need to extend UDFBaseCompare and do not have to
34 * care about the UDFMethodResolver interface. Same is true for UDFs that want
35 * to do resolution similar to that done by the numeric operators. Such UDFs
36 * simply have to extend UDFBaseNumericOp class. For the default resolution the
37 * UDF implementation simply needs to extend the UDF class.
38 */
39public interface UDFMethodResolver {
40
41  /**
42   * Gets the evaluate method for the UDF given the parameter types.
43   * 
44   * @param argClasses
45   *          The list of the argument types that need to matched with the
46   *          evaluate function signature.
47   */
48  Method getEvalMethod(List<TypeInfo> argClasses) throws UDFArgumentException;
49}