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


##########
flink/v1.15/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java:
##########
@@ -162,20 +168,33 @@ public List<String> listDatabases() throws 
CatalogException {
         .collect(Collectors.toList());
   }
 
+  private void registerPartitionFunction(String databaseName) {
+    functions.putIfAbsent(
+        new ObjectPath(databaseName, 
PartitionTransformUdf.Bucket.FUNCTION_NAME),
+        new CatalogFunctionImpl(
+            PartitionTransformUdf.Bucket.class.getName(), 
FunctionLanguage.JAVA));
+    functions.putIfAbsent(
+        new ObjectPath(databaseName, 
PartitionTransformUdf.Truncate.FUNCTION_NAME),
+        new CatalogFunctionImpl(
+            PartitionTransformUdf.Truncate.class.getName(), 
FunctionLanguage.JAVA));
+  }
+
   @Override
   public CatalogDatabase getDatabase(String databaseName)
       throws DatabaseNotExistException, CatalogException {
     if (asNamespaceCatalog == null) {
       if (!getDefaultDatabase().equals(databaseName)) {
         throw new DatabaseNotExistException(getName(), databaseName);
       } else {
+        registerPartitionFunction(databaseName);
         return new CatalogDatabaseImpl(Maps.newHashMap(), "");
       }
     } else {
       try {
         Map<String, String> metadata =
             
Maps.newHashMap(asNamespaceCatalog.loadNamespaceMetadata(toNamespace(databaseName)));
         String comment = metadata.remove("comment");
+        registerPartitionFunction(databaseName);

Review Comment:
   I don't see why `system` would be different than any other database. It 
should be a normal database.



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