/**
  * Gets the right hand expression as a simple Java value. If the rhs is a more complex
  * expression, then creates a scratch variable and assigns the right hand expression to it. Then
  * returns the scratch variable.
  */
 private Expression rhsAsJava() {
   if (!RelDataTypeFactoryImpl.isJavaType(rhsType)) {
     Variable variable = translator.createScratchVariable(rhsType);
     addStatement(
         new ExpressionStatement(
             new AssignmentExpression(variable, AssignmentExpression.EQUALS, rhsExp)));
     return variable;
   }
   return rhsExp;
 }
 /** Creates a left hand side variable if one was not provided. */
 private void ensureLhs() {
   if (lhsExp == null) {
     lhsExp = translator.createScratchVariable(lhsType);
   }
 }