snowpark-python icon indicating copy to clipboard operation
snowpark-python copied to clipboard

SNOW-1235478: local test to_time support more data conversion

Open sfc-gh-aling opened this issue 1 year ago • 0 comments

Please answer these questions before submitting your pull requests. Thanks!

  1. What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-1235478

  2. Fill out the following pre-review checklist:

    • [ ] I am adding a new automated test(s) to verify correctness of my new code
    • [ ] I am adding new logging messages
    • [ ] I am adding a new telemetry message
    • [ ] I am adding new credentials
    • [ ] I am adding a new dependency
  3. Please describe how your code solves the related issue.

    Please write a short description of how your code change solves the related issue.

support to_time according to: https://docs.snowflake.com/en/sql-reference/functions/to_time#arguments

  • For string_expr, the result of converting the string to a time.
  • For timestamp_expr, the time portion of the input value.
  • For 'integer' (a string containing an integer), the integer is treated as a number of seconds, milliseconds, microseconds, or nanoseconds after the start of the Unix epoch
  • For variant_expr:
    • If the variant contains a string in TIME format (‘HH:MI:SS’), a string conversion is performed.
    • If the variant contains a string in INTEGER format, a string conversion is performed and the value is treated as the number of seconds since midnight (modulus 86400 if necessary).
    • If the variant contains JSON null value, the output is NULL.

sfc-gh-aling avatar Apr 04 '24 23:04 sfc-gh-aling