Skip to content

Commit 7fbfff5

Browse files
mtopolnikclaude
andcommitted
Pre-pad new columns for existing rows
QwpTableBuffer.createColumn() created new column buffers with size = 0 regardless of how many rows were already committed. When the caller added a value for the current row, it landed at position 0 (the first row's slot). The subsequent nextRow() call padded nulls after the value, misaligning the column data with all other columns. The fix pre-pads the new column with nulls for all committed rows so the next value lands at the correct row position. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1d33006 commit 7fbfff5

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

core/src/main/java/io/questdb/client/cutlass/qwp/protocol/QwpTableBuffer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,11 @@ private ColumnBuffer createColumn(CharSequence name, byte type, boolean nullable
351351
fastColumns = newArr;
352352
}
353353
fastColumns[index] = col;
354+
// Pre-pad with nulls for already-committed rows so the next
355+
// value the caller adds lands at the correct row position.
356+
for (int r = 0; r < rowCount; r++) {
357+
col.addNull();
358+
}
354359
schemaHashComputed = false;
355360
columnDefsCacheValid = false;
356361
return col;

0 commit comments

Comments
 (0)