@Override
    public void parseSql(String sql, SqlTree sqlTree) {
        if (NONEMPTYVIEW.matcher(sql).find()) {
            Matcher matcher = NONEMPTYVIEW.matcher(sql);
            String tableName = null;
            String selectSql = null;
            if (matcher.find()) {
                tableName = matcher.group(1);
                selectSql = "select " + matcher.group(2);
            }

            SqlNode sqlNode = null;
            try {
                sqlNode = flinkPlanner.getParser().parse(selectSql);
            } catch (Exception e) {
                throw new RuntimeException("", e);
            }

            CreateTmpTableParser.SqlParserResult sqlParseResult = new CreateTmpTableParser.SqlParserResult();
            parseNode(sqlNode, sqlParseResult);

            sqlParseResult.setTableName(tableName);
            String transformSelectSql = DtStringUtil.replaceIgnoreQuota(sqlNode.toString(), "`", "");
            sqlParseResult.setExecSql(transformSelectSql);
            sqlTree.addTmpSql(sqlParseResult);
            sqlTree.addTmplTableInfo(tableName, sqlParseResult);
        } else {
            if (EMPTYVIEW.matcher(sql).find()) {
                Matcher matcher = EMPTYVIEW.matcher(sql);
                String tableName = null;
                String fieldsInfoStr = null;
                if (matcher.find()) {
                    tableName = matcher.group(1);
                    fieldsInfoStr = matcher.group(2);
                }
                CreateTmpTableParser.SqlParserResult sqlParseResult = new CreateTmpTableParser.SqlParserResult();
                sqlParseResult.setFieldsInfoStr(fieldsInfoStr);
                sqlParseResult.setTableName(tableName);
                sqlTree.addTmplTableInfo(tableName, sqlParseResult);
            }
        }
    }
parser create tmp table sql
Date: 2018/6/26
Company: www.dtstack.com

@author yanxi
core/src/main/java/com/dtstack/flink/sql/parser/CreateTmpTableParser.java