[SPARK-32564][SQL][TEST][3.0] Inject data statistics to simulate plan generation on actual TPCDS data #29390
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
TPCDSQuerySuitecurrently computes plans with empty TPCDS tables, then checks if plans can be generated correctly. But, the generated plans can be different from actual ones because the input tables are empty (e.g., the plans always use broadcast-hash joins, but actual ones use sort-merge joins for larger tables). To mitigate the issue, this PR defines data statistics constants extracted from generated TPCDS data inTPCDSTableStats, then injects the statistics viaspark.sessionState.catalog.alterTableStatswhen defining TPCDS tables inTPCDSQuerySuite.Please see a link below about how to extract the table statistics:
For example, the generated plans of TPCDS
q2are different with/without this fix:This comes from the @cloud-fan comment: #29270 (comment)
This is the backport of #29384.
Why are the changes needed?
For better test coverage.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing tests.