json字段XXXX的值类型表示为YYYY,但表列的发现数据类型为ZZZZ [英] The value type for json field XXXX was presented as YYYY but the discovered data type of the table's column was ZZZZ
问题描述
当使用SDP从Cloudant中提取数据并填充dashDB时,我偶尔会在dashdb XXXX_OVERFLOW表中看到如下错误消息:
When using the SDP to extract data from Cloudant and populate dashDB, I occasionally see error messages in the dashdb "XXXX_OVERFLOW" table that look like this:
EXCEPTION
The value type for json field XXXX was presented as java.lang.String
but the discovered data type of the table's column was Boolean. The document
could not be imported into the created database.
_ID
mydocument-12345
问题
- 为什么会出现此错误?
- 如何解决?
推荐答案
SDP必须决定匹配的SQL数据类型,以用于Cloudant文档。与SQL数据类型相比,JSON数据类型系统(请参见 http://json.org )要通用得多。系统(例如,参见 DB2 LUW 9.8数据类型)。结果,SDP算法采用了一些启发式方法来计算通用JSON类型的最佳匹配SQL数据类型。
The SDP has to decide a matching SQL data type for every JSON data type present in the Cloudant documents. The JSON data type system (see http://json.org) is a lot more generic compared with the SQL data type system (see for example DB2 LUW 9.8 data types). As a result, the SDP algorithm employs some heuristics to compute the best matching SQL data type for the generic JSON type.
例如,JSON 数字根据在文档样本中发现的属性值,将strong>映射到SQL 浮点或SQL 整数。
For example, a JSON number is mapped to either a SQL floating point or a SQL integer based on the attribute values found across a document sample.
仅使用 TRUE / FALSE的JSON 字符串将因此创建SQL 布尔值。
A JSON string that uses 'TRUE/FALSE' only will create a SQL boolean as a result.
-
由于出现在发现的样本之外的某些值无法转换为所使用的SQL数据类型,因此您会收到此错误。
You are getting this error because some values found outside the discovered sample can not be cast to the SQL data type used.
解决此问题的唯一方法是
The only options to resolve this is to either
- 修改单个文档并修改相关值,或者
- 将模式发现期间使用的样本大小增加到 unlimited (更多信息)
- modify individual documents and modify the values in question OR
- increase the sample size used during schema discovery to unlimited (more info)
这篇关于json字段XXXX的值类型表示为YYYY,但表列的发现数据类型为ZZZZ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!