apache/iceberg · error · UnsupportedOperationException
Wrong number of inputs (expected value)
Error message
Wrong number of inputs (expected value)
What it means
UnaryUnboundFunction is the base class for Iceberg's single-argument Spark transform functions (days, months, hours, years, etc.). Its valueType() checks that exactly one argument was supplied; if zero or multiple arguments are passed, binding fails with this UnsupportedOperationException. This is an argument-count (arity) error raised during query analysis before doBind type checks run.
Source
Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/functions/UnaryUnboundFunction.java:39
import org.apache.spark.sql.connector.catalog.functions.BoundFunction;
import org.apache.spark.sql.connector.catalog.functions.UnboundFunction;
import org.apache.spark.sql.types.DataType;
import org.apache.spark.sql.types.StructType;
/** An unbound function that accepts only one argument */
abstract class UnaryUnboundFunction implements UnboundFunction {
@Override
public BoundFunction bind(StructType inputType) {
DataType valueType = valueType(inputType);
return doBind(valueType);
}
protected abstract BoundFunction doBind(DataType valueType);
private DataType valueType(StructType inputType) {
if (inputType.size() != 1) {
throw new UnsupportedOperationException("Wrong number of inputs (expected value)");
}
return inputType.fields()[0].dataType();
}
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Supply exactly one argument: days(ts_col).
- Remove extra arguments if more than one was passed.
- Verify the intended function — some Iceberg functions like bucket/truncate need two arguments, unary ones need one.
- Run DESCRIBE FUNCTION <fn> to confirm the expected arity.
Example fix
// before SELECT days(ts_col, 'UTC') FROM t // after SELECT days(ts_col) FROM t
Defensive patterns
Strategy: validation
Validate before calling
// Spark Scala — for any unary Iceberg transform (days/months/hours/years)
val args: Seq[Column] = Seq(col)
require(args.size == 1, s"unary transform requires exactly 1 argument, got ${args.size}") Try / catch
try {
df.select(expr("days(ts_col)"))
} catch {
case e: UnsupportedOperationException if e.getMessage.contains("Wrong number of inputs (expected value)") =>
throw new IllegalArgumentException("This Iceberg transform takes exactly one value argument", e)
} Prevention
- Confirm arity with DESCRIBE FUNCTION <name> before calling
- Pass exactly one column/expression to days/months/hours/years
- Fix SQL generators that emit empty or multi-value argument lists
- Remember only bucket() and truncate() take two arguments among Iceberg transforms
When it happens
Trigger: Calling a unary Iceberg transform with the wrong number of arguments, e.g. days() with no argument or days(a, b) with two; typo'd function names routing arguments to a unary function.
Common situations: Generated/templated SQL emitting empty argument lists; confusing Spark built-ins that take different arities with Iceberg transform functions; copy-paste errors adding extra arguments.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Wrong number of inputs (expected width and value)
- Wrong number of inputs (expected width and value)
- Wrong number of inputs (expected value)
- Wrong number of inputs (expected numBuckets and value)
- Cannot bind: %s does not accept arguments
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/dc812e18b56c5749.
Report an issue: GitHub.