Skip to content

Commit ad63c63

Browse files
author
chengyitian
committed
AJ-788: support upsert iotAnyVector for AutoFitTableUpsert;
1 parent 1ec1902 commit ad63c63

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/com/xxdb/data/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ else if(type==DATA_TYPE.DT_STRING || type==DATA_TYPE.DT_SYMBOL || type == DATA_T
408408
return DATA_CATEGORY.LITERAL;
409409
else if(type==DATA_TYPE.DT_INT128 || type==DATA_TYPE.DT_UUID || type==DATA_TYPE.DT_IPADDR)
410410
return DATA_CATEGORY.BINARY;
411-
else if(type==DATA_TYPE.DT_ANY)
411+
else if(type==DATA_TYPE.DT_ANY || type == DATA_TYPE.DT_IOTANY)
412412
return DATA_CATEGORY.MIXED;
413413
else if(type==DATA_TYPE.DT_VOID)
414414
return DATA_CATEGORY.NOTHING;

src/com/xxdb/route/AutoFitTableUpsert.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,13 @@ private String defineInsertScript (String dbUrl, String tableName, boolean ignor
9494
}
9595

9696
private void checkColumnType(int col, Entity.DATA_CATEGORY category, Entity.DATA_TYPE type){
97-
if (columnTypes_.get(col) != type){
98-
Entity.DATA_CATEGORY expectCateGory = columnCategories_.get(col);
99-
if (category != expectCateGory)
100-
throw new RuntimeException("column " + col + ", expect category " + expectCateGory + ", got category " + category);
101-
}
97+
Entity.DATA_TYPE expectedType = columnTypes_.get(col);
98+
Entity.DATA_CATEGORY expectedCategory = columnCategories_.get(col);
99+
100+
if (expectedType == type || (expectedType == Entity.DATA_TYPE.DT_IOTANY && expectedCategory == Entity.DATA_CATEGORY.MIXED))
101+
return;
102+
103+
if (category != expectedCategory)
104+
throw new RuntimeException(String.format("Column %d: expected category %s, got %s", col, expectedCategory, category));
102105
}
103106
}

0 commit comments

Comments
 (0)