{"id":5432,"date":"2023-04-24T19:56:07","date_gmt":"2023-04-24T11:56:07","guid":{"rendered":"https:\/\/ixyzero.com\/blog\/?p=5432"},"modified":"2023-04-24T19:56:07","modified_gmt":"2023-04-24T11:56:07","slug":"hive-genericudf-%e7%9a%84%e4%b8%80%e4%b8%aa%e7%ae%80%e5%8d%95%e6%a0%b7%e4%be%8b","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/5432.html","title":{"rendered":"Hive GenericUDF \u7684\u4e00\u4e2a\u7b80\u5355\u6837\u4f8b"},"content":{"rendered":"\n<p>=Start=<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u7f18\u7531\uff1a<\/h4>\n\n\n\n<p>\u4e4b\u524d\u7528\u57fa\u7840\u7684 UDF \u63a5\u53e3\u5199\u8fc7UDF\u7a0b\u5e8f\uff0c\u4f46\u6ca1\u6709\u5199\u8fc7\u590d\u6742\u70b9\u7684 GenericUDF \uff0c\u6709\u8fd9\u4e2a\u60f3\u6cd5\u4f46\u4e00\u76f4\u6ca1\u6709\u5b9e\u9645\u53bb\u5199\uff0c\u4e00\u6765\u6ca1\u6709\u76f4\u63a5\u7684\u52a8\u529b\u2014\u2014\uff08\u7b80\u5355\u7684\u7528SQL\u5b9e\u73b0\uff0c\u590d\u6742\u70b9\u7684\u7528UDF\u5b9e\u73b0\uff0c\u4e3a\u4ec0\u4e48\u8fd8\u8981\u7528GenericUDF\u6765\u5199\uff1f\uff09\uff0c\u4e8c\u6765\u6ca1\u6709\u7b80\u5355\u6e05\u6670\u7684\u6587\u6863\u548c\u4ee3\u7801\uff08\u4e0d\u50cfUDF\u90a3\u6837\uff0c\u53ea\u9700\u8981\u7ee7\u627fUDF\uff0c\u7136\u540e\u5b9e\u73b0evaluate()\u65b9\u6cd5\u5c31\u884c\u4e86\uff0c\u4e4b\u524d\u641c\u5230\u7684\u4e2d\u6587\u8d44\u6599\u4e0d\u591a\uff0c\u4e5f\u53ef\u80fd\u662f\u6ca1\u6709\u7528\u5bf9\u5173\u952e\u5b57\uff09\u3002<\/p>\n\n\n\n<p>\u4f46\u524d\u6bb5\u65f6\u95f4\u5728\u8dd1\u6570\u636e\u7684\u65f6\u5019\u53d1\u73b0\u7528\u4e86UDF\u548c\u6ca1\u7528UDF\u7684SQL\u8fd0\u884c\u65f6\u95f4\u76f8\u5dee\u6570\u500d\uff0c\u8ba9\u6211\u5728\u60f3\u662f\u4e0d\u662f\u57fa\u7840\u7684 UDF \u63a5\u53e3\u6027\u80fd\u4e0d\u597d\u5bfc\u81f4\uff08\u56e0\u4e3a\u5728\u6700\u5f00\u59cb\u641c\u8d44\u6599\u7684\u65f6\u5019\u5927\u6982\u770b\u5230\u8fc7\u8fd9\u6837\u7684\u63cf\u8ff0\uff09\uff1f\u56e0\u6b64\u6700\u8fd1\u53c8\u82b1\u4e86\u4e00\u4e9b\u65f6\u95f4\u7b80\u5355\u5b66\u4e60\u4e86\u4e00\u4e0b GenericUDF \u7684\u5199\u6cd5\uff0c\u5728\u6b64\u505a\u4e2a\u8bb0\u5f55\uff0c\u65b9\u4fbf\u4ee5\u540e\u53c2\u8003\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u6b63\u6587\uff1a<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">\u53c2\u8003\u89e3\u7b54\uff1a<\/h5>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">\u5982\u679c\u4f60\u60f3\u5b9e\u9645\u6d4b\u8bd5\/\u9a8c\u8bc1\u4f60\u5199\u7684UDF\u5bf9\u6027\u80fd\u635f\u8017\u662f\u4e0d\u662f\u5f88\u5927\uff08\u6216\u8005\u51c6\u786e\u70b9\u8bf4\u662f\u533a\u5206\u56e0\u4e3aUDF\u91cc\u589e\u52a0\u7684\u903b\u8f91\u5bfc\u81f4\u7684\u6027\u80fd\u635f\u8017\u8fd8\u662f\u5355\u5355\u56e0\u4e3a\u4f7f\u7528\u4e86UDF\u589e\u52a0\u7684\u6027\u80fd\u635f\u8017\uff09\uff0c<strong>\u53ef\u4ee5\u5148\u7528\u4e00\u4e2a\u57fa\u672c\u6ca1\u4ec0\u4e48\u7279\u6b8a\u529f\u80fd\u7684UDF\u505a\u4e00\u4e2a\u57fa\u51c6<\/strong>\uff0c\u7136\u540e\u518d\u5bf9\u6bd4\u52a0\u4e0a\u5176\u5b83\u903b\u8f91\u7684UDF\u4e4b\u540e\u7684\u67e5\u8be2\u8017\u65f6\u6709\u6ca1\u6709\u660e\u663e\u589e\u52a0\u3002<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">UDF \u548c GenericUDF \u7684\u7b80\u5355\u5bf9\u6bd4<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>UDF\n\u5f00\u53d1\u8d77\u6765\u6bd4\u8f83\u7b80\u5355\uff0c\u53ea\u9700\u8981\u7ee7\u627fUDF\uff0c\u7136\u540e\u5b9e\u73b0evaluate()\u65b9\u6cd5\u5c31\u884c\u3002 Easier to develop\n\u56e0\u4e3a\u4f7f\u7528\u4e86\u53cd\u5c04\uff0c\u6240\u4ee5\u6027\u80fd\u6bd4\u8f83\u4f4e\u3002 Lower performance due to use of reflection\n\u4e0d\u652f\u6301\u4e00\u4e9b\u975e\u57fa\u672c\u7c7b\u578b\u7684\u53c2\u6570\u3002 Doesn't accept some non-primitive parameters like struct\n\nGenericUDF\n\u5f00\u53d1\u8d77\u6765\u4f1a\u590d\u6742\u4e00\u70b9\uff0c\u76f8\u6bd4UDF\u591a\u4e862\u4e2a\u8981\u5b9e\u73b0\u7684\u65b9\u6cd5\uff1ainitialize \u548c getDisplayString\uff0c\u5b83\u4eec\u8bbe\u7f6e\u4e86\u4e00\u4e2a ObjectInspector \u5e76\u5f53\u9519\u8bef\u53d1\u751f\u65f6\u4f1a\u5c55\u793a\u4e00\u4e9b\u4fe1\u606f\u3002 A little more difficult to develop\n\u6027\u80fd\u6bd4UDF\u66f4\u597d\uff0c\u56e0\u4e3a\u4f7f\u7528\u5ef6\u8fdf\u548c\u77ed\u8def\u6267\u884c\u3002 Better performance because use of lazy evaluation and short-circuiting\n\u652f\u6301\u6240\u6709\u975e\u539f\u8bed\u53c2\u6570\u4f5c\u4e3a\u8f93\u5165\u53c2\u6570\u548c\u8fd4\u56de\u7c7b\u578b\u3002 Supports all non-primitive parameters as input parameters and return types<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">GenericUDF \u8981\u5b9e\u73b0\u7684\u65b9\u6cd5\u4ecb\u7ecd<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>org.apache.hadoop.hive.ql.udf.generic.GenericUDF\n\u590d\u6742\u7684 GenericUDF \u53ef\u4ee5\u5904\u7406 Map\u3001List\u3001Set \u7c7b\u578b\u3002\n\n# GenericUDF\nGenericUDF \u5b9e\u73b0\u6bd4\u8f83\u590d\u6742\uff0c\u9700\u8981\u5148\u7ee7\u627f GenericUDF\u3002\u8fd9\u4e2a API \u9700\u8981\u64cd\u4f5c Object Inspectors\uff0c\u5e76\u4e14\u8981\u5bf9\u63a5\u6536\u7684\u53c2\u6570\u7c7b\u578b\u548c\u6570\u91cf\u8fdb\u884c\u68c0\u67e5\u3002GenericUDF \u9700\u8981\u5b9e\u73b0\u4ee5\u4e0b\u4e09\u4e2a\u65b9\u6cd5\uff1a\n\nabstract ObjectInspector initialize(ObjectInspector&#91;] arguments);\n# Initialize this GenericUDF. This will be called once and only once per GenericUDF instance.\n# \u8fd9\u4e2a\u65b9\u6cd5\u53ea\u8c03\u7528\u4e00\u6b21\uff0c\u5e76\u4e14\u5728evaluate()\u65b9\u6cd5\u4e4b\u524d\u8c03\u7528\u3002\u8be5\u65b9\u6cd5\u63a5\u53d7\u7684\u53c2\u6570\u662f\u4e00\u4e2a ObjectInspectors \u6570\u7ec4\u3002\u8be5\u65b9\u6cd5\u68c0\u67e5\u63a5\u53d7\u6b63\u786e\u7684\u53c2\u6570\u7c7b\u578b\u548c\u53c2\u6570\u4e2a\u6570\u3002\n\nabstract Object evaluate(GenericUDF.DeferredObject&#91;] arguments);\n# Evaluate the GenericUDF with the arguments.\n# \u8fd9\u4e2a\u65b9\u6cd5\u7c7b\u4f3c UDF \u7684 evaluate() \u65b9\u6cd5\u3002\u5b83\u5904\u7406\u771f\u5b9e\u7684\u53c2\u6570\uff0c\u5e76\u8fd4\u56de\u6700\u7ec8\u7ed3\u679c\u3002\n\nabstract String getDisplayString(String&#91;] children);\n# Get the String to be displayed in explain.\n# \u8fd9\u4e2a\u65b9\u6cd5\u7528\u4e8e\u5f53\u5b9e\u73b0\u7684 GenericUDF \u51fa\u9519\u7684\u65f6\u5019\uff0c\u6253\u5370\u51fa\u63d0\u793a\u4fe1\u606f\u3002\u800c\u63d0\u793a\u4fe1\u606f\u5c31\u662f\u4f60\u5b9e\u73b0\u8be5\u65b9\u6cd5\u6700\u540e\u8fd4\u56de\u7684\u5b57\u7b26\u4e32\u3002<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u7528 GenericUDF \u5b9e\u73b0\u7684\u63d0\u53d6SQL\u5b57\u7b26\u4e32\u4e2d\u7684limit\u9650\u5236\u6570\u503c<\/h5>\n\n\n\n<pre class=\"wp-block-code\"><code>package com.ixyzero.hive.udf.utils;\n\nimport org.apache.hadoop.hive.ql.exec.Description;\nimport org.apache.hadoop.hive.ql.exec.UDFArgumentException;\nimport org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;\nimport org.apache.hadoop.hive.ql.metadata.HiveException;\nimport org.apache.hadoop.hive.ql.udf.generic.GenericUDF;\nimport org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;\nimport org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;\nimport org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector;\n\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\n\/**\n * @author ixyzero\n * Created on 2023-04-15\n *\/\n\n@Description(name = \"get_limit_size\",\n        value = \"_FUNC_(str) - Get limit size from *search* sql string.\",\n        extended = \"The value is returned as a string, or NULL if the argument was NULL.\\n\"\n                + \"Example:\\n\"\n                + \"  &gt; SELECT _FUNC_('select * from tbl where col1 = 11 LIMIT 1000;');\\n\"\n                + \"  '1000'\\n\")\n\npublic class getSqlLimitSizeGUDF extends GenericUDF {\n\n    private static final Pattern commentaryPattern = Pattern.compile(\"\/\\\\\\\\*.*?\\\\\\\\*\/|--.*?\", Pattern.DOTALL);\n    private static final Pattern limitPattern = Pattern.compile(\"\\\\s+limit\\\\s+(\\\\d+)\\\\s*(,|offset)?\\\\s*(\\\\d*)\\\\s*\", Pattern.CASE_INSENSITIVE);\n\n    private ObjectInspector&#91;] argOIs;\n\n    @Override\n    public ObjectInspector initialize(ObjectInspector&#91;] objectInspectors) throws UDFArgumentException {\n        \/\/ 1. \u68c0\u67e5\u53c2\u6570\u4e2a\u6570\uff0c\u6709\u95ee\u9898\u629b\u51fa\u5f02\u5e38\u5373\u53ef\n        if (objectInspectors.length != 1) {\n            throw new UDFArgumentLengthException(\"get_limit_size() only take 1 parameter\");\n        }\n\n        \/\/ 2. \u68c0\u67e5\u53c2\u6570\u7c7b\u578b\uff0c\u6709\u95ee\u9898\u629b\u51fa\u5f02\u5e38\u5373\u53ef\n        ObjectInspector objectInspector = objectInspectors&#91;0];\n        if ( !(objectInspector instanceof StringObjectInspector) ) {\n            throw new UDFArgumentException(\"the first argument must be a string\");\n        }\n\n        argOIs = objectInspectors;\n        \/\/ 3. \u8fd4\u56de\u4e00\u4e2a ObjectInspector \u7c7b\u578b\u7684\u53d8\u91cf\uff0c\u4f46\u597d\u50cf\u4e5f\u6ca1\u6709\u5176\u5b83\u5730\u65b9\u63a5\u6536\u5e76\u5904\u7406\u8fd9\u4e2a\u53d8\u91cf\uff0c\u6240\u4ee5\u76f4\u63a5\u8fd4\u56denull\u4e5f\u884c\n        \/\/ return null;\n        return PrimitiveObjectInspectorFactory.javaStringObjectInspector;\n    }\n\n    @Override\n    public Object evaluate(DeferredObject&#91;] deferredObjects) throws HiveException {\n        \/\/ \u4e0b\u97623\u884c\u7684\u4f5c\u7528\u5176\u5b9e\u5c31\u662f\u4ece\u901a\u8fc7initialize\u68c0\u67e5\u7684\u53c2\u6570\u4e2d\u63d0\u53d6\u5e76\u8f6c\u6362\u6210Java\u7f16\u7a0b\u4e2d\u5e38\u89c1\u7684\u6570\u636e\u7c7b\u578b\u65b9\u4fbf\u540e\u9762\u7684\u5f00\u53d1\n        Object tmp = deferredObjects&#91;0].get();\n        StringObjectInspector strObjectInspector = (StringObjectInspector) argOIs&#91;0]; \/\/ ok\uff0c\u8fd9\u4e00\u6b65\u5bb9\u6613\u51fa\u9519\uff0c\u56e0\u4e3a\u4e0d\u6e05\u695a\u7ec6\u8282\n        \/\/ StringObjectInspector strObjectInspector = (StringObjectInspector) deferredObjects&#91;0]; \/\/ ClassCastException\n        String sql = strObjectInspector.getPrimitiveJavaObject(tmp);\n\n        if (sql == null || sql.trim().isEmpty()) {\n            return null;\n        }\n        sql = commentaryPattern.matcher(sql).replaceAll(\"\").toLowerCase();\n        String ret = null;\n\n        try {\n            Matcher m = limitPattern.matcher(sql);\n            if (m.find()) {\n                if (m.group(2) == null) {\n                    ret = m.group(1);\n                } else if (m.group(2).equalsIgnoreCase(\"offset\")) {\n                    ret = m.group(1);\n                } else {\n                    ret = m.group(3);\n                }\n            } else {\n                return null;\n            }\n        } catch (Exception e) {\n            \/\/ e.printStackTrace();\n            return null;\n        }\n\n        return ret;\n    }\n\n    @Override\n    public String getDisplayString(String&#91;] strings) {\n        return \"get_limit_size(sql)\";\n    }\n\n    public static void main(String&#91;] args) {\n        \/\/ \u56e0\u4e3a\u7ee7\u627f\u81ea GenericUDF \u548c UDF \u4e0d\u592a\u4e00\u6837\uff0c\u591a\u4e862\u4e2a\u8981 override \u7684\u51fd\u6570\uff0c\u6240\u4ee5\u66f4\u6539\u6210\u5e38\u89c4\u7c7b\u518d\u6d4b\u8bd5\u9700\u8981\u53d8\u66f4\u7684\u5730\u65b9\u6bd4\u8f83\u591a\n        \/\/ \u8fd9\u91cc\u5c31\u4e0d\u6d4b\u8bd5\u5177\u4f53\u7684\u4ee3\u7801\u903b\u8f91\u4e86\uff0c\u56e0\u4e3a\u5728\u5176\u5b83\u7684\u5730\u65b9\u9a8c\u8bc1\u8fc7\uff0c\u8fd9\u91cc\u4e3b\u8981\u662f\u7b80\u5355\u8dd1\u901a\u4e00\u4e0b GenericUDF \u7f16\u5199\u7684\u6d41\u7a0b\uff0c\u771f\u7684\u662f\u592a\u9ebb\u70e6\n        \/\/ \u9ebb\u70e6\u5728\u4e8e\u53d8\u91cf\u7684\u7c7b\u578b\u662f ObjectInspector\/DeferredObject \u8fd9\u79cd\uff0c\u5728\u7528\u5e38\u89c4Java\u4ee3\u7801\u5904\u7406\u4e4b\u524d\u9700\u8981\u5148\u8fdb\u884c\u7c7b\u578b\u8f6c\u6362\n        \/\/ \u5bf9\u4e8e\u8f6c\u6362\u65b9\u6cd5\u4e0d\u719f\u6089\u7684\u4eba\u6765\u8bf4\u771f\u7684\u662f\u5f88\u5bb9\u6613\u8e29\u5751\u548c\u5d29\u6e83\u2014\u2014\u672c\u8eab\u903b\u8f91\u4e0d\u590d\u6742\uff0c\u4f46\u5728\u5e94\u4ed8\u8fd9\u4e9b\u7c7b\u578b\u8f6c\u6362\u4e0a\u9762\u8fd8\u771f\u7684\u662f\u975e\u5e38\u9ebb\u70e6\u548c\u590d\u6742\n    }\n    \/\/ \u9664\u4e86\u76f4\u63a5\u53ef\u89c1\u7684\u591a\u4e862\u4e2a\u8981\u7ee7\u627f\u7684\u51fd\u6570 initialize\/getDisplayString \u4e4b\u5916\n    \/\/ \u6211\u4e2a\u4eba\u901a\u8fc7\u4e0a\u9762\u8fd9\u4e00\u6bb5\u4ee3\u7801\u7684\u7f16\u5199\u548c\u6d4b\u8bd5\uff0c\u53d1\u73b0\u6700\u5927\u7684\u95ee\u9898\u5176\u5b9e\u662f\u5728 ObjectInspector \u8fd9\u79cd\u65b0\u51fa\u73b0\u7684\u53d8\u91cf\u7c7b\u578b\u7684\u68c0\u67e5\u5224\u65ad\u548c\u5185\u5bb9\u63d0\u53d6\n    \/\/ \u6700\u6700\u76f4\u63a5\u7684\u5c31\u662f\u5728\u4e0a\u9762 evaluate \u51fd\u6570\u5f00\u59cb\u7684\u90a33\u884c\u91cc\u9762\uff0c\u4e00\u5f00\u59cb\u5b8c\u5168\u60f3\u4e0d\u5230\u5b83\u7684\u5165\u53c2\u53ea\u662f\u4ea4\u7ed9getPrimitiveJavaObject \u63d0\u53d6\u7c7b\u578b\u7684\u4fe1\u606f\n    \/\/ \u771f\u6b63\u7684\u5185\u5bb9\u9700\u8981\u7528\u4e00\u4e2a\u5168\u5c40\u53d8\u91cf\u4ece initialize \u51fd\u6570\u90a3\u91cc\u8d4b\u503c\uff0c\u7136\u540e\u7ecf\u8fc7\u4e00\u4e9b\u7c7b\u578b\u8f6c\u6362\u624d\u80fd\u8fdb\u884c\u540e\u9762\u7684\u5e38\u89c4\u7f16\u7801\u64cd\u4f5c\n    \/\/ \u4e0d\u8fc7\u8fd9\u79cd\u5751\u8e29\u8fc7\u4e00\u4e24\u6b21\u4e4b\u540e\u597d\u50cf\u4e5f\u5c31\u4e0d\u662f\u5927\u95ee\u9898\u4e86\uff0c\u4e5f\u8bb8\u548c\u6211\u5f53\u524d\u6ca1\u6709\u5199\u8fc7\u66f4\u590d\u6742\u7684UDF\u6709\u5173\uff0c\u540e\u9762\u5982\u679c\u9700\u8981\u7684\u8bdd\u627e\u4e13\u95e8\u7684\u6570\u636e\u5f00\u53d1\u540c\u5b66\u6765\u505a\u4f1a\u66f4\u5408\u9002\n}<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">\u53c2\u8003\u94fe\u63a5\uff1a<\/h5>\n\n\n\n<p>Hive UDF\u7684\u7f16\u5199<br><a href=\"https:\/\/ixyzero.com\/blog\/archives\/4782.html\">https:\/\/ixyzero.com\/blog\/archives\/4782.html<\/a><\/p>\n\n\n\n<p>\u63d0\u53d6SQL\u4e2d\u7684limit\u9650\u5236\u6570\u503c<br><a href=\"https:\/\/ixyzero.com\/blog\/archives\/5428.html\">https:\/\/ixyzero.com\/blog\/archives\/5428.html<\/a><\/p>\n\n\n\n<p>Hive UDF \u7b80\u4ecb #nice<br><a href=\"https:\/\/www.hadoopdoc.com\/hive\/hive-udf-intro\">https:\/\/www.hadoopdoc.com\/hive\/hive-udf-intro<\/a><\/p>\n\n\n\n<p>How to write a Hive UDF<br><a href=\"http:\/\/mark.thegrovers.ca\/tech-blog\/how-to-write-a-hive-udf\">http:\/\/mark.thegrovers.ca\/tech-blog\/how-to-write-a-hive-udf<\/a><\/p>\n\n\n\n<p>Using Hive Advanced User Defined Functions with Generic and Complex Data Types<br><a href=\"https:\/\/www.bmc.com\/blogs\/using-hive-advanced-user-defined-functions-with-generic-and-complex-data-types\/\">https:\/\/www.bmc.com\/blogs\/using-hive-advanced-user-defined-functions-with-generic-and-complex-data-types\/<\/a><\/p>\n\n\n\n<p>Class GenericUDF<br><a href=\"https:\/\/docs.cloudera.com\/HDPDocuments\/HDP2\/HDP-2.1.2\/hive_javadocs\/ql\/org\/apache\/hadoop\/hive\/ql\/udf\/generic\/GenericUDF.html\">https:\/\/docs.cloudera.com\/HDPDocuments\/HDP2\/HDP-2.1.2\/hive_javadocs\/ql\/org\/apache\/hadoop\/hive\/ql\/udf\/generic\/GenericUDF.html<\/a><\/p>\n\n\n\n<p>GenericUDFStringToMap.java #\u53ef\u4ee5\u53c2\u8003\u7528\u4e8e\u540e\u9762\u5b66\u4e60\u590d\u6742\u7684GenericUDF\u65f6\u53d8\u91cf\u7c7b\u578b\u8f6c\u6362\u548c\u5904\u7406\u7684\u903b\u8f91<br><a href=\"https:\/\/github.com\/apache\/hive\/blob\/master\/ql\/src\/java\/org\/apache\/hadoop\/hive\/ql\/udf\/generic\/GenericUDFStringToMap.java\">https:\/\/github.com\/apache\/hive\/blob\/master\/ql\/src\/java\/org\/apache\/hadoop\/hive\/ql\/udf\/generic\/GenericUDFStringToMap.java<\/a><\/p>\n\n\n\n<p>GenericUDFInstr.java<br><a href=\"https:\/\/github.com\/apache\/hive\/blob\/master\/ql\/src\/java\/org\/apache\/hadoop\/hive\/ql\/udf\/generic\/GenericUDFInstr.java\">https:\/\/github.com\/apache\/hive\/blob\/master\/ql\/src\/java\/org\/apache\/hadoop\/hive\/ql\/udf\/generic\/GenericUDFInstr.java<\/a><\/p>\n\n\n\n<p>Hive\u4e4bObjectInspector\u8be6\u89e3<br><a href=\"https:\/\/blog.csdn.net\/weixin_42167895\/article\/details\/108314139\">https:\/\/blog.csdn.net\/weixin_42167895\/article\/details\/108314139<\/a><\/p>\n\n\n\n<p>DeveloperGuide<br><a href=\"https:\/\/cwiki.apache.org\/confluence\/display\/hive\/developerguide#DeveloperGuide-UDFsandUDAFs-howtoaddnewUDFsandUDAFs\">https:\/\/cwiki.apache.org\/confluence\/display\/hive\/developerguide#DeveloperGuide-UDFsandUDAFs-howtoaddnewUDFsandUDAFs<\/a><\/p>\n\n\n\n<p>=END=<\/p>\n","protected":false},"excerpt":{"rendered":"<p>=Start= \u7f18\u7531\uff1a \u4e4b\u524d\u7528\u57fa\u7840\u7684 UDF \u63a5\u53e3\u5199\u8fc7UDF\u7a0b\u5e8f\uff0c\u4f46\u6ca1\u6709\u5199\u8fc7\u590d\u6742\u70b9\u7684 GenericUDF \uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23,7,12],"tags":[1940,1939,1261,1941,1262,1560],"class_list":["post-5432","post","type-post","status-publish","format-standard","hentry","category-knowledgebase-2","category-programing","category-tools","tag-evaluate","tag-genericudf","tag-hive","tag-objectinspector","tag-sql","tag-udf"],"views":2996,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/5432","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=5432"}],"version-history":[{"count":1,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/5432\/revisions"}],"predecessor-version":[{"id":5433,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/5432\/revisions\/5433"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=5432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=5432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=5432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}