Skip to content

Perf: Check for null when getting DTV values (JDBC spec compliance - getBinaryStream /getAsciiStream will return null when the value is null) - #2600

Merged
Muskan Gupta (muskan124947) merged 4 commits into
mainfrom
dev/machavan/perffix1
Feb 20, 2025

Conversation

@machavan

@machavan Mahendra Chavan (machavan) commented Feb 11, 2025 •

Copy link
Copy Markdown
Contributor

This fix of checking for null value of a DTVImpl before calling DTVImpl::getValue has shown some perf gains in our internal benchmark.

This fix will change behavior of getBinaryStream /getAsciiStream in ResultSet to be compliant with JDBC specs:
a Java input stream that delivers the database column value as a stream of one-byte ASCII characters; if the value is SQL NULL, the value returned is null

@machavan Mahendra Chavan (machavan) changed the title Perf fix 1 - Add a null value check upfront in dtv::getValue Feb 11, 2025
@codecov

codecov Bot commented Feb 11, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.33%. Comparing base (e63814e) to head (01e79e9).
Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2600      +/-   ##
============================================
- Coverage     51.35%   51.33%   -0.03%     
+ Complexity     3981     3970      -11     
============================================
  Files           147      147              
  Lines         33686    33688       +2     
  Branches       5627     5628       +1     
============================================
- Hits          17300    17294       -6     
+ Misses        13956    13953       -3     
- Partials       2430     2441      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add test?

@machavan

Copy link
Copy Markdown
Contributor Author

add test?

Verified that existing tests already cover this code path. This code path is hit for any get call on a ResultSet that returns NULL. e.g. many tests in ResultSetTest cover this.

@muskan124947
Muskan Gupta (muskan124947) deleted the dev/machavan/perffix1 branch February 20, 2025 08:38
@lilgreenbird lilgreenbird (lilgreenbird) changed the title Perf fix 1 - Add a null value check upfront in DTV::getValue Feb 27, 2025
@lilgreenbird lilgreenbird (lilgreenbird) changed the title Check for null when getting DTV values (java compliance - getAsciiStream will return null when the value is null) Feb 27, 2025
@lilgreenbird lilgreenbird (lilgreenbird) changed the title Check for null when getting DTV values (JDBC spec compliance - getAsciiStream will return null when the value is null) Feb 27, 2025
@lilgreenbird

Copy link
Copy Markdown
Contributor

test added in PR #2617

@Ananya2 Ananya Garg (Ananya2) changed the title Check for null when getting DTV values (JDBC spec compliance - getBinaryStream /getAsciiStream will return null when the value is null) Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

7 participants