public String getSelectFromStatement(String tableName, List<String> selectFields, List<String> conditionFields, List<String> sqlJoinCompareOperate,
                                         List<PredicateInfo> predicateInfoes) {
        String fromClause = selectFields.stream()
                .map(this::quoteIdentifier)
                .collect(Collectors.joining(", "));

        String whereClause = conditionFields.stream()
                .map(f -> quoteIdentifier(sideTableInfo.getPhysicalFields().getOrDefault(f, f)) + sqlJoinCompareOperate.get(conditionFields.indexOf(f)) + wrapperPlaceholder(f))
                .collect(Collectors.joining(" AND "));

        String predicateClause = predicateInfoes.stream()
                .map(this::buildFilterCondition)
                .collect(Collectors.joining(" AND "));

        String dimQuerySql = "SELECT " + fromClause + " FROM " + tableName + (conditionFields.size() > 0 ? " WHERE " + whereClause : "")
                + (predicateInfoes.size() > 0 ? " AND " + predicateClause : "") + getAdditionalWhereClause();

        return dimQuerySql;
    }
Reason:
Date: 2018/11/26
Company: www.dtstack.com

@author maqi
rdb/rdb-side/src/main/java/com/dtstack/flink/sql/side/rdb/async/RdbAsyncSideInfo.java