Search in sources :

Example 1 with SqlOverlapsOperator

use of org.apache.calcite.sql.fun.SqlOverlapsOperator in project calcite by apache.

the class DocumentationTest method addOperators.

private void addOperators(Map<String, PatternOp> map, String prefix, List<SqlOperator> operatorList) {
    for (SqlOperator op : operatorList) {
        final String name = op.getName().equals("TRANSLATE3") ? "TRANSLATE" : op.getName();
        if (op instanceof SqlSpecialOperator || !name.matches("^[a-zA-Z][a-zA-Z0-9_]*$")) {
            continue;
        }
        final String regex;
        if (op instanceof SqlOverlapsOperator) {
            regex = "[ ]*<td>period1 " + name + " period2</td>";
        } else if (op instanceof SqlFunction && (op.getOperandTypeChecker() == null || op.getOperandTypeChecker().getOperandCountRange().getMin() != 0)) {
            regex = prefix + "\\| .*" + name + "\\(.*";
        } else {
            regex = prefix + "\\| .*" + name + ".*";
        }
        map.put(regex, new PatternOp(Pattern.compile(regex), name));
    }
}
Also used : SqlOperator(org.apache.calcite.sql.SqlOperator) SqlOverlapsOperator(org.apache.calcite.sql.fun.SqlOverlapsOperator) SqlSpecialOperator(org.apache.calcite.sql.SqlSpecialOperator) SqlFunction(org.apache.calcite.sql.SqlFunction)

Aggregations

SqlFunction (org.apache.calcite.sql.SqlFunction)1 SqlOperator (org.apache.calcite.sql.SqlOperator)1 SqlSpecialOperator (org.apache.calcite.sql.SqlSpecialOperator)1 SqlOverlapsOperator (org.apache.calcite.sql.fun.SqlOverlapsOperator)1