wuwenchi commented on code in PR #5120:
URL: https://github.com/apache/iceberg/pull/5120#discussion_r905917174


##########
flink/v1.15/flink/src/test/java/org/apache/iceberg/flink/sink/TestPartitionUdf.java:
##########
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.flink.sink;
+
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+import java.util.List;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.table.api.TableEnvironment;
+import org.apache.flink.table.api.TableResult;
+import org.apache.flink.table.api.bridge.java.StreamTableEnvironment;
+import org.apache.flink.types.Row;
+import org.apache.flink.util.CloseableIterator;
+import org.apache.iceberg.expressions.Literal;
+import org.apache.iceberg.relocated.com.google.common.collect.Lists;
+import org.apache.iceberg.transforms.Transform;
+import org.apache.iceberg.transforms.Transforms;
+import org.apache.iceberg.types.Types;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestPartitionUdf {
+
+  public static TableEnvironment tEnv;
+
+  @BeforeClass
+  public static void before() {
+    StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
+    tEnv = StreamTableEnvironment.create(env);
+    tEnv.createTemporarySystemFunction("buckets", 
PartitionTransformUdf.Bucket.class);
+    tEnv.createTemporarySystemFunction("truncates", 
PartitionTransformUdf.Truncate.class);

Review Comment:
   eg:
   ```java
     // first, create iceberg catalog
     StreamExecutionEnvironment env = 
StreamExecutionEnvironment.getExecutionEnvironment();
     tEnv = StreamTableEnvironment.create(env);
     tEnv.executeSql("" +
             "CREATE CATALOG hive_catalog WITH (\n" +
             "    'type'='iceberg',\n" +
             "    'catalog-type'='hive',\n" +
             .....
             "  )");
       
       // second, call function by Precise Function Reference
       tEnv.executeSql("select hive_catalog.db.buckets(200, 12341)");        // 
you can use function directly by Precise Function Reference under hive_catalog
   
       // third, or call function by Ambiguous Function Reference
       tEnv.executeSql("use catalog hive_catalog");
       tEnv.executeSql("select buckets(200, 12341)");        // you can use 
function directly by Ambiguous Function Reference under hive_catalog
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to