-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
API: Removes Explicit Parameterization of Schema Tests #11444
base: main
Are you sure you want to change the base?
Conversation
private static final Map<Type.TypeID, Integer> MIN_FORMAT_VERSIONS = | ||
ImmutableMap.of(Type.TypeID.TIMESTAMP_NANO, 3); | ||
|
||
private static final Integer MIN_FORMAT_INITIAL_DEFAULT = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe I should just be extracting these from Schema rather than redeclaring them here ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only worry here is we won't catch bugs in bad constants in Schema.java, probably not a real worry
|
||
private static final Integer MIN_FORMAT_INITIAL_DEFAULT = 3; | ||
|
||
private static final Integer MAX_FORMAT_VERSION = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a test constant i'd really like to have in just one file somewhere in API, placed here now to demonstrate what I want to do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for refactoring the tests. LGTM. That avoids the duplication.
private static final Map<Type.TypeID, Integer> MIN_FORMAT_VERSIONS = | ||
ImmutableMap.of(Type.TypeID.TIMESTAMP_NANO, 3); | ||
|
||
private static final Integer MIN_FORMAT_INITIAL_DEFAULT = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, thanks @RussellSpitzer
A lot of our tests are currently very specific but are going to be reused for various other types as they get added. We also currently hard code in the versions we are testing. This makes it a little more difficult whenever we add a new format version to correctly update all of the corresponding tests.
I'm updating TestSchema to show what I think should be our general pattern for version specific testing where the versions tested are defined in a single location rather than each time per test.
For the "type" tests, rather than making a named test per type, we parameterize over the type itself so that new types (Geo and Variant) can be added without duplicating code.