问题
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
- Why am I getting this error?
- 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.
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
- 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