private void addArrayColumn(String path, Schema element, ColumnMetaData parent) { if (path == null) path = element.getFullName(); if (isSimple(element)) { // optimize simple arrays addColumn(path, simpleValueType(element), parent, true); return; } // complex array: insert a parent column with lengths int start = columns.size(); ColumnMetaData array = addColumn(path, ValueType.NULL, parent, true); columnize(path, element, array, false); arrayWidths.set(start, columns.size()-start); // fixup with actual width }
private Object read(Schema s) throws IOException { if (isSimple(s)) return nextValue(s, column++); this.column = startColumn; Object value = nextValue(s, column++); if (!isSimple(s.getElementType())) value = read(s.getElementType()); elements.add(value); value = nextValue(branch, column); column++; if (!isSimple(branch)) value = read(branch); } else {
private void columnize(String path, Schema s, ColumnMetaData parent, boolean isArray) { if (isSimple(s)) { if (path == null) path = s.getFullName(); addColumn(path, simpleValueType(s), parent, isArray);
private int write(Object o, Schema s, int column) throws IOException { if (isSimple(s)) { writeValue(o, s, column); return column+1; Collection elements = (Collection)o; writer.writeLength(elements.size(), column); if (isSimple(s.getElementType())) { // optimize simple arrays for (Object element : elements) writeValue(element, s.getElementType(), column); } else { writer.writeLength(1, column); if (isSimple(branch)) { writeValue(o, branch, column++); } else {
private void addArrayColumn(String path, Schema element, ColumnMetaData parent) { if (path == null) path = element.getFullName(); if (isSimple(element)) { // optimize simple arrays addColumn(path, simpleValueType(element), parent, true); return; } // complex array: insert a parent column with lengths int start = columns.size(); ColumnMetaData array = addColumn(path, ValueType.NULL, parent, true); columnize(path, element, array, false); arrayWidths.set(start, columns.size()-start); // fixup with actual width }
private void columnize(String path, Schema s, ColumnMetaData parent, boolean isArray) { if (isSimple(s)) { if (path == null) path = s.getFullName(); addColumn(path, simpleValueType(s), parent, isArray);
private int write(Object o, Schema s, int column) throws IOException { if (isSimple(s)) { writeValue(o, s, column); return column+1; Collection elements = (Collection)o; writer.writeLength(elements.size(), column); if (isSimple(s.getElementType())) { // optimize simple arrays for (Object element : elements) writeValue(element, s.getElementType(), column); } else { writer.writeLength(1, column); if (isSimple(branch)) { writeValue(o, branch, column++); } else {
private Object read(Schema s) throws IOException { if (isSimple(s)) return nextValue(s, column++); this.column = startColumn; Object value = nextValue(s, column++); if (!isSimple(s.getElementType())) value = read(s.getElementType()); elements.add(value); value = nextValue(s, column); column++; if (!isSimple(branch)) value = read(branch); } else {