makssent opened a new pull request, #40172:
URL: https://github.com/apache/shardingsphere/pull/40172
Changes proposed in this pull request:
- `FirebirdTimestampBinaryProtocolValue.write` converts a
`java.sql.Timestamp` value from the backend with `Timestamp.toLocalDateTime()`,
which keeps the nanoseconds. Before, it was converted through `Date.getTime()`,
which keeps only whole milliseconds. Other `java.util.Date` values are
converted as before.
- `FirebirdDateTimeUtils` encodes the time in units of 1/10000 s from
these nanoseconds, so TIMESTAMP values in result rows keep the fourth digit of
the fractions of a second, as from the server: `2024-02-29 23:59:59.9999` is no
longer returned as `2024-02-29 23:59:59.999`, and `2026-10-02 12:34:56.0001` as
`2026-10-02 12:34:56`.
Verification:
The same queries were executed directly against a real database and through
the proxy, and the results were compared.
* Server: Firebird 5.0
* Clients: Jaybird 5.0.13 and 6.0.6
Table `T_TS (ID INTEGER NOT NULL PRIMARY KEY, TS TIMESTAMP)` with rows
inserted with literals: (4201, '2024-02-29 23:59:59.9999'), (4202, '2026-10-02
12:34:56.0001'), (4203, '1999-12-31 23:59:59.5'), (4204, NULL). `TS` is read
with `getObject(2, LocalDateTime.class)`. Jaybird 5 and 6 give the same results.
Before the fix:
| Query | Proxy | Server | Match |
|---|---|---|---|
| `DELETE` of rows 4201 to 4204, 4 `INSERT` | 0; 1 each | 0; 1 each | yes |
| `SELECT ID, TS FROM T_TS WHERE ID BETWEEN 4201 AND 4204 ORDER BY ID` |
4201 `2024-02-29T23:59:59.999`, 4202 `2026-10-02T12:34:56`, 4203
`1999-12-31T23:59:59.500`, 4204 null | 4201 `2024-02-29T23:59:59.999900`, 4202
`2026-10-02T12:34:56.000100`, 4203 `1999-12-31T23:59:59.500`, 4204 null | no |
| `SELECT ID, TS FROM T_TS WHERE TS > '2024-02-29 23:59:59.9998' AND ID
BETWEEN 4201 AND 4204 ORDER BY ID` | 4201 `2024-02-29T23:59:59.999`, 4202
`2026-10-02T12:34:56` | 4201 `2024-02-29T23:59:59.999900`, 4202
`2026-10-02T12:34:56.000100` | no |
| `DELETE` of rows 4201 to 4204 | 4 | 4 | yes |
After the fix:
| Query | Proxy | Server | Match |
|---|---|---|---|
| `DELETE` of rows 4201 to 4204, 4 `INSERT` | 0; 1 each | 0; 1 each | yes |
| `SELECT ID, TS FROM T_TS WHERE ID BETWEEN 4201 AND 4204 ORDER BY ID` |
4201 `2024-02-29T23:59:59.999900`, 4202 `2026-10-02T12:34:56.000100`, 4203
`1999-12-31T23:59:59.500`, 4204 null | 4201 `2024-02-29T23:59:59.999900`, 4202
`2026-10-02T12:34:56.000100`, 4203 `1999-12-31T23:59:59.500`, 4204 null | yes |
| `SELECT ID, TS FROM T_TS WHERE TS > '2024-02-29 23:59:59.9998' AND ID
BETWEEN 4201 AND 4204 ORDER BY ID` | 4201 `2024-02-29T23:59:59.999900`, 4202
`2026-10-02T12:34:56.000100` | 4201 `2024-02-29T23:59:59.999900`, 4202
`2026-10-02T12:34:56.000100` | yes |
| `DELETE` of rows 4201 to 4204 | 4 | 4 | yes |
---
Before committing this PR, I'm sure that I have checked the following
options:
- [x] My code follows the [code of
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/)
of this project.
- [x] I have self-reviewed the commit code.
- [ ] I have (or in comment I request) added corresponding labels for the
pull request.
- [ ] I have passed maven check locally : `./mvnw clean install -B -T1C
-Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [ ] I have made corresponding changes to the documentation.
- [x] I have added corresponding unit tests for my changes.
- [ ] I have updated the Release Notes of the current development version.
For more details, see [Update Release
Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)
- [ ] I have specified the tool and the affected files or area for
substantial AI assistance, as required by the [AI-assisted contribution policy].
[AI-assisted contribution policy]:
https://github.com/apache/shardingsphere/blob/master/AI_POLICY.md
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]