private <K, V> void runTest(String testOrcFileName, Type type, ExpectedValuesBuilder<K, V> expectedValuesBuilder) throws Exception { runTest(testOrcFileName, type, type, expectedValuesBuilder); }
private <K, V> void runTest(String testOrcFileName, Type type, ExpectedValuesBuilder<K, V> expectedValuesBuilder) throws Exception { runTest(testOrcFileName, type, type, expectedValuesBuilder); }
private <K, V> void runTest(String testOrcFileName, Type keyType, Type valueType, ExpectedValuesBuilder<K, V> expectedValuesBuilder) throws Exception { List<Map<K, V>> expectedValues = expectedValuesBuilder.build(); runTest(testOrcFileName, keyType, valueType, expectedValues, false, false); runTest(testOrcFileName, keyType, valueType, expectedValues, true, false); runTest(testOrcFileName, keyType, valueType, expectedValues, false, true); }
@Test public void testInteger() throws Exception { runTest("test_flat_map/flat_map_int.dwrf", IntegerType.INTEGER, ExpectedValuesBuilder.get(Function.identity())); }
@Test public void testShort() throws Exception { runTest("test_flat_map/flat_map_short.dwrf", SmallintType.SMALLINT, ExpectedValuesBuilder.get(Integer::shortValue)); }
@Test public void testList() throws Exception { runTest( "test_flat_map/flat_map_list.dwrf", IntegerType.INTEGER, LIST_TYPE, ExpectedValuesBuilder.get(Function.identity(), TestFlatMap::intToList)); }
@Test public void testByte() throws Exception { runTest("test_flat_map/flat_map_byte.dwrf", TinyintType.TINYINT, ExpectedValuesBuilder.get(Integer::byteValue)); }
@Test public void testShort() throws Exception { runTest("test_flat_map/flat_map_short.dwrf", SmallintType.SMALLINT, ExpectedValuesBuilder.get(Integer::shortValue)); }
@Test public void testLong() throws Exception { runTest("test_flat_map/flat_map_long.dwrf", BigintType.BIGINT, ExpectedValuesBuilder.get(Integer::longValue)); }
@Test public void testBoolean() throws Exception { runTest("test_flat_map/flat_map_boolean.dwrf", IntegerType.INTEGER, BooleanType.BOOLEAN, ExpectedValuesBuilder.get(Function.identity(), TestFlatMap::intToBoolean)); }
@Test public void testFloat() throws Exception { runTest("test_flat_map/flat_map_float.dwrf", IntegerType.INTEGER, RealType.REAL, ExpectedValuesBuilder.get(Function.identity(), Float::valueOf)); }
@Test public void testInteger() throws Exception { runTest("test_flat_map/flat_map_int.dwrf", IntegerType.INTEGER, ExpectedValuesBuilder.get(Function.identity())); }
@Test public void testDouble() throws Exception { runTest("test_flat_map/flat_map_double.dwrf", IntegerType.INTEGER, DoubleType.DOUBLE, ExpectedValuesBuilder.get(Function.identity(), Double::valueOf)); }
@Test public void testString() throws Exception { runTest("test_flat_map/flat_map_string.dwrf", VarcharType.VARCHAR, ExpectedValuesBuilder.get(i -> Integer.toString(i))); }
@Test public void testMap() throws Exception { runTest( "test_flat_map/flat_map_map.dwrf", IntegerType.INTEGER, MAP_TYPE, ExpectedValuesBuilder.get(Function.identity(), TestFlatMap::intToMap)); }
@Test public void testBoolean() throws Exception { runTest("test_flat_map/flat_map_boolean.dwrf", IntegerType.INTEGER, BooleanType.BOOLEAN, ExpectedValuesBuilder.get(Function.identity(), TestFlatMap::intToBoolean)); }
@Test public void testFloat() throws Exception { runTest("test_flat_map/flat_map_float.dwrf", IntegerType.INTEGER, RealType.REAL, ExpectedValuesBuilder.get(Function.identity(), Float::valueOf)); }
@Test public void testList() throws Exception { runTest( "test_flat_map/flat_map_list.dwrf", IntegerType.INTEGER, LIST_TYPE, ExpectedValuesBuilder.get(Function.identity(), TestFlatMap::intToList)); }
@Test public void testStruct() throws Exception { runTest( "test_flat_map/flat_map_struct.dwrf", IntegerType.INTEGER, STRUCT_TYPE, ExpectedValuesBuilder.get(Function.identity(), TestFlatMap::intToList)); }
@Test public void testBinary() throws Exception { runTest("test_flat_map/flat_map_binary.dwrf", VarbinaryType.VARBINARY, ExpectedValuesBuilder.get(i -> new SqlVarbinary(Integer.toString(i).getBytes(StandardCharsets.UTF_8)))); }