okumin commented on code in PR #4938:
URL: https://github.com/apache/hive/pull/4938#discussion_r1426123007


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDTFStack.java:
##########
@@ -63,13 +64,21 @@ public StructObjectInspector initialize(ObjectInspector[] 
args)
     }
     if (!(args[0] instanceof ConstantObjectInspector)) {
       throw new UDFArgumentException(
+          "The first argument to STACK() must be a constant.");

Review Comment:
   The first argument, # of rows to be generated from a single row, defines the 
final schema. That's why it must be evaluated at compile time.
   
   ```
   0: jdbc:hive2://hive-hiveserver2:10000/defaul> select stack(2, 'a', 'b', 
'c', 'd', 'e', 'f');
   ...
   +-------+-------+-------+
   | col0  | col1  | col2  |
   +-------+-------+-------+
   | a     | b     | c     |
   | d     | e     | f     |
   +-------+-------+-------+
   2 rows selected (3.979 seconds)
   0: jdbc:hive2://hive-hiveserver2:10000/defaul> select stack(3, 'a', 'b', 
'c', 'd', 'e', 'f');
   ...
   +-------+-------+
   | col0  | col1  |
   +-------+-------+
   | a     | b     |
   | c     | d     |
   | e     | f     |
   +-------+-------+
   ```



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