Skip to content

Commit 10e00b3

Browse files
committed
Nullability fix 2
1 parent 9cbed21 commit 10e00b3

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/main/java/org/duckdb/DuckDBAppender.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ private void setListNullMask(Column col, boolean[] nullMask, int elementsCount)
13691369
for (int i = 0; i < nullMask.length; i++) {
13701370
if (nullMask[i]) {
13711371
long vectorIdx = col.listSize - elementsCount + i;
1372-
col.setNullOnVectorIdx(vectorIdx);
1372+
col.setNull(vectorIdx);
13731373
}
13741374
}
13751375
}
@@ -1667,7 +1667,7 @@ private void putMap(Column col, long vectorIdx, Map<?, ?> map) throws SQLExcepti
16671667

16681668
private void putCompositeElement(Column col, long vectorIdx, Object value) throws SQLException {
16691669
if (null == value) {
1670-
col.setNullOnVectorIdx(vectorIdx);
1670+
col.setNull(vectorIdx);
16711671
return;
16721672
}
16731673
switch (col.colType) {
@@ -2168,20 +2168,18 @@ void destroy() {
21682168
}
21692169

21702170
void setNull(long vectorIdx) throws SQLException {
2171-
if (1 != arraySize) {
2172-
throw new SQLException("Invalid API usage for array, size: " + arraySize);
2173-
}
2174-
setNullOnArrayIdx(vectorIdx, 0);
2175-
if (colType == DUCKDB_TYPE_LIST || colType == DUCKDB_TYPE_MAP) {
2176-
return;
2177-
}
21782171
if (colType == DUCKDB_TYPE_ARRAY) {
2172+
setNullOnArrayIdx(vectorIdx, 0);
21792173
for (Column col : children) {
21802174
for (int i = 0; i < col.arraySize; i++) {
21812175
col.setNullOnArrayIdx(vectorIdx, i);
21822176
}
21832177
}
21842178
} else {
2179+
setNullOnVectorIdx(vectorIdx);
2180+
if (colType == DUCKDB_TYPE_LIST || colType == DUCKDB_TYPE_MAP) {
2181+
return;
2182+
}
21852183
for (Column col : children) {
21862184
col.setNull(vectorIdx);
21872185
}

0 commit comments

Comments
 (0)