Skip to content

Conversation

@hantangwangd
Copy link
Member

Description

[NDR]: test for free disk spaces

Motivation and Context

N/A

Impact

N/A

Test Plan

N/A

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

== NO RELEASE NOTE ==

This change free disk space for `product-tests-basic-environment`
and `spark-integration` which are failing frequently due to disk
space issues
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 14, 2025

Reviewer's Guide

This PR refactors and extends materialized view tests to cover stitching and non-stitching access control, adds new drop/rename base table scenarios, enhances the analyzer to respect the data consistency flag, tightens memory plugin tests to expect failures, and integrates the free-disk-space GitHub action to replace manual cleanup.

Sequence diagram for materialized view analysis with data consistency flag

sequenceDiagram
    participant S as "StatementAnalyzer"
    participant A as "Analysis"
    participant M as "MaterializedViewAnalysisState"
    participant D as "MaterializedViewDefinition"
    participant Q as "Query"
    S->>A: getStatement()
    S->>A: getMaterializedViewAnalysisState(table)
    S->>M: isNotVisited()
    alt Data consistency enabled
        S->>S: processMaterializedView(...)
    else Data consistency disabled
        S->>A: getAccessControlReferences().addMaterializedViewDefinitionReference(...)
        S->>D: getOriginalSql()
        S->>Q: createStatement(originalSql, parsingOptions)
        S->>A: registerMaterializedViewForAnalysis(...)
        S->>S: process(viewQuery, scope)
        S->>A: unregisterMaterializedViewForAnalysis(table)
    end
Loading

Class diagram for updated materialized view analysis in StatementAnalyzer

classDiagram
    class StatementAnalyzer {
        +visitTable(table, scope)
        -processMaterializedView(table, name, scope, materializedView)
    }
    class MaterializedViewAnalysisState {
        +isNotVisited()
        +isVisited()
    }
    class Analysis {
        +getStatement()
        +getMaterializedViewAnalysisState(table)
        +getAccessControlReferences()
        +registerMaterializedViewForAnalysis(name, table, sql)
        +unregisterMaterializedViewForAnalysis(table)
    }
    class MaterializedViewDefinition {
        +getOriginalSql()
    }
    class Query {}
    StatementAnalyzer --> Analysis
    StatementAnalyzer --> MaterializedViewAnalysisState
    StatementAnalyzer --> MaterializedViewDefinition
    StatementAnalyzer --> Query
Loading

File-Level Changes

Change Details Files
Refactor and extend materialized view access control tests
  • split invoker session into stitching and non-stitching variants
  • replace generic consumer with explicit assertAccessAllowed/Denied calls
  • ensure cleanup of materialized view in finally block
presto-hive/src/test/java/com/facebook/presto/hive/TestHiveMaterializedViewLogicalPlanner.java
Add smoke tests for MV base table drop and rename scenarios
  • implement testMaterializedViewBaseTableDropped
  • implement testMaterializedViewBaseTableRenamed
  • test both stitching enabled and disabled sessions
presto-hive/src/test/java/com/facebook/presto/hive/TestHiveIntegrationSmokeTest.java
Enhance StatementAnalyzer to handle MV data consistency toggle
  • add branch for disabled consistency to check base table permissions
  • parse and analyze original view SQL when not stitching
  • register and unregister materialized view definitions around analysis
presto-main-base/src/main/java/com/facebook/presto/sql/analyzer/StatementAnalyzer.java
Tighten memory plugin MV tests to expect failures post base table changes
  • convert assertQuery to assertQueryFails for drop scenarios
  • convert assertQuery to assertQueryFails for rename scenarios
presto-memory/src/test/java/com/facebook/presto/plugin/memory/TestMemoryMaterializedViews.java
Integrate free-disk-space GitHub action replacing manual cleanup
  • remove manual df and apt-get clean commands
  • add jlumbroso/[email protected] action
  • configure tool-cache and swap-storage inputs
.github/workflows/product-tests-basic-environment.yml
.github/workflows/spark-integration.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant