Skip to content
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

Skip repeated checks on convert function in TColumnGenerator #6786

Closed

Conversation

bowenliang123
Copy link
Contributor

@bowenliang123 bowenliang123 commented Oct 29, 2024

🔍 Description

Issue References 🔗

This pull request fixes #

Describe Your Solution 🔧

  • TColumnGenerator is used for generating column-based data. This PR skips repeated checks on checking nullability of the convert function in generating single column.

Types of changes 🔖

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Test Plan 🧪

Behavior Without This Pull Request ⚰️

Behavior With This Pull Request 🎉

Related Unit Tests


Checklist 📝

Be nice. Be informative.

@bowenliang123 bowenliang123 marked this pull request as ready for review October 29, 2024 07:14
@bowenliang123 bowenliang123 changed the title Skip repeated checks on convert function Skip repeated checks on convert function in TColumnGenerator Oct 29, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (d3520dd) to head (f76f686).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...apache/kyuubi/engine/result/TColumnGenerator.scala 0.00% 7 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master   #6786   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files         687     687           
  Lines       42439   42439           
  Branches     5793    5793           
======================================
  Misses      42439   42439           

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

val value = if (isConvertFuncDefined) {
convertFunc(row, ordinal)
} else {
getColumnAs[T](row, ordinal)
Copy link
Member

Choose a reason for hiding this comment

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

let's use a simple way

if (convertFunc == null) {
  ...
} else {
  ...
}

Copy link
Contributor Author

@bowenliang123 bowenliang123 Oct 31, 2024

Choose a reason for hiding this comment

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

I would still prefer to use an extracted boolean value for this. I assume that accessing a boolean costs less step and byte code steps for comparing convertFunc to null, especially since it's repeatedly used and checked once for each row.

@bowenliang123 bowenliang123 self-assigned this Nov 12, 2024
@bowenliang123 bowenliang123 added this to the v1.10.1 milestone Nov 12, 2024
bowenliang123 added a commit that referenced this pull request Nov 12, 2024
…erator

# 🔍 Description
## Issue References 🔗

This pull request fixes #

## Describe Your Solution 🔧

- `TColumnGenerator` is used for generating column-based data. This PR skips repeated checks on checking nullability of the convert function in generating single column.

## Types of changes 🔖

- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Test Plan 🧪

#### Behavior Without This Pull Request ⚰️

#### Behavior With This Pull Request 🎉

#### Related Unit Tests

---

# Checklist 📝

- [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

**Be nice. Be informative.**

Closes #6786 from bowenliang123/skip-converfunc-check.

Closes #6786

f76f686 [Bowen Liang] nit
930dfef [Bowen Liang] fix
9712274 [Bowen Liang] comment
9db16ef [Bowen Liang] nit
977d215 [Bowen Liang] skip repeated checking on convert function

Authored-by: Bowen Liang <[email protected]>
Signed-off-by: Bowen Liang <[email protected]>
(cherry picked from commit c8b8922)
Signed-off-by: Bowen Liang <[email protected]>
@bowenliang123 bowenliang123 deleted the skip-converfunc-check branch November 12, 2024 06:55
@bowenliang123
Copy link
Contributor Author

Thanks, merged to master (1.11.0) and branch-1.10 (1.10.1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants