public String getAdaptSelectSql(){
        String fields = String.join(",", getFields());
        String virtualFieldsStr = "";

        if(virtualFields.size() == 0){
            return null;
        }

        for(Map.Entry<String, String> entry : virtualFields.entrySet()){
            virtualFieldsStr += entry.getValue() +" AS " + entry.getKey() + ",";
        }

        if(!Strings.isNullOrEmpty(virtualFieldsStr)){
            fields += "," + virtualFieldsStr.substring(0, virtualFieldsStr.lastIndexOf(","));
        }

        return String.format("select %s from %s", fields, getAdaptName());
    }
Reason:
Date: 2018/6/25
Company: www.dtstack.com
@author xuchao
core/src/main/java/com/dtstack/flink/sql/table/AbstractSourceTableInfo.java