Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-45891][SQL][FOLLOW-UP] Added length check to the is_variant_nu…
…ll expression ### What changes were proposed in this pull request? Added a check in the `is_variant_null` expression where the length of the value field is verified to be greater than zero. If the length is zero, a `MALFORMED_VARIANT` exception is thrown. ### Why are the changes needed? Earlier, `is_variant_null` was simply checking if the first byte of a variant value was zero. However, if the value field is empty, the first byte logically doesn't exist and therefore, it could result in undefined behavior. Such a case should ideally never be seen but it could appear in the case of data corruption. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Additional unit test to check if the zero-length variant throws an exception. ### Was this patch authored or co-authored using generative AI tooling? No Closes #46311 from harshmotw-db/is_variant_null_fix. Authored-by: Harsh Motwani <harsh.motwani@databricks.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
- Loading branch information