public SqlRexConvertlet get(SqlCall call) {
    SqlRexConvertlet convertlet;
    final SqlOperator op = call.getOperator();

    // Is there a convertlet for this operator
    // (e.g. SqlStdOperatorTable.plusOperator)?
    convertlet = (SqlRexConvertlet) map.get(op);
    if (convertlet != null) {
      return convertlet;
    }

    // Is there a convertlet for this class of operator
    // (e.g. SqlBinaryOperator)?
    Class<? extends Object> clazz = op.getClass();
    while (clazz != null) {
      convertlet = (SqlRexConvertlet) map.get(clazz);
      if (convertlet != null) {
        return convertlet;
      }
      clazz = clazz.getSuperclass();
    }

    // Is there a convertlet for this class of expression
    // (e.g. SqlCall)?
    clazz = call.getClass();
    while (clazz != null) {
      convertlet = (SqlRexConvertlet) map.get(clazz);
      if (convertlet != null) {
        return convertlet;
      }
      clazz = clazz.getSuperclass();
    }
    return null;
  }
 public Void visit(SqlCall call) {
   final SqlOperator operator = call.getOperator();
   if (operator == SqlStdOperatorTable.andOperator) {
     throw new Found();
   }
   return super.visit(call);
 }
 /** Throws a validation error if a DISTINCT or ALL quantifier is present but not allowed. */
 protected void validateQuantifier(SqlValidator validator, SqlCall call) {
   if ((null != call.getFunctionQuantifier()) && !isQuantifierAllowed()) {
     throw validator.newValidationError(
         call.getFunctionQuantifier(),
         EigenbaseResource.instance()
             .FunctionQuantifierNotAllowed
             .ex(call.getOperator().getName()));
   }
 }
示例#4
0
 // Override to copy all arguments regardless of whether visitor changes
 // them.
 protected SqlNode visitScoped(SqlCall call) {
   ArgHandler<SqlNode> argHandler = new CallCopyingArgHandler(call, true);
   call.getOperator().acceptCall(this, call, false, argHandler);
   return argHandler.result();
 }