THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||
---|---|---|
| ||
public class MySQLParser implements Parser { private OperationContext operationContext; public MySQLParser(OperationContext operation) { this.operation = operation; } @Override List<Operation> parse(String statement) { // parse it to AST(Abstract Semantic Tree) MySQLAST mysqlAST = parseStament(statement); // convert the AST to Flink OperationTree List<Operation> operations = convertToOperation(mysqlAST); } private List<Operation> convertToOperation(MySQLAST mysqlAST) { // may look likes like Operation operation = operationContext.project(Arrays.asList(Expressions.$("f0"), operationContext.scan("t1")); return Collections.singletonList(operation) } @Override UnresolvedIdentifier parseIdentifier(String identifier) { // may need to identifier `db.t` to array of [db, t] string[] names = parseMySQLIdentifier(identifier); return UnresolvedIdentifier.of(names); } @Override ResolvedExpression parseSqlExpression( String sqlExpression, RowType inputRowType, @Nullable LogicalType outputType) { // parse sqlExpression to ResolvedExpression } @Override String[] getCompletionHints(String statement, int position) { // just for example, return empty string array directly return new String[0]; } } |
...