老熟女激烈的高潮_日韩一级黄色录像_亚洲1区2区3区视频_精品少妇一区二区三区在线播放_国产欧美日产久久_午夜福利精品导航凹凸

重慶分公司,新征程啟航

為企業提供網站建設、域名注冊、服務器等服務

為hivepermanentfunction添加默認database特性

前言

hive 0.13開始增加了permanent function;允許用戶自定義的function無需往.hiverc文件中添加create temporary function,提高hive的啟動時間(無需預先執行創建臨時函數命令);并且可以將udf jar包放置于hdfs上,方便管理,無需向hive client端推送udf;但是permanent function有一個問題,就是,需要在function名前添加database名稱,即[database].[function];如果不填寫database,這會取當前database自動補全function。

十多年的常熟網站建設經驗,針對設計、前端、開發、售后、文案、推廣等六對一服務,響應快,48小時及時工作處理。網絡營銷推廣的優勢是能夠根據用戶設備顯示端的尺寸不同,自動調整常熟建站的顯示方式,使網站能夠適用不同顯示終端,在瀏覽器中調整網站的寬度,無論在任何一種瀏覽器上瀏覽網站,都能展現優雅布局與設計,從而大程度地提升瀏覽體驗。成都創新互聯從事“常熟網站設計”,“常熟網站推廣”以來,每個客戶項目都認真落實執行。

參照傳統的關系型數據庫,一般存在默認的schema,在搜索function時,優先搜索默認的schema;如iopostgresql的pg_catalog等。因此想著為Hive添加default database這個特性。

設計

添加兩個參數

hive.function.default.function.enabled  默認為:false,表示禁用此特性;設置為true,表示啟動該特性;搜索函數時,優先查找默認database。

hive.function.default.function 默認為: default;當hive.function.default.function.enabled=true時生效;默認函數搜索路徑。

實現

需要添加這個功能,需要了解permanent function在什么時候會用當前database,補全function。

FunctionRegistry.java

private static FunctionInfo getFunctionInfoFromMetastore(String functionName) {
    FunctionInfo ret = null;

    try {
      String dbName;
      String fName;
      if (FunctionUtils.isQualifiedFunctionName(functionName)) {
        String[] parts = FunctionUtils.splitQualifiedFunctionName(functionName);
        dbName = parts[0];
        fName = parts[1];
      } else {
        // otherwise, qualify using current db
        dbName = SessionState.get().getCurrentDatabase().toLowerCase();
        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))  {
         LOG.info("Unable to lookup UDF in metastore: " + e);
      }
    } catch (ClassNotFoundException e) {
      // Lookup of UDf class failed
      LOG.error("Unable to load UDF class: " + e);
    }

    return ret;
  }

 

  public static String getNormalizedFunctionName(String fn) {
    // Does the same thing as getFunctionInfo, except for getting the function info.
    fn = fn.toLowerCase();
    return (FunctionUtils.isQualifiedFunctionName(fn) || mFunctions.get(fn) != null) ? fn
        : FunctionUtils.qualifyFunctionName(
            fn, SessionState.get().getCurrentDatabase().toLowerCase());
  }

  private static  T getFunctionInfo(
      Map mFunctions, String functionName) {
    functionName = functionName.toLowerCase();
    T functionInfo = null;
    if (FunctionUtils.isQualifiedFunctionName(functionName)) {
      functionInfo = getQualifiedFunctionInfo(mFunctions, functionName);
    } else {
      // First try without qualifiers - would resolve builtin/temp functions.
      // Otherwise try qualifying with current db name.
      functionInfo =  mFunctions.get(functionName);
      if (functionInfo == null && !FunctionUtils.isQualifiedFunctionName(functionName)) {
        String qualifiedName = FunctionUtils.qualifyFunctionName(functionName,
            SessionState.get().getCurrentDatabase().toLowerCase());
        functionInfo = getQualifiedFunctionInfo(mFunctions, qualifiedName);
      }
    }
    return functionInfo;
  }

 

FunctionUtils.java

  public static String[] getQualifiedFunctionNameParts(String name) throws HiveException {
    if (isQualifiedFunctionName(name)) {
      return splitQualifiedFunctionName(name);
    }
    String dbName = SessionState.get().getCurrentDatabase();
    return new String[] { dbName, name };
  }

在這些代碼上添加一個判斷hive.function.default.function.enabled是否為true,如果為true,則將默認dbName調整為hive.function.default.function。


新聞標題:為hivepermanentfunction添加默認database特性
當前路徑:http://www.xueling.net.cn/article/popdch.html

其他資訊

在線咨詢
服務熱線
服務熱線:028-86922220
TOP
主站蜘蛛池模板: 成人无码av免费网站 | 日韩色网址 | 人人妻人人玩人人澡人人爽 | 欧洲一级黄 | 国产精品无码首页自拍 | 桃花视频大全不卡免费观看网站 | 午夜精品一区二区三区在线视 | 久久美女色视频 | 最新精品露脸国产在线 | 国产精品日韩三级 | 日韩免费一区二区三区高清 | 亚洲播放在线 | 麻豆传谋在线观看免费 | av免费网站在线观看 | 男女做爰裸体猛烈吃奶摸视频 | 狠狠躁夜夜躁人人爽天天69 | 69堂视频 | 军营医生(1976) | 99精品视频在线免费观看 | 精品二区在线观看 | 日韩综合色 | 羞辱尤娜3中文版 | 91看片网页| 国产一级高清视频 | 免费av手机在线观看 | 亚洲第一综合色 | 亚洲精品aaaaa | 国产一级片不卡 | 香蕉人妻av久久久久天天 | 人成免费网站 | 五月婷婷六月丁香动漫 | 国产精品va无码二区 | 人妻阿敏被老外玩弄系列 | 国产精品免费视频一区 | 欧美videosdesexo吹潮 | 国产精品激情综合五月天中文字幕 | 亚洲美女视频在线 | 日韩三级高清 | 久久77777| 九九久久久久久久久激情 | www.女女网导航.com |