-
Notifications
You must be signed in to change notification settings - Fork 93
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
IGNITE-21568 Java thin: Pass client time zone to server #3737
Changes from 16 commits
9905c7d
221a606
27f4415
5f74ae4
95a678d
0c50991
56bc5c3
44da144
3e07096
0a1f003
c0da7b0
6ae2928
1b926ab
1760428
9241f6f
f399e67
998c1ed
fe3e5f7
50a9bdf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,10 @@ | |
package org.apache.ignite.internal.client.sql; | ||
|
||
import java.time.ZoneId; | ||
import java.time.ZoneOffset; | ||
import java.util.Objects; | ||
import java.util.concurrent.TimeUnit; | ||
import org.apache.ignite.sql.Statement; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* Client SQL statement. | ||
|
@@ -31,14 +31,20 @@ public class ClientStatement implements Statement { | |
private final String query; | ||
|
||
/** Default schema. */ | ||
@Nullable | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. according to our coding guidelines, type-use annotations appear immediately before the annotated type. Please fix it in other places too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. I've used |
||
private final String defaultSchema; | ||
|
||
/** Query timeout. */ | ||
@Nullable | ||
private final Long queryTimeoutMs; | ||
|
||
/** Page size. */ | ||
@Nullable | ||
private final Integer pageSize; | ||
|
||
/** Time-zone ID. */ | ||
private final ZoneId timeZoneId; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
|
@@ -48,17 +54,19 @@ public class ClientStatement implements Statement { | |
* @param pageSize Page size. | ||
*/ | ||
@SuppressWarnings("AssignmentOrReturnOfFieldWithMutableType") | ||
public ClientStatement( | ||
ClientStatement( | ||
String query, | ||
String defaultSchema, | ||
Long queryTimeoutMs, | ||
Integer pageSize) { | ||
@Nullable String defaultSchema, | ||
@Nullable Long queryTimeoutMs, | ||
@Nullable Integer pageSize, | ||
@Nullable ZoneId timeZoneId) { | ||
Objects.requireNonNull(query); | ||
|
||
this.query = query; | ||
this.defaultSchema = defaultSchema; | ||
this.queryTimeoutMs = queryTimeoutMs; | ||
this.pageSize = pageSize; | ||
this.timeZoneId = timeZoneId != null ? timeZoneId : ZoneId.systemDefault(); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
|
@@ -80,7 +88,8 @@ public long queryTimeout(TimeUnit timeUnit) { | |
* | ||
* @return Query timeout. | ||
*/ | ||
public Long queryTimeoutNullable() { | ||
@Nullable | ||
Long queryTimeoutNullable() { | ||
return queryTimeoutMs; | ||
} | ||
|
||
|
@@ -93,8 +102,7 @@ public String defaultSchema() { | |
/** {@inheritDoc} */ | ||
@Override | ||
public ZoneId timeZoneId() { | ||
// TODO: https://issues.apache.org/jira/browse/IGNITE-21568 | ||
return ZoneOffset.UTC; | ||
return timeZoneId; | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
|
@@ -108,7 +116,8 @@ public int pageSize() { | |
* | ||
* @return Page size. | ||
*/ | ||
public Integer pageSizeNullable() { | ||
@Nullable | ||
Integer pageSizeNullable() { | ||
return pageSize; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are we going to specify or reference the timezone format in other clients? Just give a reference to
java.time.ZoneId
javadocs?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the javadoc explains it in detail: ZoneId#of
It supports standard IANA region-based zone IDs, so I expect every client to have something suitable in the standard library or a popular package.