@Test public void makeInputEmptyStream() throws Exception { byte[] empty = new byte[0]; prepareInput(empty); List<OneField> record = inputBuilder.makeInput(inputStream); verifyRecord(record, empty); }
public List<OneField> makeInput(DataInput inputStream) throws Exception { if (protocolData.getOutputFormat() == OutputFormat.TEXT) { return Collections.singletonList(new OneField(DataType.BYTEA.getOID(), inputStream)); } GPDBWritable gpdbWritable = new GPDBWritable(); gpdbWritable.readFields(inputStream); if (gpdbWritable.isEmpty()) { LOG.debug("Reached end of stream"); return null; } GPDBWritableMapper mapper = new GPDBWritableMapper(gpdbWritable); int[] colTypes = gpdbWritable.getColType(); List<OneField> record = new LinkedList<>(); for (int i = 0; i < colTypes.length; i++) { mapper.setDataType(colTypes[i]); record.add(new OneField(colTypes[i], mapper.getData(i))); } return record; }
BridgeInputBuilder { public List<OneField> makeInput(DataInput inputStream) throws Exception { if (protocolData.getOutputFormat() == OutputFormat.TEXT) { return Collections.singletonList(new OneField(DataType.BYTEA.getOID(), inputStream)); } GPDBWritable gpdbWritable = new GPDBWritable(); gpdbWritable.readFields(inputStream); if (gpdbWritable.isEmpty()) { LOG.debug("Reached end of stream"); return null; } GPDBWritableMapper mapper = new GPDBWritableMapper(gpdbWritable); int[] colTypes = gpdbWritable.getColType(); List<OneField> record = new LinkedList<>(); for (int i = 0; i < colTypes.length; i++) { mapper.setDataType(colTypes[i]); record.add(new OneField(colTypes[i], mapper.getData(i))); } return record; } }
BridgeInputBuilder { public List<OneField> makeInput(DataInput inputStream) throws Exception { if (protocolData.getOutputFormat() == OutputFormat.TEXT) { return Collections.singletonList(new OneField(DataType.BYTEA.getOID(), inputStream)); } GPDBWritable gpdbWritable = new GPDBWritable(); gpdbWritable.readFields(inputStream); if (gpdbWritable.isEmpty()) { LOG.debug("Reached end of stream"); return null; } GPDBWritableMapper mapper = new GPDBWritableMapper(gpdbWritable); int[] colTypes = gpdbWritable.getColType(); List<OneField> record = new LinkedList<>(); for (int i = 0; i < colTypes.length; i++) { mapper.setDataType(colTypes[i]); record.add(new OneField(colTypes[i], mapper.getData(i))); } return record; } BridgeInputBuilder(RequestContext protocolData); }
BridgeInputBuilder { public List<OneField> makeInput(DataInput inputStream) throws Exception { if (protocolData.getOutputFormat() == OutputFormat.TEXT) { return Collections.singletonList(new OneField(DataType.BYTEA.getOID(), inputStream)); } GPDBWritable gpdbWritable = new GPDBWritable(); gpdbWritable.readFields(inputStream); if (gpdbWritable.isEmpty()) { LOG.debug("Reached end of stream"); return null; } GPDBWritableMapper mapper = new GPDBWritableMapper(gpdbWritable); int[] colTypes = gpdbWritable.getColType(); List<OneField> record = new LinkedList<>(); for (int i = 0; i < colTypes.length; i++) { mapper.setDataType(colTypes[i]); record.add(new OneField(colTypes[i], mapper.getData(i))); } return record; } BridgeInputBuilder(RequestContext protocolData); List<OneField> makeInput(DataInput inputStream); }
BridgeInputBuilder { public List<OneField> makeInput(DataInput inputStream) throws Exception { if (protocolData.getOutputFormat() == OutputFormat.TEXT) { return Collections.singletonList(new OneField(DataType.BYTEA.getOID(), inputStream)); } GPDBWritable gpdbWritable = new GPDBWritable(); gpdbWritable.readFields(inputStream); if (gpdbWritable.isEmpty()) { LOG.debug("Reached end of stream"); return null; } GPDBWritableMapper mapper = new GPDBWritableMapper(gpdbWritable); int[] colTypes = gpdbWritable.getColType(); List<OneField> record = new LinkedList<>(); for (int i = 0; i < colTypes.length; i++) { mapper.setDataType(colTypes[i]); record.add(new OneField(colTypes[i], mapper.getData(i))); } return record; } BridgeInputBuilder(RequestContext protocolData); List<OneField> makeInput(DataInput inputStream);  }