Snowpark Container Services: Changes to failed batch retry logic and new columns in the DESC FUNCTION command output (Preview)

Attention

This behavior change is in the 2025_02 bundle.

For the current status of the bundle, refer to Bundle History.

Changes to retry logic for a failed batch request

When you execute a query that includes a service function, Snowflake sends a series of HTTP requests, each containing a batch of rows to the service. If the service returns errors (the HTTP error 404, 429, 500, 502, 503, or 504), Snowflake retries the request. When Snowflake retries, it resends the same batch after a delay determined by an exponential backoff algorithm.

Before the change:

If the total sleep time between retries reaches one hour, Snowflake marks the batch execution as failed, and the service function execution fails as well.

After the change:

By default, Snowflake retries the failed batch three times. You can optionally specify the number of times you want Snowflake to retry the batch by executing the CREATE FUNCTION or ALTER FUNCTION command with the MAX_BATCH_RETRIES parameter. For example:

  • For the CREATE FUNCTION command, specify the MAX_BATCH_RETRIES parameter, as shown below:

    CREATE [ OR REPLACE ] FUNCTION <name> ( [ <arg_name> <arg_data_type> ] [ , ... ] )
      RETURNS <result_data_type>
      
      [ MAX_BATCH_RETRIES = <integer> ]
      AS '<http_path_to_request_handler>'
      
    
    Copy
  • For the ALTER FUNCTION command, use SET MAX_BATCH_RETRIES = integer to set the number of retries:

    ALTER FUNCTION [ IF EXISTS ] <name> ( [ <arg_data_type> , ... ] ) SET MAX_BATCH_RETRIES = <integer>
    
    Copy

DESCRIBE FUNCTION (Snowpark Container Services) command: New columns in output

When this behavior change bundle is enabled, the output of the DESCRIBE FUNCTION (Snowpark Container Services) command includes the following new columns:

Column name

Description

MAX_BATCH_RETRIES

The maximum number of retries for each batch of rows processed by the service function.

ON_BATCH_FAILURE

The service function’s behavior when a batch of rows reaches the maximum retry limit.

BATCH_TIMEOUT_SECS

The maximum time Snowflake waits for a single batch of rows to be processed (including retries and async request polling) before terminating the batch request.

Ref: 1938