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

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


    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


      createFunction(dbName, funcName, className, owner, ownerType, createTime, funcType, null);

      // Try the different getters

      // getFunction()
      Function func = client.getFunction(dbName, funcName);
      assertEquals("function db name", dbName, func.getDbName());
      assertEquals("function name", funcName, func.getFunctionName());
      assertEquals("function class name", className, func.getClassName());
      assertEquals("function owner name", owner, func.getOwnerName());
      assertEquals("function owner type", PrincipalType.USER, func.getOwnerType());
      assertEquals("function type", funcType, func.getFunctionType());
      List<ResourceUri> resources = func.getResourceUris();
      assertTrue("function resources", resources == null || resources.size() == 0);

      boolean gotException = false;
      try {
        func = client.getFunction(dbName, "nonexistent_func");
View Full Code Here

      createFunction(dbName, funcName, className, owner, ownerType, createTime, funcType, resList);

      // Try the different getters

      // getFunction()
      Function func = client.getFunction(dbName, funcName);
      assertEquals("function db name", dbName, func.getDbName());
      assertEquals("function name", funcName, func.getFunctionName());
      assertEquals("function class name", className, func.getClassName());
      assertEquals("function owner name", owner, func.getOwnerName());
      assertEquals("function owner type", PrincipalType.USER, func.getOwnerType());
      assertEquals("function type", funcType, func.getFunctionType());
      List<ResourceUri> resources = func.getResourceUris();
      assertEquals("Resource list size", resList.size(), resources.size());
      for (ResourceUri res : resources) {
        assertTrue("Matching resource " + res.getResourceType() + " " + res.getUri(),
            resList.indexOf(res) >= 0);
      }
View Full Code Here

  private void createFunction(String dbName, String funcName, String className,
      String ownerName, PrincipalType ownerType, int createTime,
      org.apache.hadoop.hive.metastore.api.FunctionType functionType, List<ResourceUri> resources)
          throws Exception {
    Function func = new Function(funcName, dbName, className,
        ownerName, ownerType, createTime, functionType, resources);
    client.createFunction(func);
  }
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.getMessage(), e);
          return null;
        }

        Class<?> udfClass = Class.forName(func.getClassName(), true, Utilities.getSessionSpecifiedClassLoader());
        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) {
      if (!((e.getCause() != null) && (e.getCause() instanceof MetaException)) &&
         (e.getCause().getCause() != null) && (e.getCause().getCause() instanceof NoSuchObjectException))  {
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

            + " 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

  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

    }
    return copy;
  }

  private Function deepCopy(Function func) {
    Function copy = null;
    if (func != null) {
      copy = new Function(func);
    }
    return copy;
  }
View Full Code Here

TOP

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

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.