Skip to content

Commit 242c7a6

Browse files
authored
Merge pull request #69 from data-integrations/fix/database-plugin
Fix validation of database source
2 parents 39b14c0 + 08fcffd commit 242c7a6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

database-commons/src/main/java/io/cdap/plugin/db/batch/source/AbstractDBSource.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,12 @@ static void validateSchema(Schema actualSchema, Schema configSchema, FailureColl
424424
Schema expectedFieldSchema = field.getSchema().isNullable() ?
425425
field.getSchema().getNonNullable() : field.getSchema();
426426

427-
if (!actualFieldSchema.equals(expectedFieldSchema)) {
427+
if (actualFieldSchema.getType() != expectedFieldSchema.getType() ||
428+
actualFieldSchema.getLogicalType() != expectedFieldSchema.getLogicalType()) {
428429
collector.addFailure(
429-
String.format("Schema field '%s' has type '%s' but found '%s' in input record",
430-
field.getName(), expectedFieldSchema.getType(), actualFieldSchema.getType()), null)
430+
String.format("Schema field '%s' has type '%s but found '%s'.",
431+
field.getName(), expectedFieldSchema.getDisplayName(),
432+
actualFieldSchema.getDisplayName()), null)
431433
.withOutputSchemaField(field.getName());
432434
}
433435
}

0 commit comments

Comments
 (0)