rkrishn7 opened a new issue, #15394: URL: https://github.com/apache/datafusion/issues/15394
### Describe the bug It was found in #15242 that the nullability of `Literal` is simply based on its scalar value and does not take its nullability in the input schema into account. ### To Reproduce This issue cannot be seen in the CLI, as it doesn't do any strict type checking of record batches when displaying results. However, it can be observed in SLTs where `normalize::convert_batches` ensures that each record batch's schema is the same as that of the first batch. Take the following query for example: ``` select x, y, z from t3 union all by name select z, y, x, 'd' as zz from t3; ``` `UNION` is a case where record batch streams from each input will be merged into an output stream. `zz` should be considered as nullable in the output schema because it is not found in the lhs. However, the current behavior is that record batches streamed from the rhs do not have `zz` as null because of the current implementation of `PhysicalExpr::nullable` for `Literal`. ### Expected behavior The nullability of `Literal` should be determined by its surrounding context _and_ value, not only its value. ### Additional context _No response_ -- 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: github-unsubscr...@datafusion.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org