Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
import java.io.InputStream;
import java.text.DateFormat;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiPredicate;
Expand Down Expand Up @@ -119,7 +119,7 @@ protected AbstractJsonRowRecordReader(final InputStream in,

this.strategy = strategy;
this.captureFieldPredicate = captureFieldPredicate;
capturedFields = new HashMap<>();
capturedFields = new LinkedHashMap<>();

try {
jsonParser = jsonFactory.createParser(in);
Expand Down Expand Up @@ -306,7 +306,7 @@ private Map<String, Object> getMapFromRawValue(final JsonNode fieldNode, final D
final MapDataType mapDataType = (MapDataType) dataType;
final DataType valueType = mapDataType.getValueType();

final Map<String, Object> mapValue = new HashMap<>();
final Map<String, Object> mapValue = new LinkedHashMap<>();

final Iterator<Map.Entry<String, JsonNode>> fieldItr = fieldNode.fields();
while (fieldItr.hasNext()) {
Expand Down Expand Up @@ -372,7 +372,7 @@ private Record createOptionalRecord(final JsonNode fieldNode, final DataType dat

private Record createRecordFromRawValue(final JsonNode fieldNode, final RecordSchema childSchema) throws IOException {
final Iterator<String> fieldNames = fieldNode.fieldNames();
final Map<String, Object> childValues = new HashMap<>();
final Map<String, Object> childValues = new LinkedHashMap<>();
while (fieldNames.hasNext()) {
final String childFieldName = fieldNames.next();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ void testReadRawRecordFieldOrderPreserved() throws IOException, MalformedRecordE
fields.add(new RecordField("id", RecordFieldType.INT.getDataType()));
final RecordSchema schema = new SimpleRecordSchema(fields);

final String expectedMap = "{id=1, name=John Doe, address=123 My Street, city=My City, state=MS, zipCode=11111, country=USA, account=MapRecord[{balance=4750.89, id=42}]}";
final String expectedMap = "{id=1, name=John Doe, address=123 My Street, city=My City, state=MS, zipCode=11111, country=USA, account=MapRecord[{id=42, balance=4750.89}]}";
final String expectedRecord = String.format("MapRecord[%s]", expectedMap);
try (final InputStream in = new FileInputStream("src/test/resources/json/single-element-nested.json");
final JsonTreeRowRecordReader reader = new JsonTreeRowRecordReader(in, mock(ComponentLog.class), schema, dateFormat, timeFormat, timestampFormat)) {
Expand Down