Snowpark Library for Scala and Java release notes for 2022

This article contains the release notes for the Snowpark Library for Scala and Snowpark Library for Java, including the following when applicable:

  • 行为变更
  • 新功能
  • 面向客户的错误修复

Snowflake uses semantic versioning for Snowpark Library for Scala and Java updates.

See Snowpark Developer Guide for Java and Snowpark Developer Guide for Scala for documentation.

版本 1.6.2(2022 年 10 月 26 日)

兼容的 Snowflake 版本:6.35.x

改进

  • 对用 Java 或 Scala 编写的存储过程进行了内部改进。

版本 1.6.1(2022 年 9 月 30 日)

兼容的 Snowflake 版本:6.31.x

此版本存在一个已知问题,该问题可能会中断临时对象的创建。请改用 1.6.2。

改进

  • 对用 Java 或 Scala 编写的存储过程进行了内部改进。

版本 1.6.0(2022 年 8 月 12 日)

兼容的 Snowflake 版本:6.27.x

改进

  • 对 UDTFs 进行了内部改进。

版本 1.5.0(2022 年 7 月 1 日)

兼容的 Snowflake 版本:6.22.x

新功能

  • Added support for writing DataFrames to files on a stage to the Scala API and Java API.

改进

  • 优化了 Snowpark 客户端库生成的 SQL 查询。
  • 改进了 Snowpark 库无法解析列名称时记录的错误消息
  • DataFrame(例如,当您尝试访问不存在的列时)。

版本 1.4.1(2022 年 5 月 26 日)

兼容的 Snowflake 版本:6.17.x

变更

  • Updated the version of jackson-core and jackson-annotations that the Snowpark library depends on to 2.13.2.

  • Updated the version of jackson-databind that the Snowpark library depends on to 2.13.2.2.

  • Removed the jackson-core, jackson-databind, and jackson-annotations classes from Snowpark JAR file.

    If you downloaded the .tar.gz / .zip file, the JAR files for the Jackson classes are now provided separately in the lib/ subdirectory (jackson-core-2.13.2.jar, jackson-databind-2.13.2.2.jar, and jackson-annotations-2.13.2.jar).

    If you are specifying the Snowpark library as a dependency in your pom.xml file and you want to depend on a different version of the Jackson libraries in your pom.xml, you can exclude the dependency on the Jackson libraries from the Snowpark library dependency (https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html#dependency-exclusions).

版本 1.4.0(2022 年 4 月 28 日)

兼容的 Snowflake 版本:6.14.x

新功能

  • Snowpark Java API 已在 AWS 和 Azure 上正式发布。
  • API 仍可作为 GCS 上的预览功能使用。
  • Snowpark Scala API 已在 Azure 上正式发布。

在此版本之前, API 仅在 AWS 上正式发布。API 仍可作为 GCS 上的预览功能使用。

  • Added a Java API for creating UDTFs. Note that this is a preview feature.
  • Added new APIs in Scala and Java for uploading and downloading data from a stage (FileOperation.uploadStream and FileOperation.downloadStream).
  • Added the DataFrameWriter.option method in Scala and Java for specifying how values in columns in the DataFrame should be mapped to columns in the table. The option method allows you to specify that the DataFrameWriter should use the column name, rather than the column order.

改进

  • 在 Java 会话中禁用了 Closure Cleaner。Closure Cleaner 仅适用于 Scala 程序。
  • Improved Array and Map support in the Java Row API.

版本 1.3.0(2022 年 3 月 18 日)

兼容的 Snowflake 版本:6.8.x

新功能

版本 1.2.0(2022 年 3 月 2 日)

兼容的 Snowflake 版本:6.5.x

新功能

版本 1.1.0(2022 年 2 月 4 日)

兼容的 Snowflake 版本:6.2.x

Added support for Writing Scala handlers for stored procedures created with SQL.

The API reference for this release is available in the Snowflake documentation and in a .zip or .tar.gz file in the Snowflake Client Repository.

版本 1.0.0(2022 年 1 月 26 日)

兼容的 Snowflake 版本:6.1.x

(GA) 版本已在 AWS 上正式发布。(Snowpark 仍是 Azure 和 GCP 上的预览功能。)

The API reference for this release is available in a .zip or .tar.gz file in the Snowflake Client Repository.

版本 0.12.0(2022 年 1 月 4 日)

兼容的 Snowflake 版本:5.45.x

The API reference for this release is available in a .zip or .tar.gz file in the Snowflake Client Repository.

新功能

  • Added the listagg function to the functions object.
  • 添加了对包含 11 至 22 个实参的 UDFs 的支持。
  • Added the any_value function to the RelationalGroupedDataFrame class.

改进

  • 在为 UDFs 生成的代码中,已将静态代码块替换为对象实例函数。
  • 重新组织了错误消息。
  • Changed the saveAsTable function so that a new table is not created in Append mode.
  • Improved the callUDF function to support any type of argument.
  • 更改了库以在语句级别(而不是会话级别)设置查询标签。

版本 0.11.0(2021 年 11 月 16 日)

兼容的 Snowflake 版本:5.45.x

The API reference for this release is available in a .zip or .tar.gz file in the Snowflake Client Repository.

新功能

改进

已将 Snowflake JDBC 驱动程序升级到 3.13.9。改进了未选择使用当前数据库时报告的错误消息。

版本 0.10.1(2021 年 10 月 27 日)

兼容的 Snowflake 版本:5.38.x

The API reference for this release is available in a .zip or .tar.gz file in the Snowflake Client Repository.

错误修复

  • 修复了将文件上传到使用错误前缀的 GCP 暂存区的问题。
  • 修复了访问 GCP 的预签名 URL 时返回 403 HTTP 响应的问题。

版本 0.10.0(2021 年 10 月 18 日)

兼容的 Snowflake 版本:5.37.x

The API reference for this release is available in a .zip or .tar.gz file in the Snowflake Client Repository.

新功能

  • Added the new method dropDuplicates to the DataFrame class.
  • Added support for in expressions to the Column class (with the in method) and the functions object (with the in function).
  • Extended the Iterator returned by DataFrame.toLocalIterator to support the Closeable interface, which allows you to call the close method on the iterator.
  • Added support for the new configuration property snowpark_request_timeout_in_seconds. You can set this in the configuration map / file to adjust the timeout that the library uses when uploading dependencies to a stage. By default, the timeout is 86400 (1 day).

改进

行为变更

  • 从 Scala API 中删除了仅适用于 Java 的 APIs。
  • 使用 SLF4J SimpleLogger 替换了默认记录器 log4j。

错误修复

  • 更新了库以自动关闭未使用的语句,以减少内存使用量。
  • Fixed the column order in the result of the DataFrame.withColumns method.

版本 0.9.0(2021 年 9 月 20 日)

兼容的 Snowflake 版本:5.34.x

The API reference for this release is available in a .zip or .tar.gz file in the Snowflake Client Repository.

新功能

行为变更

  • 更改了 DataFrame.union() 和 DataFrame.unionByName() 方法,以使用 UNION,而不是 UNION ALL。

错误修复

  • Fixed the error SQL compilation error: Missing column specification that could occur when the Snowpark library created a temporary view.

版本 0.8.0(2021 年 8 月 9 日)

兼容的 Snowflake 版本:5.30.x

The API reference for this release is available in a .zip or .tar.gz file in the Snowflake Client Repository.

改进

  • 重构了一些内部代码以删除一些依赖项。

错误修复

  • 修复了在标度可能大于精度的情况下与 BigDecimal 字面量相关的问题。
  • 修复了在执行多个集合操作(例如并集、相交等)时可能发生的问题。

版本 0.7.0(2021 年 7 月 23 日)

兼容的 Snowflake 版本:5.29.x

The API reference for this release is available in a .zip or .tar.gz file in the Snowflake Client Repository.

新 APIs

  • 推出了新的 Session.close() 方法。调用此方法可关闭 Snowpark 会话,这将取消所有正在运行的查询,并阻止后续使用此会话执行查询。
  • 推出了新的 Updatable 类。Updatable 扩展了 DataFrame 类,并提供了与表相关的其他功能(例如,更新和删除值的功能)。
  • Session.table() 方法现可返回一个 Updatable 对象,而不是一个 DataFrame 对象。
  • 为 UDFRegistration 类中的 registerTemporary 方法推出了新的签名。这些签名没有 UDF 名称的参数,这意味着您可以使用这些签名来注册匿名临时 UDF。

API 变更

  • As mentioned above, the Session.table() method now returns an Updatable object, which extends DataFrame.
  • In the Geography class, removed support for formats other than GeoJSON. Now, Geography only supports the GeoJSON data format.

改进

  • Improved the DataFrame.cacheResult() method to reduce the possibility of “object already exists” errors.
  • 改进了一些错误消息。
  • 添加了一条新的日志消息,该消息会在您登录后打印出会话信息。

错误修复

  • Fixed an issue in which the DataFrame.show() method did not display binary data correctly.
  • 修复了获取版本号时发生的错误。

版本 0.6.0(2021 年 6 月 14 日)

兼容的 Snowflake 版本:5.21.x

AWS 上的预览版本

The API reference for this release is available in a .zip or .tar.gz file in the Snowflake Client Repository.

API 变更

在此版本中, RelationalGroupedDataFrame 中的以下方法现在需要实参:

  • avg
  • max
  • median
  • min
  • sum

In previous releases, if you called these methods without an argument, these methods were applied to all numeric columns in the DataFrame. For example, for a DataFrame df with the columns (a int, b string, c float), calling df.groupBy("a").max() was equivalent to calling df.groupBy("a").max(col("a"), col("c")).

With this release, calling these methods without an argument results in a SnowparkClientException.

版本 0.5.0

新功能

  • 向 DataFrame.show() 方法添加了 maxWidth 参数。您可以使用此参数调整每列的输出中打印的字符数。
  • 添加了 Session.cancelAll() 方法,您可以使用该方法取消此会话上的所有正在运行的操作。
  • 添加了 DataFrame.toLocalIterator() 方法,该方法可返回一个可用于逐行检索数据的迭代器。如果您不想一次将所有数据加载到内存中,则可以使用此方法,而不是使用 DataFrame.collect()。
  • 将 median 方法添加到 RelationalGroupedDataFrame 类中。

改进

  • 改进了标识符无效时返回的错误消息。

  • 增强了错误检查,以便在未指定数据库或架构名称时报告错误。

  • 添加了在表中插入大量值时的性能改进。

  • 更新了库,以便一致地处理 Snowflake 对象标识符(表和视图名称)。现在,所有指定表或视图名称的参数都支持使用:

    • 简称(例如 table_name 和 view_name)
    • 完全限定名称(例如 database.schema.table_name)
    • 多部分标识符(例如 Seq(“database”, “schema”, “view_name”))
  • 添加了检查以验证是否正在使用受支持的 Scala 版本。如果 Scala 版本不兼容,库将报告错误。

错误修复

  • 修复了在 Microsoft Windows 上注册 UDFs 的问题。
  • 修复了将 DataFrame.sort() 与 DataFrame.limit() 结合使用时出现的结果顺序相关问题。
  • 修复了 Session.range() 以生成没有间隙的数字序列。

版本 0.4.1

在此版本中,您不再需要为 Snowpark 对象指定临时架构或临时数据库( TEMP_SCHEMA 和 TEMP_DB 设置)。Snowpark 库会自动创建所需对象的临时版本。

API 变更

已将 DataFrame.cache() 方法替换为 DataFrame.cacheResult() 方法。

新方法可创建并返回包含缓存结果的新 DataFrame,并且对当前 DataFrame 没有影响。由于此更改, DataFrame 对象现在是不可变的。

新 APIs

  • 向 RelationalGroupedDataFrame 类中添加了以下新方法:

    • avg
    • max
  • 向 DataFrame 类中添加了以下新方法:

    • groupByGroupingSets
    • clone
    • createOrReplaceTempView
  • 向 functions 对象中添加了以下新函数:

    • toScalar
  • 添加了一个 Session.file 对象,该对象提供了以下用于执行文件操作的新方法:

    • get
    • put
  • 对 Session.createDataFrame 方法进行了以下更改:

    • 添加了对用户提供的架构的支持。
    • 添加了对指定 variant/geography 数据的数组/映射的支持。
    • 添加了对 UDFs 中的 Geography/Variant 数据类型的支持。
  • 向 UDFRegistration 类中添加了 registerPermanent 方法。

错误修复

  • 修复了 DataFrame 列名称包含引号时的问题。

  • 修复了无法转义包含反斜杠、单引号和换行符的数据的问题。

  • 修复了 UDF 创建失败并显示错误消息“code too larger”的问题。

  • 修复了 UDF 闭包无法获取本地字符串变量的值的问题。

  • 添加了以下 SQL 子句的结果架构:

    • GRANT/REVOKE
    • DESCRIBE
    • CREATE
    • USE
  • 修复了在带有 Metals 扩展的 Visual Studio Code 中使用 Snowpark 创建 UDF 时出现的问题。