You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "zhaohehuhu (via GitHub)" <gi...@apache.org> on 2023/11/23 02:43:17 UTC

[PR] JDBC driver implements Result#getDate with Calendar [kyuubi]

zhaohehuhu opened a new pull request, #5752:
URL: https://github.com/apache/kyuubi/pull/5752

   # :mag: Description
   ## Issue References ๐Ÿ”—
   #5650
   <!-- Append the issue number after #. If there is no issue for you to link create one or -->
   <!-- If there are no issues to link, please provide details here. -->
   
   This pull request fixes #
   
   ## Describe Your Solution ๐Ÿ”ง
   
   Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
   
   
   ## Types of changes :bookmark:
   <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
   - [ ] 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 :coffin:
   
   
   #### Behavior With This Pull Request :tada:
   
   
   #### Related Unit Tests
   
   
   ---
   
   # Checklists
   ## ๐Ÿ“ Author Self Checklist
   <!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
   <!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
   - [ ] My code follows the [style guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html) 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](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.**
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements Result#getDate with Calendar [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#discussion_r1402883030


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiArrowBasedResultSet.java:
##########
@@ -198,6 +199,32 @@ public Date getDate(String columnName) throws SQLException {
     return getDate(findColumn(columnName));
   }
 
+  public Date getDate(int columnIndex, Calendar cal) throws SQLException {

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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 closed pull request #5752: JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet
URL: https://github.com/apache/kyuubi/pull/5752


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements Result#getDate with Calendar [kyuubi]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#issuecomment-1823824316

   ## [Codecov](https://app.codecov.io/gh/apache/kyuubi/pull/5752?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   Attention: `22 lines` in your changes are missing coverage. Please review.
   > Comparison is base [(`84a9686`)](https://app.codecov.io/gh/apache/kyuubi/commit/84a9686103ddbe65e399128f6828142827e0d33c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 61.44% compared to head [(`7623b85`)](https://app.codecov.io/gh/apache/kyuubi/pull/5752?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 61.33%.
   > Report is 1 commits behind head on master.
   
   | [Files](https://app.codecov.io/gh/apache/kyuubi/pull/5752?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...he/kyuubi/jdbc/hive/KyuubiArrowBasedResultSet.java](https://app.codecov.io/gh/apache/kyuubi/pull/5752?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLWhpdmUtamRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3l1dWJpL2pkYmMvaGl2ZS9LeXV1YmlBcnJvd0Jhc2VkUmVzdWx0U2V0LmphdmE=) | 0.00% | [11 Missing :warning: ](https://app.codecov.io/gh/apache/kyuubi/pull/5752?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...g/apache/kyuubi/jdbc/hive/KyuubiBaseResultSet.java](https://app.codecov.io/gh/apache/kyuubi/pull/5752?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-a3l1dWJpLWhpdmUtamRiYy9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUva3l1dWJpL2pkYmMvaGl2ZS9LeXV1YmlCYXNlUmVzdWx0U2V0LmphdmE=) | 0.00% | [11 Missing :warning: ](https://app.codecov.io/gh/apache/kyuubi/pull/5752?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #5752      +/-   ##
   ============================================
   - Coverage     61.44%   61.33%   -0.12%     
     Complexity       23       23              
   ============================================
     Files           607      607              
     Lines         35897    35918      +21     
     Branches       4923     4925       +2     
   ============================================
   - Hits          22058    22031      -27     
   - Misses        11461    11503      +42     
   - Partials       2378     2384       +6     
   ```
   
   
   
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/kyuubi/pull/5752?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#discussion_r1414925803


##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiBaseResultSet.java:
##########
@@ -412,6 +440,85 @@ public Timestamp getTimestamp(String columnName) throws SQLException {
     return getTimestamp(findColumn(columnName));
   }
 
+  @Override
+  public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+    Timestamp value = getTimestamp(columnIndex);
+    if (value == null) {
+      return null;
+    } else {
+      try {
+        return parseTimestamp(value, cal);
+      } catch (IllegalArgumentException e) {
+        throw new KyuubiSQLException(
+            "Cannot convert column " + columnIndex + " to timestamp: " + e, e);
+      }
+    }
+  }
+
+  @Override
+  public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
+    return this.getTimestamp(findColumn(columnLabel), cal);
+  }
+
+  private Timestamp parseTimestamp(Timestamp timestamp, Calendar cal) {
+    if (cal == null) {
+      cal = Calendar.getInstance();
+    }
+    long v = timestamp.getTime();
+    cal.setTimeInMillis(v);
+    timestamp = new Timestamp(cal.getTime().getTime());
+    return timestamp;
+  }
+
+  @Override
+  public Time getTime(int columnIndex) throws SQLException {
+    Object obj = getObject(columnIndex);
+    if (obj == null) {
+      return null;
+    }
+    if (obj instanceof Time) {
+      return (Time) obj;
+    }
+    if (obj instanceof String) {
+      return Time.valueOf((String) obj);
+    }
+    throw new KyuubiSQLException("Illegal conversion");
+  }
+
+  @Override
+  public Time getTime(String columnLabel) throws SQLException {
+    return getTime(findColumn(columnLabel));
+  }
+
+  @Override
+  public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+    Time value = getTime(columnIndex);
+    if (value == null) {
+      return null;
+    } else {
+      try {
+        return parseTime(value, cal);
+      } catch (IllegalArgumentException e) {
+        throw new KyuubiSQLException("Cannot convert column " + columnIndex + " to time: " + e, e);
+      }
+    }

Review Comment:
   ```suggestion
       if (value == null) {
         return null;
       }
       try {
         return parseTime(value, cal);
       } catch (IllegalArgumentException e) {
         throw new KyuubiSQLException("Cannot convert column " + columnIndex + " to time: " + e, e);
       }
   ```



##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiBaseResultSet.java:
##########
@@ -412,6 +440,85 @@ public Timestamp getTimestamp(String columnName) throws SQLException {
     return getTimestamp(findColumn(columnName));
   }
 
+  @Override
+  public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+    Timestamp value = getTimestamp(columnIndex);
+    if (value == null) {
+      return null;
+    } else {
+      try {
+        return parseTimestamp(value, cal);
+      } catch (IllegalArgumentException e) {
+        throw new KyuubiSQLException(
+            "Cannot convert column " + columnIndex + " to timestamp: " + e, e);
+      }
+    }

Review Comment:
   ```suggestion
       if (value == null) {
         return null;
       }
       try {
         return parseTimestamp(value, cal);
       } catch (IllegalArgumentException e) {
         throw new KyuubiSQLException(
             "Cannot convert column " + columnIndex + " to timestamp: " + e, e);
       }
   ```



##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiArrowBasedResultSet.java:
##########
@@ -406,6 +434,85 @@ public Timestamp getTimestamp(String columnName) throws SQLException {
     return getTimestamp(findColumn(columnName));
   }
 
+  @Override
+  public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+    Timestamp value = getTimestamp(columnIndex);
+    if (value == null) {
+      return null;
+    } else {
+      try {
+        return parseTimestamp(value, cal);
+      } catch (IllegalArgumentException e) {
+        throw new KyuubiSQLException(
+            "Cannot convert column " + columnIndex + " to timestamp: " + e, e);
+      }
+    }
+  }
+
+  @Override
+  public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
+    return this.getTimestamp(findColumn(columnLabel), cal);
+  }
+
+  private Timestamp parseTimestamp(Timestamp timestamp, Calendar cal) {
+    if (cal == null) {
+      cal = Calendar.getInstance();
+    }
+    long v = timestamp.getTime();
+    cal.setTimeInMillis(v);
+    timestamp = new Timestamp(cal.getTime().getTime());
+    return timestamp;
+  }
+
+  @Override
+  public Time getTime(int columnIndex) throws SQLException {
+    Object obj = getObject(columnIndex);
+    if (obj == null) {
+      return null;
+    }
+    if (obj instanceof Time) {
+      return (Time) obj;
+    }
+    if (obj instanceof String) {
+      return Time.valueOf((String) obj);
+    }
+    throw new KyuubiSQLException("Illegal conversion");
+  }
+
+  @Override
+  public Time getTime(String columnLabel) throws SQLException {
+    return getTime(findColumn(columnLabel));
+  }
+
+  @Override
+  public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+    Time value = getTime(columnIndex);
+    if (value == null) {
+      return null;
+    } else {
+      try {
+        return parseTime(value, cal);
+      } catch (IllegalArgumentException e) {
+        throw new KyuubiSQLException("Cannot convert column " + columnIndex + " to time: " + e, e);
+      }
+    }

Review Comment:
   ```suggestion
       }
       try {
         return parseTime(value, cal);
       } catch (IllegalArgumentException e) {
         throw new KyuubiSQLException("Cannot convert column " + columnIndex + " to time: " + e, e);
       }
   ```



##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiArrowBasedResultSet.java:
##########
@@ -406,6 +434,85 @@ public Timestamp getTimestamp(String columnName) throws SQLException {
     return getTimestamp(findColumn(columnName));
   }
 
+  @Override
+  public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
+    Timestamp value = getTimestamp(columnIndex);
+    if (value == null) {
+      return null;
+    } else {
+      try {
+        return parseTimestamp(value, cal);
+      } catch (IllegalArgumentException e) {
+        throw new KyuubiSQLException(
+            "Cannot convert column " + columnIndex + " to timestamp: " + e, e);
+      }
+    }

Review Comment:
   ```suggestion
       }
       try {
         return parseTimestamp(value, cal);
       } catch (IllegalArgumentException e) {
         throw new KyuubiSQLException(
             "Cannot convert column " + columnIndex + " to timestamp: " + e, e);
       }
   ```



##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiArrowBasedResultSet.java:
##########
@@ -198,6 +199,33 @@ public Date getDate(String columnName) throws SQLException {
     return getDate(findColumn(columnName));
   }
 
+  @Override
+  public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+    Date value = getDate(columnIndex);
+    if (value == null) {
+      return null;
+    } else {
+      try {
+        return parseDate(value, cal);
+      } catch (IllegalArgumentException e) {
+        throw new KyuubiSQLException("Cannot convert column " + columnIndex + " to date: " + e, e);
+      }
+    }

Review Comment:
   ```suggestion
       }
       try {
         return parseDate(value, cal);
       } catch (IllegalArgumentException e) {
         throw new KyuubiSQLException("Cannot convert column " + columnIndex + " to date: " + e, e);
       }
   ```



##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiBaseResultSet.java:
##########
@@ -182,6 +183,33 @@ public Date getDate(String columnName) throws SQLException {
     return getDate(findColumn(columnName));
   }
 
+  @Override
+  public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+    Date value = getDate(columnIndex);
+    if (value == null) {
+      return null;
+    } else {
+      try {
+        return parseDate(value, cal);
+      } catch (IllegalArgumentException e) {
+        throw new KyuubiSQLException("Cannot convert column " + columnIndex + " to date: " + e, e);
+      }
+    }

Review Comment:
   ```suggestion
       if (value == null) {
         return null;
       }
       try {
         return parseDate(value, cal);
       } catch (IllegalArgumentException e) {
         throw new KyuubiSQLException("Cannot convert column " + columnIndex + " to date: " + e, e);
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "zhaohehuhu (via GitHub)" <gi...@apache.org>.
zhaohehuhu commented on PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#issuecomment-1825047674

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "zhaohehuhu (via GitHub)" <gi...@apache.org>.
zhaohehuhu commented on PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#issuecomment-1825108082

   > SparkDataTypeTests
   
   added. plz review. Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "zhaohehuhu (via GitHub)" <gi...@apache.org>.
zhaohehuhu commented on code in PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#discussion_r1405912316


##########
kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkDataTypeTests.scala:
##########
@@ -213,6 +231,26 @@ trait SparkDataTypeTests extends HiveJDBCTestHelper with SparkVersionUtil {
     }
   }
 
+  test("execute statement - select timestamp - second with calendar") {
+    withJdbcStatement() { statement =>
+      val resultSet = statement.executeQuery(
+        "SELECT TIMESTAMP '2018-11-17 13:33:33' AS col")
+      assert(resultSet.next())
+      assert(resultSet.getTimestamp(
+        "col",
+        Calendar.getInstance(TimeZone.getTimeZone("UTC"))) === Timestamp.valueOf(

Review Comment:
   That would be a problem. Refactored.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "cfmcgrady (via GitHub)" <gi...@apache.org>.
cfmcgrady commented on PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#issuecomment-1825114885

   cc  @cxzl25 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#issuecomment-1840122557

   Thanks, merged to master/1.8


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "zhaohehuhu (via GitHub)" <gi...@apache.org>.
zhaohehuhu commented on code in PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#discussion_r1405912316


##########
kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkDataTypeTests.scala:
##########
@@ -213,6 +231,26 @@ trait SparkDataTypeTests extends HiveJDBCTestHelper with SparkVersionUtil {
     }
   }
 
+  test("execute statement - select timestamp - second with calendar") {
+    withJdbcStatement() { statement =>
+      val resultSet = statement.executeQuery(
+        "SELECT TIMESTAMP '2018-11-17 13:33:33' AS col")
+      assert(resultSet.next())
+      assert(resultSet.getTimestamp(
+        "col",
+        Calendar.getInstance(TimeZone.getTimeZone("UTC"))) === Timestamp.valueOf(

Review Comment:
   That would be a problem. Refactored.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements Result#getDate with Calendar [kyuubi]

Posted by "zhaohehuhu (via GitHub)" <gi...@apache.org>.
zhaohehuhu commented on PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#issuecomment-1823760668

   @pan3793  plz review this feature. Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "zhaohehuhu (via GitHub)" <gi...@apache.org>.
zhaohehuhu commented on code in PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#discussion_r1406098806


##########
kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkDataTypeTests.scala:
##########
@@ -213,6 +231,26 @@ trait SparkDataTypeTests extends HiveJDBCTestHelper with SparkVersionUtil {
     }
   }
 
+  test("execute statement - select timestamp - second with calendar") {
+    withJdbcStatement() { statement =>
+      val resultSet = statement.executeQuery(
+        "SELECT TIMESTAMP '2018-11-17 13:33:33' AS col")
+      assert(resultSet.next())
+      assert(resultSet.getTimestamp(
+        "col",
+        Calendar.getInstance(TimeZone.getTimeZone("UTC"))) === Timestamp.valueOf(

Review Comment:
   Let me check it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "cfmcgrady (via GitHub)" <gi...@apache.org>.
cfmcgrady commented on PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#issuecomment-1824601710

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] JDBC driver implements getDate, getTimestamp and getTime with Calendar in ResultSet [kyuubi]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #5752:
URL: https://github.com/apache/kyuubi/pull/5752#discussion_r1405565187


##########
kyuubi-common/src/test/scala/org/apache/kyuubi/operation/SparkDataTypeTests.scala:
##########
@@ -213,6 +231,26 @@ trait SparkDataTypeTests extends HiveJDBCTestHelper with SparkVersionUtil {
     }
   }
 
+  test("execute statement - select timestamp - second with calendar") {
+    withJdbcStatement() { statement =>
+      val resultSet = statement.executeQuery(
+        "SELECT TIMESTAMP '2018-11-17 13:33:33' AS col")
+      assert(resultSet.next())
+      assert(resultSet.getTimestamp(
+        "col",
+        Calendar.getInstance(TimeZone.getTimeZone("UTC"))) === Timestamp.valueOf(

Review Comment:
   what if the TimeZone is not UTC?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org