@Override
    protected Scope visitAliasedRelation(AliasedRelation relation, Optional<Scope> scope) {
      analysis.setRelationName(relation, QualifiedName.of(ImmutableList.of(relation.getAlias())));
      analysis.addAliased(relation.getRelation());
      Scope relationScope = process(relation.getRelation(), scope);
      RelationType relationType = relationScope.getRelationType();

      // todo this check should be inside of TupleDescriptor.withAlias, but the exception needs the
      // node object
      if (relation.getColumnNames() != null) {
        int totalColumns = relationType.getVisibleFieldCount();
        if (totalColumns != relation.getColumnNames().size()) {
          throw new SemanticException(
              String.format(
                  "Column alias list has %s entries but '%s' has %s columns available",
                  relation.getColumnNames().size(), relation.getAlias(), totalColumns));
        }
      }

      List<String> aliases = null;
      Collection<Field> inputFields = relationType.getAllFields();
      if (relation.getColumnNames() != null) {
        aliases =
            relation.getColumnNames().stream()
                .map(Identifier::getValue)
                .collect(Collectors.toList());
        // hidden fields are not exposed when there are column aliases
        inputFields = relationType.getVisibleFields();
      }

      RelationType descriptor = relationType.withAlias(relation.getAlias().getValue(), aliases);

      checkArgument(
          inputFields.size() == descriptor.getAllFieldCount(),
          "Expected %s fields, got %s",
          descriptor.getAllFieldCount(),
          inputFields.size());

      Streams.forEachPair(
          descriptor.getAllFields().stream(),
          inputFields.stream(),
          (newField, field) ->
              analysis.addSourceColumns(newField, analysis.getSourceColumns(field)));

      return createAndAssignScope(relation, scope, descriptor);
    }
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