-
Notifications
You must be signed in to change notification settings - Fork 121
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-1904191:[API Coverage] functions coverage #2964
Conversation
src/snowflake/snowpark/dataframe.py
Outdated
elif isinstance(e, (list, tuple, set)): | ||
for sub_e in e: | ||
names.append(sub_e._named()) | ||
if _emit_ast and _ast_stmt is None: | ||
ast_cols.append(sub_e._ast) |
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.
how does this change affect this new funcs?
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.
json_tuple will have to return a list of columns, while our select function currently does not support this form of call:
df.select(col1, [col2,col3]), this is meant to support it
CHANGELOG.md
Outdated
- `array_slice` | ||
- `try_to_binary` |
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.
did this change get removed?
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.
+ need to update functions.rst?
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 found out that we already support it, so I removed it from this PR
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.
minor fixes about _emit_ast
. Please also take a review from IR team.
src/snowflake/snowpark/functions.py
Outdated
max_bit = bitshiftleft(lit(1), 64) | ||
unsigned_c = iff(c < 0, bitshiftright(c + max_bit, n), bitshiftright(c, n)) | ||
return call_builtin("bitand", unsigned_c, max_bit - 1, _emit_ast=_emit_ast) |
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.
max_bit = bitshiftleft(lit(1), 64) | |
unsigned_c = iff(c < 0, bitshiftright(c + max_bit, n), bitshiftright(c, n)) | |
return call_builtin("bitand", unsigned_c, max_bit - 1, _emit_ast=_emit_ast) | |
max_bit = bitshiftleft(lit(1, _emit_ast=False), 64, _emit_ast=False) | |
unsigned_c = iff(c < 0, bitshiftright(c + max_bit, n, _emit_ast=False), bitshiftright(c, n, _emit_ast=False), _emit_ast=False) | |
return call_builtin("bitand", unsigned_c, max_bit - 1, _emit_ast=_emit_ast) |
let's make sure that for all internal calls to our functions, we set _emit_ast=False
src/snowflake/snowpark/functions.py
Outdated
""" | ||
c = _to_col_if_str(col, "json_tuple") | ||
return [ | ||
json_extract_path_text(parse_json(c), lit(field)).as_(f"c{i}") |
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.
same here, _emit_ast=False
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.
Please add expectation tests in the mentioned files, use the suggested helper functions from ast.utils
, and see notes about json_tuple
.
08643fc
to
dcc317c
Compare
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-1904191
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Please write a short description of how your code change solves the related issue.