andygrove opened a new issue, #385:
URL: https://github.com/apache/datafusion-spark/issues/385

   ## Is your feature request related to a problem or challenge?
   
   `SparkInputTypes` declares exactly one type per argument, and `coerce` 
rejects any other number of arguments. Two common patterns in Spark don't fit 
that:
   
   - **Variadic arguments.** For example, `inputTypes = 
Seq.fill(children.size)(StringType)` or `IntegerType +: Seq.fill(children.size 
- 1)(...)`, as in `concat_ws`, `elt` and the hash functions.
   - **Optional arguments.** These come from an `ExpressionBuilder` or an 
auxiliary constructor with a default, for example `round(expr)` meaning 
`round(expr, 0)`, `to_binary(str)` and `make_dt_interval` with 0 to 4 
arguments. For any other count Spark raises `WRONG_NUM_ARGS` and lists the 
counts it accepts.
   
   #353 lists `elt` and `concat_ws` as waiting for variadic support.
   
   ## Describe the solution you'd like
   
   Extend `SparkInputTypes` with:
   
   - a variadic tail: a type repeated for the remaining arguments, with a 
minimum count
   - optional trailing arguments, so that a function can declare `[Numeric, 
Integer?]`
   
   and produce Spark's `WRONG_NUM_ARGS` message for each case. The function 
would still supply the default value for an omitted argument itself.
   
   ## Describe alternatives you've considered
   
   Keep a separate `SparkInputTypes` for each supported argument count and pick 
one in `coerce_types`. That works for optional arguments, but not for variadic 
ones.
   
   ## Additional context
   
   Part of #346 and #353.
   


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