investigate/convert to Calcite's SchemaPlus way of reading calcite models instea...
- Dominant language
- Java
- Stars
- 274
- Forks
- 140
- Avg merge
- 5d 16h
- Merged PRs (30d)
- 4
Description
investigate/convert to Calcite's SchemaPlus way of reading calcite models instead of manually handling JSON
https://github.com/apache/incubator-wayang/blob/9d7ecc49ae91f1bb93bded435310e53513bdd28f/wayang-api/wayang-api-sql/src/main/java/org/apache/wayang/api/sql/calcite/utils/ModelParser.java#L34
```java
package org.apache.wayang.api.sql.calcite.utils;
import org.apache.wayang.core.api.Configuration;
import org.json.simple.parser.ParseException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Iterator;
import java.util.Objects;
/*
* TODO: investigate/convert to Calcite's SchemaPlus way of reading calcite models instead of manually handling JSON
*/
public class ModelParser {
private final Configuration configuration;
private final JsonNode json;
public ModelParser() throws IOException, ParseException {
final String jsonString = Files
.readString(new File("wayang-api/wayang-api-sql/src/main/resources/model.json").toPath());
final ObjectMapper objectMapper = new ObjectMapper();
this.json = objectMapper.readTree(jsonString);
this.configuration = null;
}
public ModelParser(final Configuration configuration) throws IOException, ParseException {
final String calciteModel = "{\"calcite\":" + configuration.getStringProperty("wayang.calcite.model")
+ ",\"separator\":\";\"}";
final ObjectMapper objectMapper = new ObjectMapper();
this.json = objectMapper.readTree(calciteModel);
this.configuration = configuration;
}
/**
```
42ae52181df51b4758af79cc1688e807c1e634b0
Contributor guide
Assessment
This issue has not been assessed yet.