QueryResult implements Iterable<Object[]> { public Map<String, String> columnNameTypes() { Map<String, String> colNameTypes = new LinkedHashMap<>(); schema.getColumns().forEach(column -> colNameTypes.put(column.getName(), column.getExprType().typeName().toLowerCase())); return colNameTypes; }  int size(); Map<String, String> columnNameTypes(); @Override Iterator<Object[]> iterator();  }
@Test void columnNameTypes() { QueryResult response = new QueryResult( schema, Collections.singletonList( tupleValue(ImmutableMap.of("name", "John", "age", 20)) )); assertEquals( ImmutableMap.of("name", "string", "age", "integer"), response.columnNameTypes() ); }
@Test void columnNameTypesFromEmptyExprValues() { QueryResult response = new QueryResult( schema, Collections.emptyList()); assertEquals( ImmutableMap.of("name", "string", "age", "integer"), response.columnNameTypes() ); }
@Test void columnNameTypesFromExprValuesWithMissing() { QueryResult response = new QueryResult( schema, Arrays.asList( tupleValue(ImmutableMap.of("name", "John")), tupleValue(ImmutableMap.of("name", "John", "age", 20)) )); assertEquals( ImmutableMap.of("name", "string", "age", "integer"), response.columnNameTypes() ); }