zhangbo 1 년 전
부모
커밋
7809bc87ae
2개의 변경된 파일38개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      MyFirstUDF/.gitignore
  2. 37 0
      MyFirstUDF/src/main/java/com/alidata/odps/udtf/examples/jiebafenci.java

+ 1 - 0
MyFirstUDF/.gitignore

@@ -0,0 +1 @@
+.idea/*

+ 37 - 0
MyFirstUDF/src/main/java/com/alidata/odps/udtf/examples/jiebafenci.java

@@ -0,0 +1,37 @@
+package com.alidata.odps.udtf.examples;
+import com.aliyun.odps.udf.ExecutionContext;
+import com.aliyun.odps.udf.UDFException;
+import com.aliyun.odps.udf.UDTF;
+import com.aliyun.odps.udf.annotation.Resolve;
+import com.huaban.analysis.jieba.JiebaSegmenter;
+import java.util.*;
+
+// TODO define input and output types, e.g. "string,string->string,bigint".
+@Resolve({"string,string->string,string"})
+public class jiebafenci extends UDTF {
+
+    @Override
+    public void setup(ExecutionContext ctx) throws UDFException {
+
+    }
+
+    @Override
+    public void process(Object[] args) throws UDFException {
+        // TODO
+        String a = (String) args[0];
+        String content = (String) args[1];
+        JiebaSegmenter segmenter = new JiebaSegmenter();
+        List<String> result = segmenter.sentenceProcess(content);
+
+
+        for (String t: result) {
+            forward(a, t);
+        }
+    }
+
+    @Override
+    public void close() throws UDFException {
+
+    }
+
+}