1.20.0 (2024-07-17)
Snowpark Python API Updates
Improvements
- Added distributed tracing using open telemetry APIs for table stored procedure function in
DataFrame
:_execute_and_get_query_id
- Added support for the
arrays_zip
function. - Improves performance for binary column expression and
df._in
by avoiding unnecessary cast for numeric values. You can enable this optimization by settingsession.eliminate_numeric_sql_value_cast_enabled = True
. - Improved error message for
write_pandas
when the target table does not exist andauto_create_table=False
. - Added open telemetry tracing on UDxF functions in Snowpark.
- Added open telemetry tracing on stored procedure registration in Snowpark.
- Added a new optional parameter called
format_json
to theSession.SessionBuilder.app_name
function that sets the app name in theSession.query_tag
in JSON format. By default, this parameter is set toFalse
.
Bug Fixes
- Fixed a bug where SQL generated for
lag(x, 0)
was incorrect and failed with error messageargument 1 to function LAG needs to be constant, found 'SYSTEM$NULL_TO_FIXED(null)'
.
Snowpark Local Testing Updates
New Features
- Added support for the following APIs:
- snowflake.snowpark.functions
- random
- snowflake.snowpark.functions
- Added new parameters to
patch
function when registering a mocked function:distinct
allows an alternate function to be specified for when a sql function should be distinct.pass_column_index
passes a named parametercolumn_index
to the mocked function that contains the pandas.Index for the input data.pass_row_index
passes a named parameterrow_index
to the mocked function that is the 0 indexed row number the function is currently operating on.pass_input_data
passes a named parameterinput_data
to the mocked function that contains the entire input dataframe for the current expression.- Added support for the
column_order
parameter to methodDataFrameWriter.save_as_table
.
Bug Fixes
- Fixed a bug that caused DecimalType columns to be incorrectly truncated to integer precision when used in BinaryExpressions.
Snowpark pandas API Updates
New Features
- Added support for
DataFrameGroupBy.all
,SeriesGroupBy.all
,DataFrameGroupBy.any
, andSeriesGroupBy.any
. - Added support for
DataFrame.nlargest
,DataFrame.nsmallest
,Series.nlargest
andSeries.nsmallest
. - Added support for
replace
andfrac > 1
inDataFrame.sample
andSeries.sample
. - Added support for
read_excel
(Uses local pandas for processing) - Added support for
Series.at
,Series.iat
,DataFrame.at
, andDataFrame.iat
. - Added support for
Series.dt.isocalendar
. - Added support for
Series.case_when
except when condition or replacement is callable. - Added documentation pages for
Index
and its APIs. - Added support for
DataFrame.assign
. - Added support for
DataFrame.stack
. - Added support for
DataFrame.pivot
andpd.pivot
. - Added support for
DataFrame.to_csv
andSeries.to_csv
. - Added partial support for
Series.str.translate
where the values in thetable
are single-codepoint strings. - Added support for
DataFrame.corr
. - Allow
df.plot()
andseries.plot()
to be called, materializing the data into the local client - Added support for
DataFrameGroupBy
andSeriesGroupBy
aggregationsfirst
andlast
- Added support for
DataFrameGroupBy.get_group
. - Added support for
limit
parameter whenmethod
parameter is used infillna
. - Added partial support for
Series.str.translate
where the values in thetable
are single-codepoint strings. - Added support for
DataFrame.corr
. - Added support for
DataFrame.equals
andSeries.equals
. - Added support for
DataFrame.reindex
andSeries.reindex
. - Added support for
Index.astype
. - Added support for
Index.unique
andIndex.nunique
.
Bug Fixes
- Fixed an issue when using np.where and df.where when the scalar 'other' is the literal 0.
- Fixed a bug regarding precision loss when converting to Snowpark pandas
DataFrame
orSeries
withdtype=np.uint64
. - Fixed bug where
values
is set toindex
whenindex
andcolumns
contain all columns in DataFrame duringpivot_table
.
Improvements
- Added support for
Index.copy()
- Added support for Index APIs:
dtype
,values
,item()
,tolist()
,to_series()
andto_frame()
- Expand support for DataFrames with no rows in
pd.pivot_table
andDataFrame.pivot_table
. - Added support for
inplace
parameter inDataFrame.sort_index
andSeries.sort_index
.