Search in sources :

Example 1 with SqlRexConvertlet

use of org.apache.calcite.sql2rel.SqlRexConvertlet in project drill by apache.

the class DrillConvertletTable method get.

/*
   * Lookup the hash table to see if we have a custom convertlet for a given
   * operator, if we don't use StandardConvertletTable.
   */
@Override
public SqlRexConvertlet get(SqlCall call) {
    SqlRexConvertlet convertlet;
    if (call.getOperator() instanceof DrillCalciteSqlWrapper) {
        final SqlOperator wrapper = call.getOperator();
        final SqlOperator wrapped = DrillCalciteWrapperUtility.extractSqlOperatorFromWrapper(call.getOperator());
        if ((convertlet = map.get(wrapped)) != null) {
            return convertlet;
        }
        ((SqlBasicCall) call).setOperator(wrapped);
        SqlRexConvertlet sqlRexConvertlet = StandardConvertletTable.INSTANCE.get(call);
        ((SqlBasicCall) call).setOperator(wrapper);
        return sqlRexConvertlet;
    }
    if ((convertlet = map.get(call.getOperator())) != null) {
        return convertlet;
    }
    return StandardConvertletTable.INSTANCE.get(call);
}
Also used : SqlBasicCall(org.apache.calcite.sql.SqlBasicCall) SqlOperator(org.apache.calcite.sql.SqlOperator) SqlRexConvertlet(org.apache.calcite.sql2rel.SqlRexConvertlet)

Aggregations

SqlBasicCall (org.apache.calcite.sql.SqlBasicCall)1 SqlOperator (org.apache.calcite.sql.SqlOperator)1 SqlRexConvertlet (org.apache.calcite.sql2rel.SqlRexConvertlet)1