Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(regress): re-generate expected output using default DateStyle and IntervalStyle #8386

Merged
merged 2 commits into from
Mar 7, 2023

Conversation

xiangjinwu
Copy link
Contributor

@xiangjinwu xiangjinwu commented Mar 7, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

PostgreSQL supports multiple DateStyle and IntervalStyle:

Style Specification Description Example
ISO (default) ISO 8601, SQL standard 1997-12-17 07:37:16-08
SQL traditional style 12/17/1997 07:37:16.00 PST
Postgres (test) original style Wed Dec 17 07:37:16 1997 PST
German regional style 17.12.1997 07:37:16.00 PS
Style Specification Year-Month Interval Day-Time Interval Mixed Interval
sql_standard 1-2 3 4:05:06 -1-2 +3 -4:05:06
postgres (default) 1 year 2 mons 3 days 04:05:06 -1 year -2 mons +3 days -04:05:06
postgres_verbose (test) @ 1 year 2 mons @ 3 days 4 hours 5 mins 6 secs @ 1 year 2 mons -3 days 4 hours 5 mins 6 secs ago
iso_8601 P1Y2M P3DT4H5M6S P-1Y-2M3D​T-4H-5M-6S

However, the regress test expectations are generated for DateStyle=Postgres, MDY and IntervalStyle=postgres_verbose.

// Set timezone and datestyle for datetime-related tests
set_var("PGTZ", "PST8PDT");
set_var("PGDATESTYLE", "Postgres, MDY");
// Likewise set intervalstyle to ensure consistent results. This is a bit
// more painful because we must use PGOPTIONS, and we want to preserve the
// user's ability to set other variables through that.
{
let mut pg_opts = var(VAR_PG_OPTS).unwrap_or_else(|_| "".to_string());
pg_opts.push_str(" -c intervalstyle=postgres_verbose");
set_var(VAR_PG_OPTS, pg_opts);
}

We do not intend to support all these styles soon. So this PR regenerates the expected output to test the default style. The styles are set explicitly in tests and do not rely on environment variable or config files.

The tests in interval.sql always set styles explicitly and do not rely on environment, so there is no need to re-generate.

Note that we have supported setting timezone so expected output relating to timezone are not regenerated in our default timezone.

Checklist For Contributors

  • All checks passed in ./risedev check (or alias, ./risedev c)

Documentation

  • My PR DOES NOT contain user-facing changes.

@github-actions github-actions bot added the component/test Test related issue. label Mar 7, 2023
@xiangjinwu xiangjinwu requested a review from lmatz March 7, 2023 06:44
@xiangjinwu xiangjinwu enabled auto-merge March 7, 2023 06:48
@xiangjinwu xiangjinwu added this pull request to the merge queue Mar 7, 2023
@codecov
Copy link

codecov bot commented Mar 7, 2023

Codecov Report

Merging #8386 (38a4f39) into main (03c49d9) will decrease coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #8386      +/-   ##
==========================================
- Coverage   71.52%   71.52%   -0.01%     
==========================================
  Files        1133     1133              
  Lines      184417   184417              
==========================================
- Hits       131911   131903       -8     
- Misses      52506    52514       +8     
Flag Coverage Δ
rust 71.52% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/batch/src/task/task_execution.rs 51.25% <0.00%> (-0.50%) ⬇️
...frontend/src/scheduler/hummock_snapshot_manager.rs 60.00% <0.00%> (-0.48%) ⬇️
src/object_store/src/object/mem.rs 86.87% <0.00%> (-0.39%) ⬇️
src/storage/src/hummock/compactor/iterator.rs 96.40% <0.00%> (-0.28%) ⬇️
src/storage/src/hummock/sstable_store.rs 64.77% <0.00%> (-0.16%) ⬇️
src/common/src/cache.rs 97.15% <0.00%> (-0.11%) ⬇️
src/stream/src/executor/aggregation/minput.rs 96.25% <0.00%> (-0.11%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/test Test related issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants