private Scope visitInsert(WrappedInsertStatement insert, Optional<Scope> scope) {
      final Scope ret = Scope.create();

      final MPPQueryContext context = insert.getContext();
      InsertBaseStatement innerInsert = insert.getInnerTreeStatement();

      innerInsert.semanticCheck();
      innerInsert.toLowerCase();

      innerInsert =
          AnalyzeUtils.analyzeInsert(
              context,
              innerInsert,
              () -> SchemaValidator.validate(metadata, insert, context, accessControl),
              metadata::getOrCreateDataPartition,
              AnalyzeUtils::computeTableDataPartitionParams,
              analysis,
              false);

      insert.setInnerTreeStatement(innerInsert);
      analysis.setScope(insert, ret);

      return ret;
    }
Visitor context represents local query scope (if exists). The invariant is that the local query
scopes hierarchy should always have outer query scope (if provided) as ancestor.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/analyzer/StatementAnalyzer.java