PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 0ms 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
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.0
  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. package org.apache.hadoop.hive.ql.exec;
  19. import java.lang.reflect.Method;
  20. import java.util.List;
  21. import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
  22. /**
  23. * The UDF Method resolver interface. A user can plugin a resolver to their UDF
  24. * by implementing the functions in this interface. Note that the resolver is
  25. * stored in the UDF class as an instance variable. We did not use a static
  26. * variable because many resolvers maintain the class of the enclosing UDF as
  27. * state and are called from a base class e.g. UDFBaseCompare. This makes it
  28. * very easy to write UDFs that want to do resolution similar to the comparison
  29. * operators. Such UDFs just need to extend UDFBaseCompare and do not have to
  30. * care about the UDFMethodResolver interface. Same is true for UDFs that want
  31. * to do resolution similar to that done by the numeric operators. Such UDFs
  32. * simply have to extend UDFBaseNumericOp class. For the default resolution the
  33. * UDF implementation simply needs to extend the UDF class.
  34. */
  35. public interface UDFMethodResolver {
  36. /**
  37. * Gets the evaluate method for the UDF given the parameter types.
  38. *
  39. * @param argClasses
  40. * The list of the argument types that need to matched with the
  41. * evaluate function signature.
  42. */
  43. Method getEvalMethod(List<TypeInfo> argClasses) throws UDFArgumentException;
  44. }