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


##########
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDTFStack.java:
##########
@@ -109,15 +118,15 @@ public StructObjectInspector initialize(ObjectInspector[] 
args)
 
   @Override
   public void process(Object[] args)
-      throws HiveException, UDFArgumentException {
+      throws HiveException {
     for (int ii = 0; ii < numRows.get(); ++ii) {
       for (int jj = 0; jj < numCols; ++jj) {
         int index = ii * numCols + jj + 1;
         if (index < args.length) {
           forwardObj[jj] = 
             returnOIResolvers.get(jj).convertIfNecessary(args[index], 
argOIs.get(index));
         } else {
-          forwardObj[ii] = null;
+          forwardObj[jj] = null;

Review Comment:
   I added a new statement to 
`ql/src/test/queries/clientpositive/udtf_stack.q`. The SQL on the current 
master can't return the correct result.
   
   ```
   0: jdbc:hive2://hive-hiveserver2:10000/defaul> SELECT STACK(2, 'a', 'b', 
'c', 'd', 'e');
   ...
   +-------+-------+-------+
   | col0  | col1  | col2  |
   +-------+-------+-------+
   | a     | b     | c     |
   | d     | NULL  | c     |
   +-------+-------+-------+
   ```
   
   This is the correct result.
   
   ```
   POSTHOOK: query: SELECT STACK(2, 'a', 'b', 'c', 'd', 'e')
   POSTHOOK: type: QUERY
   POSTHOOK: Input: _dummy_database@_dummy_table
   #### A masked pattern was here ####
   a    b       c
   d    e       NULL
   ```



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