Code review comment: I am not quiet sure how to merge the first three blocks with the last one, because the first three use `resBuilder().makeCall()` while the last one uses `rexBuilder().makeApproxLiteral()`. Also, `returnType` seems can only be used in the last block.

Code under review:
private RexNode convertSimpleValueToRexNode(TypeKind kind, Value value) {
    if (value.isNull()) {
      return rexBuilder()
          .makeNullLiteral(ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder()));
    }

    RexNode ret;
    switch (kind) {
      case TYPE_BOOL:
        ret = rexBuilder().makeLiteral(value.getBoolValue());
        break;
      case TYPE_INT32:
        ret =
            rexBuilder()
                .makeExactLiteral(
                    new BigDecimal(value.getInt32Value()),
                    ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder()));
        break;
      case TYPE_INT64:
        ret =
            rexBuilder()
                .makeExactLiteral(
                    new BigDecimal(value.getInt64Value()),
                    ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder()));
        break;
      case TYPE_FLOAT:
        ret =
            rexBuilder()
                .makeApproxLiteral(
                    new BigDecimal(value.getFloatValue()),
                    ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder()));
        break;
      case TYPE_DOUBLE:
        
        
        
        
        double val = value.getDoubleValue();
        if (Double.isInfinite(val) && val > 0) {
          ret =
              rexBuilder()
                  .makeCall(
                      SqlOperators.createOtherKindSqlFunction(
                          BeamBigQuerySqlDialect.DOUBLE_POSITIVE_INF_FUNCTION,
                          ZetaSqlCalciteTranslationUtils.toCalciteTypeName(kind)));
        } else if (Double.isInfinite(val) && val < 0) {
          ret =
              rexBuilder()
                  .makeCall(
                      SqlOperators.createOtherKindSqlFunction(
                          BeamBigQuerySqlDialect.DOUBLE_NEGATIVE_INF_FUNCTION,
                          ZetaSqlCalciteTranslationUtils.toCalciteTypeName(kind)));
        } else if (Double.isNaN(val)) {
          ret =
              rexBuilder()
                  .makeCall(
                      SqlOperators.createOtherKindSqlFunction(
                          BeamBigQuerySqlDialect.DOUBLE_NAN_FUNCTION,
                          ZetaSqlCalciteTranslationUtils.toCalciteTypeName(kind)));
        } else {
          ret =
              rexBuilder()
                  .makeApproxLiteral(
                      new BigDecimal(val),
                      ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder()));
        }
        break;
      case TYPE_STRING:
        
        
        ret =
            rexBuilder()
                .makeLiteral(
                    value.getStringValue(), typeFactory().createSqlType(SqlTypeName.VARCHAR), true);
        break;
      case TYPE_NUMERIC:
        
        
        
        
        
        ret =
            rexBuilder()
                .makeCall(
                    SqlOperators.createOtherKindSqlFunction(
                        BeamBigQuerySqlDialect.NUMERIC_LITERAL_FUNCTION,
                        ZetaSqlCalciteTranslationUtils.toCalciteTypeName(kind)),
                    ImmutableList.of(
                        rexBuilder()
                            .makeExactLiteral(
                                value.getNumericValue(),
                                ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(
                                    kind, rexBuilder()))));
        break;
      case TYPE_TIMESTAMP:
        ret =
            rexBuilder()
                .makeTimestampLiteral(
                    TimestampString.fromMillisSinceEpoch(
                        safeMicrosToMillis(value.getTimestampUnixMicros())),
                    typeFactory().getTypeSystem().getMaxPrecision(SqlTypeName.TIMESTAMP));
        break;
      case TYPE_DATE:
        ret = rexBuilder().makeDateLiteral(convertDateValueToDateString(value));
        break;
      case TYPE_TIME:
        RelDataType timeType =
            typeFactory()
                .createSqlType(
                    SqlTypeName.TIME,
                    typeFactory().getTypeSystem().getMaxPrecision(SqlTypeName.TIME));
        
        ret = rexBuilder().makeLiteral(convertTimeValueToTimeString(value), timeType, false);
        break;
      case TYPE_BYTES:
        ret = rexBuilder().makeBinaryLiteral(new ByteString(value.getBytesValue().toByteArray()));
        break;
      default:
        throw new UnsupportedOperationException("Unsupported column type: " + kind);
    }

    return ret;
  }

Line commented on: ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder()));

Revised code:
private RexNode convertSimpleValueToRexNode(TypeKind kind, Value value) {
    if (value.isNull()) {
      return rexBuilder()
          .makeNullLiteral(ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder()));
    }

    RexNode ret;
    switch (kind) {
      case TYPE_BOOL:
        ret = rexBuilder().makeLiteral(value.getBoolValue());
        break;
      case TYPE_INT32:
        ret =
            rexBuilder()
                .makeExactLiteral(
                    new BigDecimal(value.getInt32Value()),
                    ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder()));
        break;
      case TYPE_INT64:
        ret =
            rexBuilder()
                .makeExactLiteral(
                    new BigDecimal(value.getInt64Value()),
                    ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder()));
        break;
      case TYPE_FLOAT:
        ret =
            rexBuilder()
                .makeApproxLiteral(
                    new BigDecimal(value.getFloatValue()),
                    ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder()));
        break;
      case TYPE_DOUBLE:
        
        
        
        
        double val = value.getDoubleValue();
        String wrapperFun = null;
        if (val == Double.POSITIVE_INFINITY) {
          wrapperFun = BeamBigQuerySqlDialect.DOUBLE_POSITIVE_INF_FUNCTION;
        } else if (val == Double.NEGATIVE_INFINITY) {
          wrapperFun = BeamBigQuerySqlDialect.DOUBLE_NEGATIVE_INF_FUNCTION;
        } else if (Double.isNaN(val)) {
          wrapperFun = BeamBigQuerySqlDialect.DOUBLE_NAN_FUNCTION;
        }

        RelDataType returnType =
            ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(kind, rexBuilder());
        if (wrapperFun == null) {
          ret = rexBuilder().makeApproxLiteral(new BigDecimal(val), returnType);
        } else if (BeamBigQuerySqlDialect.DOUBLE_NAN_FUNCTION.equals(wrapperFun)) {
          

          
          
          
          
          ret =
              rexBuilder()
                  .makeCall(
                      SqlOperators.createZetaSqlFunction(wrapperFun, returnType.getSqlTypeName()),
                      ImmutableList.of(
                          rexBuilder()
                              .makeApproxLiteral(new BigDecimal(Math.random()), returnType)));
          ;
        } else {
          ret =
              rexBuilder()
                  .makeCall(
                      SqlOperators.createZetaSqlFunction(wrapperFun, returnType.getSqlTypeName()));
        }
        break;
      case TYPE_STRING:
        
        
        ret =
            rexBuilder()
                .makeLiteral(
                    value.getStringValue(), typeFactory().createSqlType(SqlTypeName.VARCHAR), true);
        break;
      case TYPE_NUMERIC:
        
        
        
        
        
        ret =
            rexBuilder()
                .makeCall(
                    SqlOperators.createZetaSqlFunction(
                        BeamBigQuerySqlDialect.NUMERIC_LITERAL_FUNCTION,
                        ZetaSqlCalciteTranslationUtils.toCalciteTypeName(kind)),
                    ImmutableList.of(
                        rexBuilder()
                            .makeExactLiteral(
                                value.getNumericValue(),
                                ZetaSqlCalciteTranslationUtils.toSimpleRelDataType(
                                    kind, rexBuilder()))));
        break;
      case TYPE_TIMESTAMP:
        ret =
            rexBuilder()
                .makeTimestampLiteral(
                    TimestampString.fromMillisSinceEpoch(
                        safeMicrosToMillis(value.getTimestampUnixMicros())),
                    typeFactory().getTypeSystem().getMaxPrecision(SqlTypeName.TIMESTAMP));
        break;
      case TYPE_DATE:
        ret = rexBuilder().makeDateLiteral(convertDateValueToDateString(value));
        break;
      case TYPE_TIME:
        RelDataType timeType =
            typeFactory()
                .createSqlType(
                    SqlTypeName.TIME,
                    typeFactory().getTypeSystem().getMaxPrecision(SqlTypeName.TIME));
        
        ret = rexBuilder().makeLiteral(convertTimeValueToTimeString(value), timeType, false);
        break;
      case TYPE_BYTES:
        ret = rexBuilder().makeBinaryLiteral(new ByteString(value.getBytesValue().toByteArray()));
        break;
      default:
        throw new UnsupportedOperationException("Unsupported column type: " + kind);
    }

    return ret;
  }