Skip to content

Commit 9759bcd

Browse files
committed
add missing max_batch_size arg
1 parent c751179 commit 9759bcd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/snowflake/snowpark/udf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,7 @@ def register_from_file(
708708
replace: bool = False,
709709
if_not_exists: bool = False,
710710
parallel: int = 4,
711+
max_batch_size: Optional[int] = None,
711712
strict: bool = False,
712713
secure: bool = False,
713714
external_access_integrations: Optional[List[str]] = None,
@@ -788,6 +789,12 @@ def register_from_file(
788789
command. The default value is 4 and supported values are from 1 to 99.
789790
Increasing the number of threads can improve performance when uploading
790791
large UDF files.
792+
max_batch_size: The maximum number of rows per input pandas DataFrame or pandas Series
793+
inside a vectorized UDF. Because a vectorized UDF will be executed within a time limit,
794+
which is `60` seconds, this optional argument can be used to reduce the running time of
795+
every batch by setting a smaller batch size. Note that setting a larger value does not
796+
guarantee that Snowflake will encode batches with the specified number of rows. It will
797+
be ignored when registering a non-vectorized UDF.
791798
strict: Whether the created UDF is strict. A strict UDF will not invoke the UDF if any input is
792799
null. Instead, a null value will always be returned for that row. Note that the UDF might
793800
still return null for non-null inputs.
@@ -851,7 +858,7 @@ def register_from_file(
851858
replace,
852859
if_not_exists,
853860
parallel,
854-
max_batch_size=None,
861+
max_batch_size=max_batch_size,
855862
strict=strict,
856863
secure=secure,
857864
external_access_integrations=external_access_integrations,

0 commit comments

Comments
 (0)