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

JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet #5752

Closed
wants to merge 13 commits into from

Conversation

zhaohehuhu
Copy link
Contributor

@zhaohehuhu zhaohehuhu commented Nov 23, 2023

🔍 Description

Issue References 🔗

This pull request fixes #5650

Describe Your Solution 🔧

implemented getDate, getTimestamp and getTime with Calendar in Kyuubi JDBC driver side

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


Checklists

📝 Author Self Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • This patch was not authored or co-authored using Generative Tooling

📝 Committer Pre-Merge Checklist

  • Pull request title is okay.
  • No license issues.
  • Milestone correctly set?
  • Test coverage is ok
  • Assignees are selected.
  • Minimum number of approvals
  • No changes are requested

Be nice. Be informative.

@zhaohehuhu
Copy link
Contributor Author

@pan3793 plz review this feature. Thanks!

@@ -198,6 +199,32 @@ public Date getDate(String columnName) throws SQLException {
return getDate(findColumn(columnName));
}

public Date getDate(int columnIndex, Calendar cal) throws SQLException {
Copy link
Member

Choose a reason for hiding this comment

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

please add @Overwrite, and can we remove it from the parent abstract class?

@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2023

Codecov Report

Attention: 80 lines in your changes are missing coverage. Please review.

Comparison is base (84a9686) 61.44% compared to head (36710d0) 61.22%.
Report is 39 commits behind head on master.

❗ Current head 36710d0 differs from pull request most recent head ddff6a7. Consider uploading reports for the commit ddff6a7 to get more accurate results

Files Patch % Lines
...he/kyuubi/jdbc/hive/KyuubiArrowBasedResultSet.java 0.00% 46 Missing ⚠️
...g/apache/kyuubi/jdbc/hive/KyuubiBaseResultSet.java 26.08% 30 Missing and 4 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5752      +/-   ##
============================================
- Coverage     61.44%   61.22%   -0.22%     
  Complexity       23       23              
============================================
  Files           607      607              
  Lines         35897    36030     +133     
  Branches       4923     4948      +25     
============================================
+ Hits          22058    22061       +3     
- Misses        11461    11571     +110     
- Partials       2378     2398      +20     

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

@zhaohehuhu zhaohehuhu changed the title JDBC driver implements Result#getDate with Calendar JDBC driver implements Result#getDate#getTimestamp#getTime with Calendar Nov 23, 2023
@zhaohehuhu zhaohehuhu changed the title JDBC driver implements Result#getDate#getTimestamp#getTime with Calendar JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet Nov 23, 2023
@cfmcgrady
Copy link
Contributor

would you mind adding UTs within org.apache.kyuubi.operation.SparkDataTypeTests?

@zhaohehuhu
Copy link
Contributor Author

would you mind adding UTs within org.apache.kyuubi.operation.SparkDataTypeTests?
Of course not. Let me take a look. Thanks!

@zhaohehuhu
Copy link
Contributor Author

SparkDataTypeTests

added. plz review. Thanks.

@cfmcgrady
Copy link
Contributor

cc @cxzl25

assert(resultSet.next())
assert(resultSet.getTimestamp(
"col",
Calendar.getInstance(TimeZone.getTimeZone("UTC"))) === Timestamp.valueOf(
Copy link
Member

Choose a reason for hiding this comment

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

what if the TimeZone is not UTC?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me check it.

@pan3793 pan3793 added this to the v1.8.1 milestone Dec 5, 2023
@pan3793 pan3793 closed this in fcb41f4 Dec 5, 2023
pan3793 added a commit that referenced this pull request Dec 5, 2023
…me with Calendar in ResultSet

# 🔍 Description
## Issue References 🔗

This pull request fixes #5650

## Describe Your Solution 🔧

 implemented getDate, getTimestamp and getTime with Calendar in Kyuubi JDBC driver side

## Types of changes 🔖

- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] 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

---

# Checklists
## 📝 Author Self Checklist

- [x] My code follows the [style guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html) of this project
- [x] I have performed a self-review
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html)

## 📝 Committer Pre-Merge Checklist

- [ ] Pull request title is okay.
- [ ] No license issues.
- [ ] Milestone correctly set?
- [ ] Test coverage is ok
- [ ] Assignees are selected.
- [ ] Minimum number of approvals
- [ ] No changes are requested

**Be nice. Be informative.**

Closes #5752 from zhaohehuhu/dev-1122.

Closes #5752

ddff6a7 [Cheng Pan] Update kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiArrowBasedResultSet.java
595226d [Cheng Pan] Update kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiArrowBasedResultSet.java
8b386f1 [Cheng Pan] Update kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiArrowBasedResultSet.java
190c6b0 [Cheng Pan] Update kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiBaseResultSet.java
dbc1e1e [Cheng Pan] Update kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiBaseResultSet.java
e1a36d3 [Cheng Pan] Update kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiBaseResultSet.java
36710d0 [hezhao2] refactor
cd2e36f [hezhao2] add UTs in SparkDataTypeTests
fe60822 [hezhao2] add UTs in SparkDataTypeTests
77313c2 [hezhao2] reformat code style
33e4305 [hezhao2] JDBC driver implements Result#getTimestamp and Result#getTime with Calendar
7623b85 [hezhao2] add Overwrite annotation and remove this method from the parent abstract class
757f037 [hezhao2] JDBC driver implements Result#getDate with Calendar

Lead-authored-by: hezhao2 <hezhao2@cisco.com>
Co-authored-by: Cheng Pan <pan3793@gmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
(cherry picked from commit fcb41f4)
Signed-off-by: Cheng Pan <chengpan@apache.org>
@pan3793
Copy link
Member

pan3793 commented Dec 5, 2023

Thanks, merged to master/1.8

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.

[TASK][EASY] JDBC driver implements Result#getDate with Calendar parameters
4 participants