MyCATApache/Mycat-Server · error · RuntimeException

Can't identify the operation of of where

Error message

Can't identify the operation of  of where

What it means

parserWhereOLD() is the legacy WHERE-clause translator in MongoSQLParser. It recursively handles AND/OR and comparison operators; if it encounters a binary operator whose name it does not recognize (anything other than AND, OR, and the handled comparisons), it throws RuntimeException("Can't identify the operation of of where"). The message itself is truncated/unpolished (double space), but the meaning is: an unsupported operator appears in the WHERE clause.

Solutions

  1. Rewrite the WHERE predicate using only supported operators (AND, OR, =, !=, <, >, <=, >=, LIKE, IN).
  2. Simplify or split complex predicates so each operator is one the parser recognizes.
  3. Filter unsupported conditions in application code instead of pushing them down to MongoDB.
  4. If you control the code, extend parserWhereOLD()'s operator dispatch to map the missing operator to a MongoDB $-operator.

Example fix

// before
SELECT * FROM t WHERE flags & 4 = 4;

// after
SELECT * FROM t WHERE (flags = 4) OR (flags = 5) OR (flags = 6) OR (flags = 7);
Defensive patterns

Strategy: try-catch

Validate before calling

Set<String> supported = Set.of("AND","OR","=","!=","<"," >","<=",">=","LIKE","IN");
// pre-scan WHERE clause operators and reject anything outside `supported` before executing

Try / catch

try {
    runQuery(sql);
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Can't identify the operation")) {
        // rewrite query with supported operators or filter client-side
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: A WHERE clause containing an operator parserWhereOLD does not handle, e.g. bitwise operators, `IS NOT`, `NOT LIKE`, `XOR`, or any custom/less-common SQL operator reached through the legacy parser path (parserWhereOLD, called via orWhere or recursively).

Common situations: Queries using advanced predicates (XOR, bitwise &, |, ^, ||) pushed to MongoDB through MyCat; SQL generated by ORMs that emits operators the simple translator never implemented; older code paths hitting parserWhereOLD instead of the newer parserWhere.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11). Data as JSON: /api/errors/022a38270cbba468. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/io/mycat/backend/jdbc/mongodb/MongoSQLParser.java:494

				  }
				  if (expr.getOperator().getName().equals("<>")) {
					  op = "$ne";
				  }

				  parserDBObject(o,exprL.toString(),op, getExpValue(expr.getRight()));
			  }
			  
		   }
		   else {
			 if (expr.getOperator().getName().equals("AND")) {  
			   parserWhere(exprL,o); 
			   parserWhere(expr.getRight(),o);
			 }
			 else if (expr.getOperator().getName().equals("OR")) {  
				orWhere(exprL,expr.getRight(),o); 				
			 }
			 else {
				 throw new RuntimeException("Can't identify the operation of  of where"); 
			 }
		   }
	   }
	  
	}
	
   
   private void orWhere(SQLExpr exprL,SQLExpr exprR ,BasicDBObject ob){ 
	   BasicDBObject xo = new BasicDBObject(); 
	   BasicDBObject yo = new BasicDBObject(); 
	   parserWhere(exprL,xo);
	   parserWhere(exprR,yo);
	   ob.put("$or",new Object[]{xo,yo});
   }	
}

View on GitHub (pinned to 65f8d8beb7)