Skip to content

Commit ff2ef62

Browse files
committed
fix null outputs
1 parent a71459b commit ff2ef62

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎src/main/java/ai/chalk/client/ChalkClientImpl.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,14 @@ private OnlineQueryResult onlineQueryJson(OnlineQueryParamsComplete params) thro
162162
var dataItem = (Map<String, Object>) item;
163163
String fieldName = (String) dataItem.get("field");
164164
Object value = dataItem.get("value");
165-
if (fieldName == null) continue;
165+
if (fieldName == null || value == null) continue;
166166

167167
FieldVector vector = createVectorForValue(fieldName, value, childAllocator);
168168
if (vector != null) vectors.add(vector);
169169
}
170-
scalarTable = new Table(vectors);
170+
if (!vectors.isEmpty()) {
171+
scalarTable = new Table(vectors);
172+
}
171173
} catch (Exception e) {
172174
for (FieldVector v : vectors) v.close();
173175
childAllocator.close();
@@ -179,9 +181,7 @@ private OnlineQueryResult onlineQueryJson(OnlineQueryParamsComplete params) thro
179181
}
180182

181183
private static FieldVector createVectorForValue(String name, Object value, BufferAllocator allocator) {
182-
if (value == null) {
183-
return new NullVector(name, 1);
184-
} else if (value instanceof Integer intVal) {
184+
if (value instanceof Integer intVal) {
185185
BigIntVector v = new BigIntVector(name, allocator);
186186
v.allocateNew(1);
187187
v.set(0, intVal.longValue());

0 commit comments

Comments
 (0)