SourabhBadhya commented on code in PR #4938:
URL: https://github.com/apache/hive/pull/4938#discussion_r1488915249
##########
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 think you could have fixed a bug here, is there a valid test case which
exposes this bug which can be added here?
##########
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.");
+ }
+ final Object value = ((ConstantObjectInspector)
args[0]).getWritableConstantValue();
+ if (value == null) {
+ throw new UDFArgumentException("The first argument of STACK() must not
be null.");
+ }
+ if (!(value instanceof IntWritable)) {
+ throw new UDFArgumentTypeException(
+ 0,
"The first argument to STACK() must be a constant integer (got " +
- args[0].getTypeName() + " instead).");
+ args[0].getTypeName() + " instead).");
Review Comment:
nit: Unnecessary change
##########
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.");
+ }
+ final Object value = ((ConstantObjectInspector)
args[0]).getWritableConstantValue();
+ if (value == null) {
+ throw new UDFArgumentException("The first argument of STACK() must not
be null.");
+ }
+ if (!(value instanceof IntWritable)) {
Review Comment:
Can a long be passed here (LongWritable)?
--
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]