@Override public void allocate() { if(writer != null) { writer.allocate(); } }
@Override public void allocate() { container.allocateNew(); for(final FieldWriter w : fields.values()) { w.allocate(); } }
@Override public void allocate() { container.allocateNew(); for(final FieldWriter w : fields.values()) { w.allocate(); } }
@Override public void allocate() { if(writer != null) { writer.allocate(); } container.allocateNew(); }
@Override public void allocate() { getWriter().allocate(); }
@Override public MapWriter map(String name) { FieldWriter writer = fields.get(name.toLowerCase()); if(writer == null){ int vectorCount=container.size(); MapVector vector = container.addOrGet(name, MapVector.TYPE, MapVector.class); if(!unionEnabled){ writer = new SingleMapWriter(vector, this); } else { writer = new PromotableWriter(vector, container); } if(vectorCount != container.size()) { writer.allocate(); } writer.setPosition(currentChildIndex); fields.put(name.toLowerCase(), writer); } return writer; }
@Override public ListWriter list(String name) { FieldWriter writer = fields.get(name.toLowerCase()); int vectorCount = container.size(); if(writer == null) { if (!unionEnabled){ writer = new SingleListWriter(name,container,this); } else{ writer = new PromotableWriter(container.addOrGet(name, Types.optional(MinorType.LIST), ListVector.class), container); } if (container.size() > vectorCount) { writer.allocate(); } writer.setPosition(currentChildIndex); fields.put(name.toLowerCase(), writer); } return writer; }
@Override public MapWriter map(String name) { FieldWriter writer = fields.get(name.toLowerCase()); if(writer == null){ int vectorCount=container.size(); MapVector vector = container.addOrGet(name, MapVector.TYPE, MapVector.class); if(!unionEnabled){ writer = new SingleMapWriter(vector, this); } else { writer = new PromotableWriter(vector, container); } if(vectorCount != container.size()) { writer.allocate(); } writer.setPosition(idx()); fields.put(name.toLowerCase(), writer); } return writer; }
@Override public ListWriter list(String name) { FieldWriter writer = fields.get(name.toLowerCase()); int vectorCount = container.size(); if(writer == null) { if (!unionEnabled){ writer = new SingleListWriter(name,container,this); } else{ writer = new PromotableWriter(container.addOrGet(name, Types.optional(MinorType.LIST), ListVector.class), container); } if (container.size() > vectorCount) { writer.allocate(); } writer.setPosition(idx()); fields.put(name.toLowerCase(), writer); } return writer; }
@Override public TimeWriter time() { switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedTimeVector vector = container.addOrGet(name, TIME_TYPE, RepeatedTimeVector.class); innerVector = vector; writer = new RepeatedTimeWriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(currentChildIndex); mode = Mode.IN_TIME; return writer; case IN_TIME: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("TIME", mode.name())) .build(logger); } }
@Override public UInt8Writer uInt8() { switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedUInt8Vector vector = container.addOrGet(name, UINT8_TYPE, RepeatedUInt8Vector.class); innerVector = vector; writer = new RepeatedUInt8WriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(currentChildIndex); mode = Mode.IN_UINT8; return writer; case IN_UINT8: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("UINT8", mode.name())) .build(logger); } }
@Override public IntervalWriter interval() { switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedIntervalVector vector = container.addOrGet(name, INTERVAL_TYPE, RepeatedIntervalVector.class); innerVector = vector; writer = new RepeatedIntervalWriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(currentChildIndex); mode = Mode.IN_INTERVAL; return writer; case IN_INTERVAL: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("INTERVAL", mode.name())) .build(logger); } }
@Override public Var16CharWriter var16Char() { switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedVar16CharVector vector = container.addOrGet(name, VAR16CHAR_TYPE, RepeatedVar16CharVector.class); innerVector = vector; writer = new RepeatedVar16CharWriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(currentChildIndex); mode = Mode.IN_VAR16CHAR; return writer; case IN_VAR16CHAR: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("VAR16CHAR", mode.name())) .build(logger); } }
@Override public IntWriter integer() { switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedIntVector vector = container.addOrGet(name, INT_TYPE, RepeatedIntVector.class); innerVector = vector; writer = new RepeatedIntWriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(currentChildIndex); mode = Mode.IN_INT; return writer; case IN_INT: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("INT", mode.name())) .build(logger); } }
@Override public DateWriter date() { switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedDateVector vector = container.addOrGet(name, DATE_TYPE, RepeatedDateVector.class); innerVector = vector; writer = new RepeatedDateWriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(currentChildIndex); mode = Mode.IN_DATE; return writer; case IN_DATE: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("DATE", mode.name())) .build(logger); } }
@Override public UInt2Writer uInt2() { switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedUInt2Vector vector = container.addOrGet(name, UINT2_TYPE, RepeatedUInt2Vector.class); innerVector = vector; writer = new RepeatedUInt2WriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(idx()); mode = Mode.IN_UINT2; return writer; case IN_UINT2: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("UINT2", mode.name())) .build(logger); } }
@Override public IntervalDayWriter intervalDay() { switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedIntervalDayVector vector = container.addOrGet(name, INTERVALDAY_TYPE, RepeatedIntervalDayVector.class); innerVector = vector; writer = new RepeatedIntervalDayWriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(idx()); mode = Mode.IN_INTERVALDAY; return writer; case IN_INTERVALDAY: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("INTERVALDAY", mode.name())) .build(logger); } }
@Override public BitWriter bit() { switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedBitVector vector = container.addOrGet(name, BIT_TYPE, RepeatedBitVector.class); innerVector = vector; writer = new RepeatedBitWriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(idx()); mode = Mode.IN_BIT; return writer; case IN_BIT: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("BIT", mode.name())) .build(logger); } }
@Override public Decimal9Writer decimal9(int scale, int precision) { final MajorType DECIMAL9_TYPE = Types.withScaleAndPrecision(MinorType.DECIMAL9, DataMode.REPEATED, scale, precision); switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedDecimal9Vector vector = container.addOrGet(name, DECIMAL9_TYPE, RepeatedDecimal9Vector.class); innerVector = vector; writer = new RepeatedDecimal9WriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(currentChildIndex); mode = Mode.IN_DECIMAL9; return writer; case IN_DECIMAL9: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("DECIMAL9", mode.name())) .build(logger); } }
@Override public Decimal28DenseWriter decimal28Dense(int scale, int precision) { final MajorType DECIMAL28DENSE_TYPE = Types.withScaleAndPrecision(MinorType.DECIMAL28DENSE, DataMode.REPEATED, scale, precision); switch (mode) { case INIT: final ValueVector oldVector = container.getChild(name); final RepeatedDecimal28DenseVector vector = container.addOrGet(name, DECIMAL28DENSE_TYPE, RepeatedDecimal28DenseVector.class); innerVector = vector; writer = new RepeatedDecimal28DenseWriterImpl(vector, this); // oldVector will be null if it's first batch being created and it might not be same as newly added vector // if new batch has schema change if (oldVector == null || oldVector != vector) { writer.allocate(); } writer.setPosition(idx()); mode = Mode.IN_DECIMAL28DENSE; return writer; case IN_DECIMAL28DENSE: return writer; default: throw UserException .unsupportedError() .message(getUnsupportedErrorMsg("DECIMAL28DENSE", mode.name())) .build(logger); } }