Skip to content

Fix TIMESTAMP_NTZ cast not stripping timezone#116

Open
rampage644 wants to merge 1 commit intomainfrom
rampage644/fix-timestamp-ntz-cast
Open

Fix TIMESTAMP_NTZ cast not stripping timezone#116
rampage644 wants to merge 1 commit intomainfrom
rampage644/fix-timestamp-ntz-cast

Conversation

@rampage644
Copy link
Copy Markdown
Contributor

Summary

  • CAST(convert_timezone(...) AS TIMESTAMP_NTZ) was returning timestamp_tz instead of timestamp_ntz because to_timestamp_ntz had early-return paths that preserved the input type's timezone. Fixed both return_field_from_args and invoke_with_args to apply the function's timezone policy (self.timezone()) which returns None for NTZ variants, correctly stripping the timezone.

Test plan

  • All 21 convert_timezone integration tests pass
  • All 8 to_timestamp integration tests pass (snapshot updated)
  • All 26 to_timestamp unit tests pass
  • Full executor suite: 358 pass, 0 fail
  • Manual QA via snowflake-connector-python: convert_timezone(...)::TIMESTAMP_NTZ returns correct datetime without timezone

🤖 Generated with Claude Code

to_timestamp_ntz had early-return paths in return_field_from_args and
invoke_with_args that preserved the input timestamp type as-is, including
its timezone. This caused convert_timezone(...)::TIMESTAMP_NTZ to return
timestamp_tz instead of timestamp_ntz. Now both paths apply the function's
timezone policy via self.timezone(), which returns None for NTZ variants.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant