gpt4 book ai didi

Azure Synapse Analytics - 高长度的列加载

转载 作者:行者123 更新时间:2023-12-02 07:32:47 27 4
gpt4 key购买 nike

我有一列包含描述,长度约为 80000(包含 unicode 字符)。我无法将其加载到 Azure Synapse Analytics。 Synapse 中定义的数据类型是 nvarchar。我们正在使用 Azure Databricks。我尝试了 maxStrLength (.option('maxStrLength', 4000)) 的选项,但最大值是 4000。所以,我收到此错误。

:com.databricks.spark.sqldw.SqlDWSideException:Azure Synapse Analytics 无法执行连接器生成的 JDBC 查询。底层 SQLException(s):

  • com.microsoft.sqlserver.jdbc.SQLServerException:HdfsBridge::recordReaderFillBuffer - 填充记录读取器缓冲区时遇到意外错误:HadoopSqlException:字符串或二进制数据将被截断。 [错误代码 = 107090] [SQLState = S0001]

请问有什么办法可以解决这个问题吗?

更新 - 通过在将数据帧写入 Synapse 并将目标数据类型声明为 nvarchar(max) 时删除 .option('maxStrLength', 4000) 来解决该问题

最佳答案

使用 nvarchar [ ( n | max ) ] 最多可以存储 10 亿个 2 字节 Unicode 字符。 .

Variable-length Unicode string data. n defines the string length andcan be a value from 1 through 4,000. max indicates that the maximumstorage size is 2^31-1 bytes (2 GB). The storage size, in bytes, istwo times the actual length of data entered + 2 bytes. The ISOsynonyms for nvarchar are national char varying and national charactervarying.

您可以引用下面提到的相关SO线程:

How does SQL Server store more than 4000 characters in NVARCHAR(max)?

SQL query variable nvarchar(max) can not store more than 4000 characters

关于Azure Synapse Analytics - 高长度的列加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70576506/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com