private PlanAndMappings coerceIfNecessary(
      PlanBuilder subPlan, Symbol symbol, Expression value, Optional<? extends Type> coercion) {
    Symbol coerced = symbol;

    if (coercion.isPresent()) {
      coerced = symbolAllocator.newSymbol(value, coercion.get());

      Assignments assignments =
          Assignments.builder()
              .putIdentities(subPlan.getRoot().getOutputSymbols())
              .put(
                  coerced,
                  new Cast(
                      symbol.toSymbolReference(),
                      new GenericDataType(
                          new Identifier(coercion.get().toString()), ImmutableList.of()),
                      false))
              .build();

      subPlan =
          subPlan.withNewRoot(
              new ProjectNode(idAllocator.genPlanNodeId(), subPlan.getRoot(), assignments));
    }

    return new PlanAndMappings(subPlan, ImmutableMap.of(NodeRef.of(value), coerced));
  }
Adds a negation of the given input and remaps the provided expression to the negated expression
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/SubqueryPlanner.java