Package org.apache.hadoop.hive.metastore.api

Examples of org.apache.hadoop.hive.metastore.api.Function


            + " using class " + createFunctionDesc.getClassName());
        return 1;
      }

      // Add to metastore
      Function func = new Function(
          funcName,
          dbName,
          className,
          SessionState.get().getUserName(),
          PrincipalType.USER,
View Full Code Here


        Database db = ms.getDatabase(func.getDbName());
        if (db == null) {
          throw new NoSuchObjectException("The database " + func.getDbName() + " does not exist");
        }
        Function existingFunc = ms.getFunction(func.getDbName(), func.getFunctionName());
        if (existingFunc != null) {
          throw new AlreadyExistsException(
              "Function " + func.getFunctionName() + " already exists");
        }
View Full Code Here

    @Override
    public void drop_function(String dbName, String funcName)
        throws NoSuchObjectException, MetaException,
        InvalidObjectException, InvalidInputException {
      boolean success = false;
      Function func = null;
      RawStore ms = getMS();

      try {
        ms.openTransaction();
View Full Code Here

    public Function get_function(String dbName, String funcName)
        throws MetaException, NoSuchObjectException, TException {
      startFunction("get_function", ": " + dbName + "." + funcName);

      RawStore ms = getMS();
      Function func = null;
      Exception ex = null;

      try {
        func = ms.getFunction(dbName, funcName);
        if (func == null) {
View Full Code Here

        fName = functionName;
      }

      // Try looking up function in the metastore
      HiveConf conf = SessionState.get().getConf();
      Function func = Hive.get(conf).getFunction(dbName, fName);
      if (func != null) {
        // Found UDF in metastore - now add it to the function registry
        // At this point we should add any relevant jars that would be needed for the UDf.
        try {
          FunctionTask.addFunctionResources(func.getResourceUris());
        } catch (Exception e) {
          LOG.error("Unable to load resources for " + dbName + "." + fName + ":" + e);
          return null;
        }

        Class<?> udfClass = Class.forName(func.getClassName(), true, JavaUtils.getClassLoader());
        if (registerTemporaryFunction(functionName, udfClass)) {
          ret = mFunctions.get(functionName);
        } else {
          LOG.error(func.getClassName() + " is not a valid UDF class and was not registered.");
        }
      }
    } catch (HiveException e) {
      LOG.info("Unable to lookup UDF in metastore: " + e);
    } catch (ClassNotFoundException e) {
View Full Code Here

      // Look up the function in the metastore and load any resources.
      LOG.debug("Attempting to reload resources for " + functionName);
      try {
        String[] parts = FunctionUtils.getQualifiedFunctionNameParts(functionName);
        HiveConf conf = SessionState.get().getConf();
        Function func = Hive.get(conf).getFunction(parts[0], parts[1]);
        if (func != null) {
          FunctionTask.addFunctionResources(func.getResourceUris());
          // Check again now that we've loaded the resources in this thread.
          checkFunctionClass(cfi);
        } else {
          // Couldn't find the function .. just rethrow the original error
          LOG.error("Unable to reload resources for " + functionName);
View Full Code Here

  private Function convertToFunction(MFunction mfunc) {
    if (mfunc == null) {
      return null;
    }

    Function func = new Function(mfunc.getFunctionName(),
        mfunc.getDatabase().getName(),
        mfunc.getClassName(),
        mfunc.getOwnerName(),
        PrincipalType.valueOf(mfunc.getOwnerType()),
        mfunc.getCreateTime(),
View Full Code Here

  }

  @Override
  public Function getFunction(String dbName, String funcName) throws MetaException {
    boolean commited = false;
    Function func = null;
    try {
      openTransaction();
      func = convertToFunction(getMFunction(dbName, funcName));
      commited = commitTransaction();
    } finally {
View Full Code Here

        Database db = ms.getDatabase(func.getDbName());
        if (db == null) {
          throw new NoSuchObjectException("The database " + func.getDbName() + " does not exist");
        }
        Function existingFunc = ms.getFunction(func.getDbName(), func.getFunctionName());
        if (existingFunc != null) {
          throw new AlreadyExistsException(
              "Function " + func.getFunctionName() + " already exists");
        }
View Full Code Here

    @Override
    public void drop_function(String dbName, String funcName)
        throws NoSuchObjectException, MetaException,
        InvalidObjectException, InvalidInputException {
      boolean success = false;
      Function func = null;
      RawStore ms = getMS();

      try {
        ms.openTransaction();
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.metastore.api.Function

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.