Skip to content

Commit 461fd3c

Browse files
SNOW-1830603 UDTFs for the decoder (#2930)
1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR. Fixes SNOW-1830603 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. - [x] I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: [Thread-safe Developer Guidelines](https://github.com/snowflakedb/snowpark-python/blob/main/CONTRIBUTING.md#thread-safe-development) 3. Please describe how your code solves the related issue. - Got UDTFs to work - changed the UDTF test (will prob go through another change in the future and will make a change to this test in main then). - got RelationalGroupedDataFrame to work - added a way to reset the recorded callables and their IDs
1 parent a9baad2 commit 461fd3c

File tree

7 files changed

+538
-327
lines changed

7 files changed

+538
-327
lines changed

src/snowflake/snowpark/_internal/ast/batch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def reset_id_gen(self) -> None:
7272
"""Resets the ID generator."""
7373
self._id_gen = itertools.count(start=1)
7474

75+
def reset_callables(self) -> None:
76+
"""Resets the callables."""
77+
self._callables = {}
78+
7579
def assign(self, symbol: Optional[str] = None) -> proto.Assign:
7680
"""
7781
Creates a new assignment statement.

src/snowflake/snowpark/relational_grouped_dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ def end_partition(self, pdf: pandas.DataFrame) -> pandas.DataFrame:
423423
_apply_in_pandas_udtf = self._dataframe._session.udtf.register(
424424
_ApplyInPandas,
425425
output_schema=output_schema,
426-
_emit_ast=_emit_ast,
426+
_emit_ast=False,
427427
**kwargs,
428428
)
429429
partition_by = [Column(expr, _emit_ast=False) for expr in self._grouping_exprs]

src/snowflake/snowpark/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ def json_value(self) -> Dict[str, Any]:
784784
def _fill_ast(self, ast: proto.SpDataType) -> None:
785785
ast.sp_struct_type.structured = self.structured
786786
for field in self.fields:
787-
field._fill_ast(ast.sp_struct_type.fields.add())
787+
field._fill_ast(ast.sp_struct_type.fields.list.add())
788788

789789

790790
class VariantType(DataType):

0 commit comments

Comments
 (0)