private void analyzeAllColumnsFromTable(
        List<Field> fields,
        AllColumns allColumns,
        QuerySpecification node,
        Scope scope,
        ImmutableList.Builder<Expression> outputExpressionBuilder,
        ImmutableList.Builder<Analysis.SelectExpression> selectExpressionBuilder,
        RelationType relationType,
        boolean local) {
      if (!allColumns.getAliases().isEmpty()) {
        validateColumnAliasesCount(allColumns.getAliases(), fields.size());
      }

      ImmutableList.Builder<Field> itemOutputFieldBuilder = ImmutableList.builder();

      for (int i = 0; i < fields.size(); i++) {
        Field field = fields.get(i);
        Expression fieldExpression;
        if (local) {
          fieldExpression = new FieldReference(relationType.indexOf(field));
        } else {
          if (!field.getName().isPresent()) {
            throw new SemanticException(
                "SELECT * from outer scope table not supported with anonymous columns");
          }
          checkState(field.getRelationAlias().isPresent(), "missing relation alias");
          fieldExpression =
              new DereferenceExpression(
                  DereferenceExpression.from(field.getRelationAlias().get()),
                  new Identifier(field.getName().get()));
        }
        analyzeExpression(fieldExpression, scope);
        outputExpressionBuilder.add(fieldExpression);
        selectExpressionBuilder.add(
            new Analysis.SelectExpression(fieldExpression, Optional.empty()));

        Optional<String> alias = field.getName();
        if (!allColumns.getAliases().isEmpty()) {
          alias = Optional.of(allColumns.getAliases().get(i).getValue());
        }

        Field newField =
            new Field(
                field.getRelationAlias(),
                alias,
                field.getType(),
                field.getColumnCategory(),
                false,
                field.getOriginTable(),
                field.getOriginColumnName(),
                !allColumns.getAliases().isEmpty() || field.isAliased());
        itemOutputFieldBuilder.add(newField);
        analysis.addSourceColumns(newField, analysis.getSourceColumns(field));

        Type type = field.getType();
        if (node.getSelect().isDistinct() && !type.isComparable()) {
          throw new SemanticException(
              String.format("DISTINCT can only be applied to comparable types (actual: %s)", type));
        }
      }
      analysis.setSelectAllResultFields(allColumns, itemOutputFieldBuilder.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