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-1552377: Add support for flatmap using udtf #2812

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
- `nullifzero`
- `snowflake_cortex_sentiment`
- Added `Catalog` class to manage snowflake objects. It can be accessed via `Session.catalog`.
- Added new methods in class `DataFrame`:
- `col_regex`: Select columns that match with provided regex.
- `map` and its alias `foreach`: A method to apply user function on each row with 1-1 mapping.
- `flat_map`: A method to apply user function on each row with one to many mapping.
- `toJSON` and its alias `to_json`: Convert each row of dataframe into json string.
- `transform`: Chain multiple transformations on dataframe.

#### Improvements

Expand Down Expand Up @@ -63,8 +69,6 @@
#### New Features

- Added support for property `version` and class method `get_active_session` for `Session` class.
- Added new methods in class `DataFrame`:
- `col_regex`: Select columns that match with provided regex.
- Added support for property `version` and class method `get_active_session` for `Session` class.
- Added new methods and variables to enhance data type handling and JSON serialization/deserialization:
- To `DataType`, its derived classes, and `StructField`:
Expand All @@ -84,7 +88,6 @@
- `collect_list` an alias of `array_agg`.
- `substring` makes `len` argument optional.
- Added parameter `ast_enabled` to session for internal usage (default: `False`).
- Added support for `Dataframe.toJSON`

#### Improvements

Expand Down
2 changes: 2 additions & 0 deletions docs/source/snowpark/dataframe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ DataFrame
DataFrame.fillna
DataFrame.filter
DataFrame.first
DataFrame.flat_map
DataFrame.flatMap
DataFrame.flatten
DataFrame.groupBy
DataFrame.group_by
Expand Down
8 changes: 5 additions & 3 deletions src/snowflake/snowpark/_internal/analyzer/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def analyze(
if isinstance(expr, WindowSpecDefinition):
return window_spec_expression(
[
self.analyze(
self.to_sql_try_avoid_cast(
x, df_aliased_col_name_to_real_col_name, parse_local_name
)
for x in expr.partition_spec
Expand Down Expand Up @@ -456,7 +456,7 @@ def analyze(
return table_function_partition_spec(
expr.over,
[
self.analyze(
self.to_sql_try_avoid_cast(
x, df_aliased_col_name_to_real_col_name, parse_local_name
)
for x in expr.partition_spec
Expand Down Expand Up @@ -623,7 +623,9 @@ def table_function_expression_extractor(
"NamedArgumentsTableFunction, GeneratorTableFunction, or FlattenFunction."
)
partition_spec_sql = (
self.analyze(expr.partition_spec, df_aliased_col_name_to_real_col_name)
self.to_sql_try_avoid_cast(
expr.partition_spec, df_aliased_col_name_to_real_col_name
)
if expr.partition_spec
else ""
)
Expand Down
Loading
Loading