Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1348700 Fix to_char's implementation when incoming column has inconsecutive row index #1702

Merged
merged 4 commits into from
Jun 5, 2024

Conversation

sfc-gh-stan
Copy link
Collaborator

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

    Fixes SNOW-1348700

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
  3. Please describe how your code solves the related issue.

Previously the implementation of mock_to_char relies on the incoming column has index of [0,1,...,n-1], this is not always true and causes the code raise IndexError, this PR fixes that and adds a test for this specific scenario.

@sfc-gh-stan sfc-gh-stan added the local testing Local Testing issues/PRs label May 29, 2024
@sfc-gh-stan sfc-gh-stan requested a review from a team as a code owner May 29, 2024 20:51
@sfc-gh-stan sfc-gh-stan force-pushed the stan-fix-mock-to-char-implementation branch from f539181 to 6cb0faa Compare May 29, 2024 20:52
@sfc-gh-stan sfc-gh-stan requested review from sfc-gh-aling and sfc-gh-jrose and removed request for sfc-gh-sfan May 29, 2024 20:53
CHANGELOG.md Outdated
Comment on lines 3 to 40
## 1.18.1 (TBD)

### Snowpark Python API Updates

#### New Features

#### Improvements

### Snowpark pandas API Updates

#### New Features

#### Improvements

#### Bug Fixes

### Snowpark Local Testing Updates

#### Breaking changes

### New Features

#### Bug Fixes

- Fixed a bug in mock implementation of `to_char` that raises `IndexError` when incoming column has inconsecutive row index.

#### Improvements

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: there is a 1.19.0 section now

@@ -1027,7 +1025,7 @@ def convert_char(row):
)

# row index information is needed to retrieve format information in another pd series, thus calling to_frame here
res = column.to_frame().apply(convert_char, axis=1)
res = column.combine(fmt, convert_char)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_to_timestamp implementation also uses column.to_frame(), should we fix that as well?
I'm good with either fixing in this PR or having another PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created #1740.

@sfc-gh-stan sfc-gh-stan force-pushed the stan-fix-mock-to-char-implementation branch from 6cb0faa to 1cbcce9 Compare June 5, 2024 20:44
@sfc-gh-stan sfc-gh-stan enabled auto-merge (squash) June 5, 2024 22:02
@sfc-gh-stan sfc-gh-stan merged commit f8b4b89 into main Jun 5, 2024
34 checks passed
@sfc-gh-stan sfc-gh-stan deleted the stan-fix-mock-to-char-implementation branch June 5, 2024 22:13
@github-actions github-actions bot locked and limited conversation to collaborators Jun 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
local testing Local Testing issues/PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants