use of org.apache.drill.exec.vector.complex.impl.SingleMapReaderImpl in project drill by apache.
the class TestBsonRecordReader method testDateTimeType.
@Test
public void testDateTimeType() throws IOException {
BsonDocument bsonDoc = new BsonDocument();
bsonDoc.append("dateTimeKey", new BsonDateTime(5262729712L));
writer.reset();
bsonReader.write(writer, new BsonDocumentReader(bsonDoc));
SingleMapReaderImpl mapReader = (SingleMapReaderImpl) writer.getMapVector().getReader();
assertEquals(5262729712L, mapReader.reader("dateTimeKey").readLocalDateTime().atZone(ZoneOffset.systemDefault()).toInstant().toEpochMilli());
}
use of org.apache.drill.exec.vector.complex.impl.SingleMapReaderImpl in project drill by apache.
the class TestBsonRecordReader method testArrayType.
@Test
public void testArrayType() throws IOException {
BsonDocument bsonDoc = new BsonDocument();
BsonWriter bw = new BsonDocumentWriter(bsonDoc);
bw.writeStartDocument();
bw.writeName("arrayKey");
bw.writeStartArray();
bw.writeInt32(1);
bw.writeInt32(2);
bw.writeInt32(3);
bw.writeEndArray();
bw.writeEndDocument();
bw.flush();
bsonReader.write(writer, new BsonDocumentReader(bsonDoc));
SingleMapReaderImpl mapReader = (SingleMapReaderImpl) writer.getMapVector().getReader();
FieldReader reader = mapReader.reader("arrayKey");
assertEquals(3, reader.size());
}
use of org.apache.drill.exec.vector.complex.impl.SingleMapReaderImpl in project drill by apache.
the class TestBsonRecordReader method testStringType.
@Test
public void testStringType() throws IOException {
BsonDocument bsonDoc = new BsonDocument();
bsonDoc.append("stringKey", new BsonString("test_string"));
writer.reset();
bsonReader.write(writer, new BsonDocumentReader(bsonDoc));
SingleMapReaderImpl mapReader = (SingleMapReaderImpl) writer.getMapVector().getReader();
assertEquals("test_string", mapReader.reader("stringKey").readText().toString());
}
use of org.apache.drill.exec.vector.complex.impl.SingleMapReaderImpl in project drill by apache.
the class TestBsonRecordReader method testSpecialCharStringType.
@Test
public void testSpecialCharStringType() throws IOException {
BsonDocument bsonDoc = new BsonDocument();
bsonDoc.append("stringKey", new BsonString("§§§§§§§§§1"));
writer.reset();
bsonReader.write(writer, new BsonDocumentReader(bsonDoc));
SingleMapReaderImpl mapReader = (SingleMapReaderImpl) writer.getMapVector().getReader();
assertEquals("§§§§§§§§§1", mapReader.reader("stringKey").readText().toString());
}
Aggregations