-
Notifications
You must be signed in to change notification settings - Fork 116
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-1491306 Phase 0 AST for DataFrame first, sample, and random_split #1813
Merged
sfc-gh-vbudati
merged 14 commits into
server-side-snowpark
from
vbudati/SNOW-1491306-df-first-sample-random-split
Jul 16, 2024
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
b39ac0b
first test
sfc-gh-vbudati 80f26af
added tests
sfc-gh-vbudati f43e196
Update proto files and test
sfc-gh-vbudati a964155
tests work now
sfc-gh-vbudati bfea5b7
update test
sfc-gh-vbudati d63b752
Merge branch 'server-side-snowpark' into vbudati/SNOW-1491306-df-firs…
sfc-gh-vbudati 46477d1
Merge branch 'refs/heads/server-side-snowpark' into vbudati/SNOW-1491…
sfc-gh-vbudati 718f674
update ast_pb2.py
sfc-gh-vbudati 69f2f45
Merge server-side-snowpark into current branch
sfc-gh-vbudati 3b3e883
Merge branch 'server-side-snowpark' into vbudati/SNOW-1491306-df-firs…
sfc-gh-vbudati 8b31ec6
update ast_pb2
sfc-gh-vbudati c1d023c
merge snowpark-server-side into current branch
sfc-gh-vbudati 262227c
update tests
sfc-gh-vbudati d995568
got all tests to work
sfc-gh-vbudati File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,177 changes: 593 additions & 584 deletions
1,177
src/snowflake/snowpark/_internal/proto/ast_pb2.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
## TEST CASE | ||
|
||
df = session.table("test_table") | ||
|
||
df1 = df.first(-5) | ||
|
||
df2 = df.first(2) | ||
|
||
df3 = df.first() | ||
|
||
## EXPECTED OUTPUT | ||
|
||
res1 = session.table("test_table") | ||
|
||
res2 = res1.first(-5, True) | ||
|
||
res3 = res1.first(2, True) | ||
|
||
res4 = res1.first(1, True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## TEST CASE | ||
|
||
df = session.table("test_table") | ||
|
||
weights = [0.1, 0.2, 0.3] | ||
|
||
df2 = df.random_split(weights) | ||
|
||
df3 = df.random_split(weights, seed=24) | ||
|
||
## EXPECTED OUTPUT | ||
|
||
res1 = session.table("test_table") | ||
|
||
res2 = res1.random_split([0.1, 0.2, 0.3]) | ||
|
||
res4 = res1.random_split([0.1, 0.2, 0.3], 24) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## TEST CASE | ||
|
||
df = session.table("test_table") | ||
|
||
df = df.sample(n=3) | ||
|
||
df = df.sample(frac=0.5) | ||
|
||
## EXPECTED OUTPUT | ||
|
||
res1 = session.table("test_table") | ||
|
||
res2 = res1.sample(None, 3) | ||
|
||
res3 = res2.sample(0.5, None) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test will not pass right now since the Local History code has not implemented any "random" functionality yet. A NotImplementedError is raised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still true? One way or another, we should make sure that all (not disabled) checked in tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have run into this in a number of recent APIs as well. I've been able to get around this by checking session._conn._suppress_not_implemented_error, which is a new connection property I've added. In many places, I just return None if suppression is enabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sfc-gh-azwiegincew I'm still unable to get this test to pass. Now, the NotImplementedError is not raised but instead a KeyError is raised:
What should I do to get around this? Should I try to
catch
the error and check if it's a KeyError with this message?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
random_split()
, right after creating the AST, say something along the lines ofif self._conn._suppress_not_implemented_error: return None