@Test void getFieldTypes() { when(client.getIndexMappings("test")) .thenReturn( ImmutableMap.of( "test", new IndexMapping( ImmutableMap.<String, String>builder() .put("name", "keyword") .put("address", "text") .put("age", "integer") .put("account_number", "long") .put("balance1", "float") .put("balance2", "double") .put("gender", "boolean") .put("family", "nested") .put("employer", "object") .put("birthday", "date") .build()))); Table index = new ElasticsearchIndex(client, settings, "test"); Map<String, ExprType> fieldTypes = index.getFieldTypes(); assertThat( fieldTypes, allOf( aMapWithSize(10), hasEntry("name", (ExprType) ExprCoreType.STRING), hasEntry("address", (ExprType) ElasticsearchDataType.ES_TEXT), hasEntry("age", (ExprType) ExprCoreType.INTEGER), hasEntry("account_number", ExprCoreType.LONG), hasEntry("balance1", (ExprType) ExprCoreType.FLOAT), hasEntry("balance2", (ExprType) ExprCoreType.DOUBLE), hasEntry("gender", (ExprType) ExprCoreType.BOOLEAN), hasEntry("family", (ExprType) ExprCoreType.ARRAY), hasEntry("employer", (ExprType) ExprCoreType.STRUCT), hasEntry("birthday", (ExprType) ExprCoreType.TIMESTAMP))); }
@Override public Map<String, ExprType> getFieldTypes() { Map<String, ExprType> fieldTypes = new HashMap<>(); Map<String, IndexMapping> indexMappings = client.getIndexMappings(indexName); for (IndexMapping indexMapping : indexMappings.values()) { fieldTypes.putAll(indexMapping.getAllFieldTypes(this::transformESTypeToExprType)); } return fieldTypes; }
ElasticsearchIndex implements Table { @Override public Map<String, ExprType> getFieldTypes() { Map<String, ExprType> fieldTypes = new HashMap<>(); Map<String, IndexMapping> indexMappings = client.getIndexMappings(indexName); for (IndexMapping indexMapping : indexMappings.values()) { fieldTypes.putAll(indexMapping.getAllFieldTypes(this::transformESTypeToExprType)); } return fieldTypes; } }
ElasticsearchIndex implements Table { @Override public Map<String, ExprType> getFieldTypes() { Map<String, ExprType> fieldTypes = new HashMap<>(); Map<String, IndexMapping> indexMappings = client.getIndexMappings(indexName); for (IndexMapping indexMapping : indexMappings.values()) { fieldTypes.putAll(indexMapping.getAllFieldTypes(this::transformESTypeToExprType)); } return fieldTypes; }  }
ElasticsearchIndex implements Table { @Override public Map<String, ExprType> getFieldTypes() { Map<String, ExprType> fieldTypes = new HashMap<>(); Map<String, IndexMapping> indexMappings = client.getIndexMappings(indexName); for (IndexMapping indexMapping : indexMappings.values()) { fieldTypes.putAll(indexMapping.getAllFieldTypes(this::transformESTypeToExprType)); } return fieldTypes; }  @Override Map<String, ExprType> getFieldTypes(); @Override PhysicalPlan implement(LogicalPlan plan); }
ElasticsearchIndex implements Table { @Override public Map<String, ExprType> getFieldTypes() { Map<String, ExprType> fieldTypes = new HashMap<>(); Map<String, IndexMapping> indexMappings = client.getIndexMappings(indexName); for (IndexMapping indexMapping : indexMappings.values()) { fieldTypes.putAll(indexMapping.getAllFieldTypes(this::transformESTypeToExprType)); } return fieldTypes; }  @Override Map<String, ExprType> getFieldTypes(); @Override PhysicalPlan implement(LogicalPlan plan);  }