bowenli86 commented on a change in pull request #9988: [FLINK-14418][hive] 
Create HiveModule to provide Hive built-in functions
URL: https://github.com/apache/flink/pull/9988#discussion_r342240835
 
 

 ##########
 File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/client/HiveShimV120.java
 ##########
 @@ -168,4 +175,44 @@ public CatalogColumnStatisticsDataDate 
toFlinkDateColStats(ColumnStatisticsData
                        throw new CatalogException("Failed to create Flink 
statistics for date column", e);
                }
        }
+
+       @Override
+       public Set<String> listBuiltInFunctions() {
+               try {
+                       Method method = 
FunctionRegistry.class.getMethod("getFunctionNames");
+                       // getFunctionNames is a static method
+                       Set<String> names = (Set<String>) method.invoke(null);
+
+                       return names.stream()
+                               .filter(n -> 
isBuiltInFunctionInfo(getFunctionInfo(n)))
+                               .collect(Collectors.toSet());
+               } catch (Exception ex) {
+                       throw new CatalogException("Failed to invoke 
FunctionRegistry.getFunctionNames()", ex);
+               }
+       }
+
+       @Override
+       public Optional<FunctionInfo> getBuiltInFunctionInfo(String name) {
+               FunctionInfo functionInfo = getFunctionInfo(name);
+
+               return isBuiltInFunctionInfo(functionInfo) ? 
Optional.of(functionInfo) : Optional.empty();
 
 Review comment:
   good catch. I fixed that part, and added UT. Pls take another look

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to