The value type for json field XXXX was presented as YYYY but the discovered data type of the table's column was ZZZZ

眉间皱痕 提交于 2019-12-13 07:24:51

问题


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

Questions

  1. Why am I getting this error?
  2. How can I fix it?

回答1:


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.

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.

A JSON string that uses 'TRUE/FALSE' only will create a SQL boolean as a result.

  1. You are getting this error because some values found outside the discovered sample can not be cast to the SQL data type used.

  2. The only options to resolve this is to either

    • modify individual documents and modify the values in question OR
    • increase the sample size used during schema discovery to unlimited (more info)


来源:https://stackoverflow.com/questions/32843907/the-value-type-for-json-field-xxxx-was-presented-as-yyyy-but-the-discovered-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!