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


##########
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:
   Question: I see the functions are being registered in the catalog itself 
already.
   
   Is this necessary whenever a user wants to use a function, to re-register it?
   
   Ideally we have a single registration option so things are uniform in my 
opinion. The `bucket` and `truncate` functions are universally needed when 
working with Iceberg (though clearly only in some situations).
   
   Also, for naming, is it possible that we might clash with some other name 
(if we registered the functions for people)?
   
   I’m working on function registration in Spark so we should ideally get our 
names somewhat stabilized and similar.
   
   I would propose `iceberg_bucket` and `iceberg_truncate` but need to better 
understand how it is used. Also would like to hear from users on this aspect. 
If the function is prefaced with a catalog name, maybe `iceberg_` isn’t needed 
but from the examples that doesn’t seem to be the case. However, I’m not sure 
the tests are using the functions from the catalog or if this registration path 
is different.



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