Java and Python UDFs and stored procedures: Changes to handling of // when resolving file paths in file access APIs¶
当您在暂存区名称和路径名称之间提供 // 时,Snowflake 当前会将其移除。但是,这有歧义,因为云存储允许在路径名称中使用正斜杠 (/)。最初的目标是帮助那些错误拼接路径名称的用户(例如 build_scoped_file_url(@stage, '/file.txt')),错误拼接的路径名称会导致生成的路径为 @stage//file.txt,而用户实际上想要的是 @stage/file.txt。启用此行为变更捆绑包后,Snowflake 会移除此行为以避免歧义。
因此,通过此行为变更,除非云存储上存在 /file.txt,否则对 @stage//file.txt 的解析将失败。
- 变更前:
对于在 UDF 或存储过程中解析的文件:
@stage//file.txt解析为stage-location/file.txtbuild_scoped_url(@stage, '//file.txt')解析为stage-location/file.txt
- 变更后:
对于在 UDF 或存储过程中解析的文件:
@stage//file.txt解析为stage-location//file.txtbuild_scoped_url(@stage, '//file.txt')解析为stage-location//file.txt
参考:1810