feat(dv): visitor pattern hashing utilities#3377
Conversation
Summary of ChangesHello @manitgupta, 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 introduces a robust visitor pattern for Spanner Highlights
Changelog
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
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3377 +/- ##
============================================
+ Coverage 51.04% 56.69% +5.64%
+ Complexity 5211 1747 -3464
============================================
Files 994 474 -520
Lines 60723 27066 -33657
Branches 6657 2883 -3774
============================================
- Hits 30997 15345 -15652
+ Misses 27546 10800 -16746
+ Partials 2180 921 -1259
🚀 New features to boost your workflow:
|
TL;DR
Implemented a Visitor pattern for Spanner Value types to improve code maintainability and reduce duplication.
What changed?
Added three new classes to implement the Visitor pattern for Spanner Value types:
IUnifiedVisitor- Interface defining visit methods for each Spanner data type with a static dispatch method to route values to the appropriate visitor method.UnifiedHasherVisitor- Implementation that hashes Spanner values using a provided Hasher, with careful handling of null values and type-specific encoding.UnifiedStringVisitor- Implementation that converts Spanner values to their string representation.Added comprehensive unit tests for both visitor implementations to verify correct behavior for all Spanner data types.
How to test?
Added tests for the Visitor classes.
UnifiedHasherVisitorTest- Tests the hashing logic.UnifiedStringVisitorTest- Tests the string conversion logic.IUnifiedVisitorTest- Tests thedispatchlogic.