MultiTable Defaults Column Types to String which causes Errors when Reading non-String Types

Description

In [DBTypes.java:67](https://github.com/data-integrations/multi-table-plugins/blob/05c91bb93d6c2d191b9eeaa2a1f01a6fbdc5142b/src/main/java/io/cdap/plugin/format/DBTypes.java#L67), the schema type conversion defaults to String if the type is not found in the list. This causes the errors such as the following:

Caused by: java.io.IOException: Value type BYTES not valid in union: ["string","null"]
at io.cdap.cdap.format.io.StructuredRecordDatumWriter.findUnionSchema(StructuredRecordDatumWriter.java:329) ~[na:na]
at io.cdap.cdap.format.io.StructuredRecordDatumWriter.encode(StructuredRecordDatumWriter.java:109) ~[na:na]
at io.cdap.cdap.format.io.JsonStructuredRecordDatumWriter.encode(JsonStructuredRecordDatumWriter.java:181) ~[na:na]
at io.cdap.cdap.format.io.JsonStructuredRecordDatumWriter.encodeRecordField(JsonStructuredRecordDatumWriter.java:106) ~[na:na]
...

To avoid this, we should set the default to throw an exception.

Release Notes

None

Activity

Show:
Dennis Li
April 27, 2021, 6:48 AM

PR to improve the error messages by setting unsupported default types:

1.3 Cherry-pick PR:

Your pinned fields
Click on the next to a field label to start pinning.

Assignee

Dennis Li

Reporter

Dennis Li

Labels