-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(inferSchema): add support for default values in schema inference #13414
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @lperson, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the BigQuery schema inference capabilities by integrating support for default values. Users can now define default expressions for their BigQuery table fields directly within their Go struct definitions, leveraging a new Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces support for default values in BigQuery schema inference via struct tags. The implementation is largely sound, adding a default tag option, updating the schema inference logic to handle it, and including new tests. However, there are a few areas for improvement. A key test for tag validation has been removed, which reduces test coverage. Additionally, there's a misleading error message for invalid tags, some inconsistency in the implementation for primitive types, and minor redundancy in new error messages. My review provides specific suggestions to address these points and improve the overall quality of the change.
|
/gemini review |
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.
Code Review
This pull request adds support for default values in schema inference, which is a valuable addition. My review focuses on a few key areas for improvement. There's an incorrect assumption about BigQuery's constraints on default values for NUMERIC types, which has led to an incorrect check and a flawed test case. The new test for *big.Rat also exposes a pre-existing issue where this type is not handled correctly during schema inference. Additionally, the PR is missing positive test cases to validate that the new default value feature works as expected for supported types. Finally, I've suggested a small refactoring to improve the clarity of the tag parsing logic. Addressing these points will make the feature more robust and correct.
|
/gemini review |
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.
Code Review
This pull request introduces support for default values in schema inference, which is a valuable addition. The implementation is solid, but I've identified a critical bug where default values are not correctly handled for standard integer types. Additionally, I've noticed that a test for tag parsing errors was removed, which reduces test coverage. I've also included a suggestion to simplify a part of the new logic. Please see the detailed comments below.
a7adee7 to
1ef1e78
Compare
|
/gemini review |
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.
Code Review
This pull request introduces support for default values in BigQuery schema inference, which is a great feature enhancement. The implementation is solid and includes comprehensive tests for both success and failure scenarios. I've identified one bug where default values for standard integer types are not being applied, and a small opportunity to simplify the tag parsing logic. Overall, this is a well-executed change.
|
/gemini review |
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.
Code Review
This pull request introduces a valuable feature by adding support for default values in schema inference. The implementation is clean and includes thorough tests. My review includes suggestions to extend this new functionality to INTERVAL and RANGE types for better completeness, along with corresponding test case additions.
|
/gemini review |
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.
Code Review
This pull request introduces support for default value expressions in BigQuery schema inference via struct tags. The changes are well-implemented, including updates to the tag parser, a new function to validate which types can have default values, and modifications to the schema inference logic to populate the DefaultValueExpression field. The accompanying tests are thorough, covering both valid and invalid use cases for the new default tag option. I have one suggestion to improve the logical correctness of schema inference for array types, which I've detailed in a specific comment. Overall, this is a valuable feature enhancement.
4f71428 to
8ffad79
Compare
|
/gemini review |
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.
Code Review
This pull request adds support for specifying default values for fields during BigQuery schema inference using a default struct tag. The implementation is robust, including validation for supported types, comprehensive unit tests for both valid and invalid usage, and updated documentation. The changes are well-contained and the logic is sound. I have one minor suggestion to improve code clarity and consistency.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
/gemini review |
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.
Code Review
This pull request adds support for inferring default values from struct tags for BigQuery schemas. The changes include updating the tag parser, adding logic to handle the default tag option in schema inference, and providing comprehensive documentation and tests. My review has identified a potential issue with handling duplicate default tags on a field, which could lead to unexpected behavior. I've also suggested a refactoring to improve the readability of the new isDefaultable helper function. Overall, the changes are well-implemented and tested.
|
/gemini review |
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.
Code Review
This pull request introduces support for default values in BigQuery schema inference by adding a default struct tag option. The changes are well-implemented, including updates to the tag parser, schema inference logic, and the addition of comprehensive documentation and tests. The code is solid, and I have one suggestion to improve the readability of the isDefaultable function for better long-term maintainability.
|
/gemini review |
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.
Code Review
This pull request adds support for inferring default values for fields from struct tags in InferSchema. The changes include introducing a new default tag option, updating the tag parser to recognize it, and modifying the schema inference logic to handle default value expressions for supported types. The implementation correctly identifies which types are 'defaultable' and adds extensive documentation and test coverage for the new feature, including positive and negative test cases. The overall implementation is solid. I have one suggestion to improve code quality in the test files by reducing duplication.
|
/gemini review |
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.
Code Review
This pull request introduces support for default values in BigQuery schema inference. The implementation is thorough, adding a new default struct tag option and handling its parsing and validation correctly. The changes include a new isDefaultable helper function to determine which types support default values, and the schema inference logic is updated accordingly. The new feature is well-documented with clear examples, and the accompanying tests are comprehensive, covering various types and error conditions. The code quality is high, and the changes are a valuable addition. Great work!
closes #13413