You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "mohammadsubhani (via GitHub)" <gi...@apache.org> on 2026/07/24 04:39:22 UTC

[PR] [SPARK-58296][SQL] Fix to_time return type with null format [spark]

mohammadsubhani opened a new pull request, #57489:
URL: https://github.com/apache/spark/pull/57489

   ### What changes were proposed in this pull request?
   
   This PR changes `ToTime` to return a null literal typed as `TimeType` when its
   foldable format argument evaluates to null.
   
   It also adds regression coverage for SQL and Column API calls. The shared test
   runs with both ANSI mode enabled and disabled.
   
   ### Why are the changes needed?
   
   When a foldable null format was provided, `ToTime` created its null result using
   the format expression's data type. Since the format argument is a string
   expression, the result was incorrectly typed as `STRING` instead of `TIME`.
   
   `to_time` must preserve its declared `TIME` result type even when the format
   argument causes the result value to be null.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. For expressions such as `to_time('00:00:00', NULL)`, the result value
   remains null, but its schema is now correctly reported as `TIME` instead of
   `STRING`.
   
   ### How was this patch tested?
   
   Added a regression test and ran it in both ANSI configurations:
   
   ```bash
   build/sbt \
     'sql/testOnly org.apache.spark.sql.TimeFunctionsAnsiOnSuite -- -z "SPARK-58296"' \
     'sql/testOnly org.apache.spark.sql.TimeFunctionsAnsiOffSuite -- -z "SPARK-58296"'
   ```
   
   Both tests passed.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-5)
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-58296][SQL] Fix to_time return type with null format [spark]

Posted by "mohammadsubhani (via GitHub)" <gi...@apache.org>.
mohammadsubhani closed pull request #57489: [SPARK-58296][SQL] Fix to_time return type with null format
URL: https://github.com/apache/spark/pull/57489


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org