/** * Appends a NULL struct. This *has* to be used for structs instead of appendNull() as this * recursively appends a NULL to its children. * We don't have this logic as the general appendNull implementation to optimize the more * common non-struct case. */ public final int appendStruct(boolean isNull) { if (isNull) { appendNull(); for (WritableColumnVector c: childColumns) { if (c.type instanceof StructType) { c.appendStruct(true); } else { c.appendNull(); } } } else { appendNotNull(); } return elementsAppended; }
/** * Appends a NULL struct. This *has* to be used for structs instead of appendNull() as this * recursively appends a NULL to its children. * We don't have this logic as the general appendNull implementation to optimize the more * common non-struct case. */ public final int appendStruct(boolean isNull) { if (isNull) { appendNull(); for (WritableColumnVector c: childColumns) { if (c.type instanceof StructType) { c.appendStruct(true); } else { c.appendNull(); } } } else { appendNotNull(); } return elementsAppended; }
private static void appendValue(WritableColumnVector dst, DataType t, Row src, int fieldIdx) { if (t instanceof ArrayType) { ArrayType at = (ArrayType)t; if (src.isNullAt(fieldIdx)) { dst.appendNull(); } else { List<Object> values = src.getList(fieldIdx); dst.appendArray(values.size()); for (Object o : values) { appendValue(dst.arrayData(), at.elementType(), o); } } } else if (t instanceof StructType) { StructType st = (StructType)t; if (src.isNullAt(fieldIdx)) { dst.appendStruct(true); } else { dst.appendStruct(false); Row c = src.getStruct(fieldIdx); for (int i = 0; i < st.fields().length; i++) { appendValue(dst.getChild(i), st.fields()[i].dataType(), c, i); } } } else { appendValue(dst, t, src.get(fieldIdx)); } }
private static void appendValue(WritableColumnVector dst, DataType t, Row src, int fieldIdx) { if (t instanceof ArrayType) { ArrayType at = (ArrayType)t; if (src.isNullAt(fieldIdx)) { dst.appendNull(); } else { List<Object> values = src.getList(fieldIdx); dst.appendArray(values.size()); for (Object o : values) { appendValue(dst.arrayData(), at.elementType(), o); } } } else if (t instanceof StructType) { StructType st = (StructType)t; if (src.isNullAt(fieldIdx)) { dst.appendStruct(true); } else { dst.appendStruct(false); Row c = src.getStruct(fieldIdx); for (int i = 0; i < st.fields().length; i++) { appendValue(dst.getChild(i), st.fields()[i].dataType(), c, i); } } } else { appendValue(dst, t, src.get(fieldIdx)); } }
dst.appendStruct(true); } else { dst.appendNull();
dst.appendStruct(true); } else { dst.appendNull();