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

[BUG] JDBC doesn't return second fraction part for timestamp #16

Open
Yury-Fridlyand opened this issue Dec 9, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Yury-Fridlyand
Copy link
Collaborator

Yury-Fridlyand commented Dec 9, 2022

What is the bug?

Reason: manual parsing of timestamp values
https://github.com/opensearch-project/sql/blob/c923e80cd654ee8136c74180bf0bd6231044ff71/sql-jdbc/src/main/java/org/opensearch/jdbc/types/TimestampType.java#L63-L96

How can one reproduce the bug?

select timestamp("1970-01-01 12:00:00.501");

JDBC output:

image

SQL plugin output:

fetched rows / total rows = 73/73
+-------------------------+--------------------------------+
| val                     | key                            |
|-------------------------+--------------------------------|
| null                    | null                           |
| 1899-01-01 20:00:00     | 001: 1899-01-01 12:00:00       |
| 1899-12-31 20:00:00     | 002: 1899-12-31 12:00:00       |
| 1940-02-29 20:00:00     | 003: 1940-02-29 12:00:00       |
| 1970-01-01 08:00:00     | 004: 1970-01-01 00:00:00-epoch |
| 1970-01-01 08:00:01     | 005: 1970-01-01 00:00:01       |
| 1970-01-01 09:00:00     | 006: 1970-01-01 01:00:00       |
| 1970-01-01 09:59:00     | 007: 1970-01-01 01:59:00       |
| 1970-01-01 09:59:59     | 008: 1970-01-01 01:59:59       |
| 1970-01-01 10:00:00     | 009: 1970-01-01 02:00:00       |
| 1970-01-01 10:00:01     | 010: 1970-01-01 02:00:01       |
| 1970-01-01 10:30:00.1   | 011: 1970-01-01 02:30:00.1     |
| 1970-01-01 11:00:00.2   | 012: 1970-01-01 03:00:00.2     |
| 1970-01-01 12:00:00.3   | 013: 1970-01-01 04:00:00.3     |
| 1970-01-01 13:00:00.4   | 014: 1970-01-01 05:00:00.4     |
| 1970-01-01 14:00:00.5   | 015: 1970-01-01 06:00:00.5     |
| 1970-01-01 15:00:00.6   | 016: 1970-01-01 07:00:00.6     |
| 1970-01-01 16:00:00.7   | 017: 1970-01-01 08:00:00.7     |
| 1970-01-01 17:00:00.8   | 018: 1970-01-01 09:00:00.8     |
| 1970-01-01 18:00:00.9   | 019: 1970-01-01 10:00:00.9     |
| 1970-01-01 19:59:00.499 | 020: 1970-01-01 11:59:00.499   |
| 1970-01-01 19:59:59.5   | 021: 1970-01-01 11:59:59.500   |
| 1970-01-01 20:00:00.501 | 022: 1970-01-01 12:00:00.501   |

What is the expected behavior?

Use API for parsing, e.g. Timestamp.valueOf method:

java.sql.Timestamp.valueOf("1970-01-01 12:00:00.501") = 1970-01-01 12:00:00.501

What is your host/environment?

2.x @ e2bf2544

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant