Skip to content

Commit

Permalink
Refactor to clean-up annotations for udtf class methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-aalam committed Feb 27, 2024
1 parent 9021fb3 commit 013bab1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/snowflake/snowpark/_internal/udf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,10 +618,12 @@ def generate_python_code(
# annotations. However, we still serialize the original method because the extracted
# function will have an extra argument `cls` or `self` from the class.
if object_type == TempObjectType.TABLE_FUNCTION:
if is_pandas_udf:
annotated_funcs = [getattr(func, TABLE_FUNCTION_END_PARTITION_METHOD)]
else:
annotated_funcs = [getattr(func, TABLE_FUNCTION_PROCESS_METHOD)]
annotated_funcs = []
# clean-up annotations from process and end_partition methods if they are defined
if hasattr(func, TABLE_FUNCTION_PROCESS_METHOD):
annotated_funcs.append(getattr(func, TABLE_FUNCTION_PROCESS_METHOD))
if hasattr(func, TABLE_FUNCTION_END_PARTITION_METHOD):
annotated_funcs.append(getattr(func, TABLE_FUNCTION_END_PARTITION_METHOD))
elif object_type == TempObjectType.AGGREGATE_FUNCTION:
annotated_funcs = [
getattr(func, AGGREGATE_FUNCTION_ACCULUMATE_METHOD),
Expand Down

0 comments on commit 013bab1

Please sign in to comment.