private PlanBuilder planScalarSubquery(PlanBuilder subPlan, Cluster<SubqueryExpression> cluster) {
    // Plan one of the predicates from the cluster
    SubqueryExpression scalarSubquery = cluster.getRepresentative();

    RelationPlan relationPlan = planSubquery(scalarSubquery, subPlan.getTranslations());
    PlanBuilder subqueryPlan = newPlanBuilder(relationPlan, analysis);

    PlanNode root = new EnforceSingleRowNode(idAllocator.genPlanNodeId(), subqueryPlan.getRoot());

    Type type = analysis.getType(scalarSubquery);
    RelationType descriptor = relationPlan.getDescriptor();
    List<Symbol> fieldMappings = relationPlan.getFieldMappings();
    Symbol column;
    // Attention: remove this check after supporting RowType
    checkArgument(
        descriptor.getVisibleFieldCount() <= 1,
        "For now, only single column subqueries are supported");
    /*
    if (descriptor.getVisibleFieldCount() > 1) {
      column = symbolAllocator.newSymbol("row", type);

      ImmutableList.Builder<Expression> fields = ImmutableList.builder();
      for (int i = 0; i < descriptor.getAllFieldCount(); i++) {
        Field field = descriptor.getFieldByIndex(i);
        if (!field.isHidden()) {
          fields.add(fieldMappings.get(i).toSymbolReference());
        }
      }

      Expression expression = new Cast(new Row(fields.build()), toSqlType(type));

      root = new ProjectNode(idAllocator.genPlanNodeId(), root, Assignments.of(column, expression));
    } else {
    */
    column = getOnlyElement(fieldMappings);
    // }

    return appendCorrelatedJoin(
        subPlan,
        root,
        scalarSubquery.getQuery(),
        // Scalar subquery always contains EnforceSingleRowNode. Therefore, it's guaranteed
        // that subquery will return single row. Hence, correlated join can be of INNER type.
        JoinNode.JoinType.INNER,
        TRUE_LITERAL,
        mapAll(cluster, subPlan.getScope(), column));
  }
Plans a correlated subquery for value IN (subQuery)

@param originalExpression the original expression from which the IN predicate was derived. Used
    for subsequent translations.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/SubqueryPlanner.java