DefaultRecordReader implements RecordReader { @Override public Record read() throws IOException { if (schemaColumns == null) { loadSchema(); } ArrayRecord ret = new ArrayRecord(schemaColumns); String[] data = load(); if (data == null) { return null; } for (int i = 0; i < data.length; ++i) { try { setStringByType(ret, i, data[i]); } catch (Exception e) { throw new IOException("Parse Error while trans value", e); } } return ret; } DefaultRecordReader(InputStream is, TableSchema tableSchema); InputStream getRawStream(); Column[] getSchema(); @Override Record read(); List<String> readRaw(); @Override void close();  }
@Test public void testNewTypes() { ByteArrayInputStream is = new ByteArrayInputStream(csv.getBytes()); DefaultRecordReader reader = new DefaultRecordReader(is, schema); try { ArrayRecord r = (ArrayRecord) reader.read(); Assert.assertEquals(Byte.valueOf("-95"), r.getTinyint("t_tinyint")); Assert.assertEquals(Short.valueOf("19383"), r.getSmallint("t_smallint")); Assert.assertEquals(Integer.valueOf("-1771229031"), r.getInt("t_int")); Assert.assertEquals(Long.valueOf("6948727165337235705"), r.getBigint("t_bigint")); Assert.assertEquals(Float.valueOf("0.5246246"), r.getFloat("t_float")); Assert.assertEquals(Double.valueOf("0.35642806214579226"), r.getDouble("t_double")); Assert.assertEquals(BigDecimal.valueOf(241430112), r.getDecimal("t_decimal")); Assert.assertEquals(Timestamp.valueOf("5635-08-13 02:05:04.275"), r.getTimestamp("t_timestamp")); Assert.assertEquals("MM0NYZKU3D7F344UA8ZSASJMS3HU8LXSADDHE89ARTEFE6CQ6CWZ0WS3V8HNMOQ36K2B3VWSGEGGVPR1BRRXKC1G2B82U2NGMOGXOLKYHHB7WUOCYK66F1P3JM4H2TXMTRW45APAVSSBJWN8ZRRGGILYNJO85ARZTFOKFLPU2L45CXIFMGGPV8XREGST0GIES2E0D3XC6R941TQQJGJ51BGSNC07LS2MJ2L0BRC1A6DKKEL91X6JOUQYO34JI6I", r.getString("t_string")); Assert.assertEquals("HHYG85BZ9CIE6CUVC550VZYCHNHONEDIH8BT98OT8AGYTEAC7N24Q3VEP570FMEJV6VYFR5BMO2RY016A26OBQSB6L4C6XP14CBLPIS0JOE3KC00CWD762RVFX3WW31JMYOT3I2M60VKKE7CZ3544QH4E7QO2GRYACHQLUR5T2LOO05ETK315B1NQW8WNDRXO5YF9Y6ENF0QFOFZCNK1BJ9M2GA135C9BYVECY4LR209AXKZUNNGH5THNFATVCN", r.getVarchar("t_varchar").getValue()); Assert.assertEquals(false, r.getBoolean("t_boolean")); Assert.assertEquals("2O3TAPVWS12V2B4S8Y00MFM9LP7G879SF697FHQS2VWFIXQEXJVONDNSV32OHL5R5RGI5PPZ5BKCOKYOWXZVR4EOLIR75N4LVY75HXDHQFWI8O6HAQLZUER0I7FDIVZBQ25OTQ9XOPXI7YCQIBGAXVF2YGYENR5WH5V8IBDK4M2URQJJ9GEVA1DZUA7JB3YIKL5NG1666ADWPENNNP1QUBTEIHZZ067ITOFJKIJE11CN5PP8FLUVA2KP15JEX02", new String(r.getBinary("t_binary").data(), StandardCharsets.UTF_8)); Assert.assertNull(r.getArray("t_array")); Assert.assertNull(r.getMap("t_map")); Assert.assertNull(r.getStruct("t_struct")); } catch (IOException e) { Assert.fail(e.getMessage()); } }