@Override
      protected List<Expression> visitCoalesceExpression(CoalesceExpression node, Scope context) {
        ImmutableList.Builder<List<Expression>> childrenResultListBuilder =
            new ImmutableList.Builder<>();
        node.getOperands()
            .forEach(operand -> childrenResultListBuilder.add(process(operand, context)));
        List<List<Expression>> childrenResultList = childrenResultListBuilder.build();
        if (expandedExpressions == null) {
          // no Columns need to be expanded
          return Collections.singletonList(node);
        }

        ImmutableList.Builder<Expression> resultBuilder = new ImmutableList.Builder<>();
        int maxSize = childrenResultList.stream().mapToInt(List::size).max().orElse(0);

        AtomicInteger baseIndex = new AtomicInteger(0);
        // if child is expanded, index of it reference the baseIndex, else the index of it always be
        // 0
        AtomicInteger[] childrenIndexes = new AtomicInteger[childrenResultList.size()];
        for (int i = 0; i < childrenIndexes.length; i++) {
          childrenIndexes[i] =
              (childrenResultList.get(i).size() == maxSize) ? baseIndex : new AtomicInteger(0);
        }
        for (int i = 0; i < maxSize; i++) {
          ImmutableList.Builder<Expression> operandListBuilder = new ImmutableList.Builder<>();
          for (int j = 0; j < childrenIndexes.length; j++) {
            int operandIndexInResult = childrenIndexes[j].get();
            operandListBuilder.add(childrenResultList.get(j).get(operandIndexInResult));
          }
          resultBuilder.add(new CoalesceExpression(operandListBuilder.build()));
          baseIndex.getAndIncrement();
        }
        return resultBuilder.build();
      }
Check if there is Columns function in expression, and verify they are same if there are multi
Column functions.

@param expression input expression
@return if there is Columns function in expression
@throws SemanticException if there are multi Columns functions but different
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java