Skip to content

Commit

Permalink
Fix DataTypeMismatchException info error (apache#7330)
Browse files Browse the repository at this point in the history
  • Loading branch information
HTHou authored Sep 15, 2022
1 parent d8116d4 commit 14f30f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public DataTypeMismatchException(
String deviceName,
String measurementName,
TSDataType insertType,
TSDataType realType,
TSDataType typeInSchema,
long time,
Object value) {
super(
String.format(
"data type of %s.%s is not consistent, registered type %s, inserting type %s, timestamp %s, value %s",
deviceName,
measurementName,
realType,
typeInSchema,
insertType,
time,
value == null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,27 @@ public static void deleteSchemaRegionFolder(String schemaRegionDirPath, Logger l
}
}

public static void checkDataTypeMatch(InsertPlan plan, int loc, TSDataType dataType)
public static void checkDataTypeMatch(InsertPlan plan, int loc, TSDataType dataTypeInSchema)
throws MetadataException {
TSDataType insertDataType;
if (plan instanceof InsertRowPlan) {
if (!((InsertRowPlan) plan).isNeedInferType()) {
// only when InsertRowPlan's values is object[], we should check type
insertDataType = getTypeInLoc(plan, loc);
} else {
insertDataType = dataType;
insertDataType = dataTypeInSchema;
}
} else {
insertDataType = getTypeInLoc(plan, loc);
}
if (dataType != insertDataType) {
if (dataTypeInSchema != insertDataType) {
String measurement = plan.getMeasurements()[loc];
String device = plan.getDevicePath().getFullPath();
throw new DataTypeMismatchException(
device,
measurement,
insertDataType,
dataType,
dataTypeInSchema,
plan.getMinTime(),
plan.getFirstValueOfIndex(loc));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ protected boolean selfCheckDataTypes() {
new DataTypeMismatchException(
devicePath.getFullPath(),
measurements[i],
measurementSchemas[i].getType(),
dataTypes[i],
measurementSchemas[i].getType(),
getMinTime(),
getFirstValueOfIndex(i)));
}
Expand Down

0 comments on commit 14f30f7

Please sign in to comment.