luoyuxia commented on a change in pull request #17761:
URL: https://github.com/apache/flink/pull/17761#discussion_r761049005



##########
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
##########
@@ -635,12 +635,12 @@ private void validateAndPrepareFunction(CatalogFunction 
function)
         // it means it uses the old type inference. We assume that they have 
been validated before
         // being
         // wrapped.
-        if (function instanceof InlineCatalogFunction
-                && ((InlineCatalogFunction) function).getDefinition()
-                        instanceof UserDefinedFunction) {
-
-            FunctionDefinition definition = ((InlineCatalogFunction) 
function).getDefinition();
-            UserDefinedFunctionHelper.prepareInstance(config, 
(UserDefinedFunction) definition);
+        if (function instanceof InlineCatalogFunction) {
+            // Skip validate if the input is not instance of 
UserDefinedFunction.

Review comment:
       minor: validate => validation

##########
File path: 
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/FunctionCatalog.java
##########
@@ -635,12 +635,12 @@ private void validateAndPrepareFunction(CatalogFunction 
function)
         // it means it uses the old type inference. We assume that they have 
been validated before
         // being
         // wrapped.
-        if (function instanceof InlineCatalogFunction
-                && ((InlineCatalogFunction) function).getDefinition()
-                        instanceof UserDefinedFunction) {
-
-            FunctionDefinition definition = ((InlineCatalogFunction) 
function).getDefinition();
-            UserDefinedFunctionHelper.prepareInstance(config, 
(UserDefinedFunction) definition);
+        if (function instanceof InlineCatalogFunction) {
+            // Skip validate if the input is not instance of 
UserDefinedFunction.
+            if (((InlineCatalogFunction) function).getDefinition() instanceof 
UserDefinedFunction) {

Review comment:
       minor: we can avoid calling the code  ```((InlineCatalogFunction) 
function).getDefinition()``` twice.
   ```suggestion
              FunctionDefinition definition = ((InlineCatalogFunction) 
function).getDefinition();
              if (definition instanceof UserDefinedFunction) {
              }
   ```
   

##########
File path: 
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/functions/hive/HiveGenericUDTF.java
##########
@@ -157,4 +165,16 @@ public TypeInformation getResultType() {
     public void close() throws Exception {
         function.close();
     }
+
+    public static StandardStructObjectInspector 
getStandardStructObjectInspector(
+            ObjectInspector[] argumentInspectors) {
+        List<String> structFieldNames = new ArrayList<>();
+        for (int i = 0; i < argumentInspectors.length; i++) {
+            structFieldNames.add(String.valueOf(i));

Review comment:
       The column's name is meaningless, it's  a little of confused.
   
   Is it possible to get the column names if user specified while calling the 
UDTF?




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


Reply via email to