-
Notifications
You must be signed in to change notification settings - Fork 311
Cleanup | Remove unused UDT serialization code #3462
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?
Cleanup | Remove unused UDT serialization code #3462
Conversation
This always holds the constant value of true. Code paths which rely on it being false will never be called.
IsNullable and _padBuffer were only referenced when _isTopLevelUdt was false. _nullInstance was only referenced from IsNullable
This was always set to false
These fields are assigned to, but never used
SqlConnection.GetBytes output a Format parameter which was never used at its call sites
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3462 +/- ##
==========================================
- Coverage 65.44% 60.16% -5.28%
==========================================
Files 280 274 -6
Lines 62386 62007 -379
==========================================
- Hits 40828 37308 -3520
- Misses 21558 24699 +3141
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
This sits alongside #3423. Where the earlier PR widens test coverage of the UDT serialization logic, this one simplifies conditions which are constant at runtime. The two primary variables here are
_isTopLevelUdt
and_skipNormalize
._isTopLevelUdt
is a readonly variable, which is set in the soleBinaryOrderedUdtNormalizer
constructor to a hardcoded value oftrue
. There are then a set of if conditions which test if the variable is false, and which will thus never be called. This PR removes these. The ripple effects of these result in the_padBuffer
and_nullInstance
variables never being set (and theIsNullable
property never being referenced.) These members are also removed._skipNormalize
is another variable, this time defined on theNormalizer
base class. It is only ever set tofalse
, and thus every condition which tests if it is false will succeed. This PR removes the test and runs the code unconditionally.This accounts for the bulk of the changes. There is one parameter on the constructor to
BinaryOrderedUdtNormalizer
which is never used, a comment which is incorrect, a call toGetFormat
which discards the result, and several fields onSqlUdtInfo
which are written to, but never read.Review of the wider area will highlight some code paths (such as the
Size
property) which remain unused. There are also quirks such as the use of a per-thread type cache, the implementation of the non-genericIComparable
interface, significant numbers of heap allocations, and likely others. The next set/sets of changes will resolve these, so I've deliberately left these alone to keep this PR focused on the removal of dead code paths.Issues
None.
Testing
All tests pass. I've also tested against the new tests in #3423, and these also pass.