jt2594838 commented on code in PR #18816:
URL: https://github.com/apache/iotdb/pull/18816#discussion_r4244296832
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java:
##########
@@ -262,35 +262,33 @@ public void writeAlignedTablet(
}
/**
- * Check metadata of columns and return array that mapping existed metadata
to index of data
- * column.
+ * Register missing measurements in insertion order, then reorder values and
bitmaps into the
+ * memchunk's column order.
*
* @param schemaListInInsertPlan Contains all existed schema in InsertPlan.
If some timeseries
* have been deleted, there will be null in its slot.
- * @return columnIndexArray: schemaList[i] is schema of
columns[columnIndexArray[i]]
+ * @return values and bitmaps aligned with this memchunk's schema list
*/
private Pair<Object[], BitMap[]> checkAndReorderColumnValuesInInsertPlan(
List<IMeasurementSchema> schemaListInInsertPlan, Object[] columnValues,
BitMap[] bitMaps) {
+ List<TSDataType> newDataTypes = new ArrayList<>();
+ for (IMeasurementSchema measurementSchema : schemaListInInsertPlan) {
+ if (measurementSchema != null
+ &&
!measurementIndexMap.containsKey(measurementSchema.getMeasurementName())) {
+ measurementIndexMap.put(measurementSchema.getMeasurementName(),
schemaList.size());
+ schemaList.add(measurementSchema);
+ newDataTypes.add(measurementSchema.getType());
+ }
+ }
Review Comment:
May defer the initialization until there is truly a new column.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/memtable/AlignedWritableMemChunk.java:
##########
@@ -262,35 +262,33 @@ public void writeAlignedTablet(
}
/**
- * Check metadata of columns and return array that mapping existed metadata
to index of data
- * column.
+ * Register missing measurements in insertion order, then reorder values and
bitmaps into the
+ * memchunk's column order.
*
* @param schemaListInInsertPlan Contains all existed schema in InsertPlan.
If some timeseries
* have been deleted, there will be null in its slot.
- * @return columnIndexArray: schemaList[i] is schema of
columns[columnIndexArray[i]]
+ * @return values and bitmaps aligned with this memchunk's schema list
*/
private Pair<Object[], BitMap[]> checkAndReorderColumnValuesInInsertPlan(
List<IMeasurementSchema> schemaListInInsertPlan, Object[] columnValues,
BitMap[] bitMaps) {
+ List<TSDataType> newDataTypes = new ArrayList<>();
+ for (IMeasurementSchema measurementSchema : schemaListInInsertPlan) {
+ if (measurementSchema != null
+ &&
!measurementIndexMap.containsKey(measurementSchema.getMeasurementName())) {
+ measurementIndexMap.put(measurementSchema.getMeasurementName(),
schemaList.size());
+ schemaList.add(measurementSchema);
+ newDataTypes.add(measurementSchema.getType());
+ }
+ }
Review Comment:
The additional iteration may cause some performance fallback in no-extension
scenarios, which should be checked.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]