dtenedor opened a new pull request, #45319:
URL: https://github.com/apache/spark/pull/45319
### What changes were proposed in this pull request?
This PR creates an API for 'analyze' method to differentiate constant NULL
arguments and other types of arguments.
### Why are the changes needed?
Before this PR, each `AnalyzeArgument` had a `value` field which was
non-None if the argument was a constant-foldable scalar expression:
```
@dataclass(frozen=True)
class AnalyzeArgument:
"""
The argument for Python UDTF's analyze static method.
Parameters
----------
dataType : :class:`DataType`
The argument's data type
value : any, optional
The calculated value if the argument is foldable; otherwise None
isTable : bool
If True, the argument is a table argument.
"""
dataType: DataType
value: Optional[Any]
isTable: bool
```
However, it was also `None` if the argument is literal NULL.
Now we add a new field to tell the difference:
```
isConstantExpression : bool
If True, the argument is a constant-foldable scalar expression. Then the
'value' field
contains None if the argument is a NULL literal, or a non-None value if
the argument is a
non-NULL literal. In this way, we can distinguish between a literal NULL
argument and other
types of arguments such as complex expression trees or table arguments
where the 'value'
field is always None.
```
### Does this PR introduce _any_ user-facing change?
Yes, see above.
### How was this patch tested?
This PR applies test coverage.
### Was this patch authored or co-authored using generative AI tooling?
No.
--
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]