[Bug] JDBC engine query time in milliseconds lost
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 84/100
Research direction
Start by reading linkis-engine-plugins/jdbc/JDBCEngineConnExecutor.scala and DataType.scala, focusing on the JDBC result processing and TimestampType conversion described in the issue. Reproduce the query with a timestamp containing non-zero milliseconds, then verify that the result preserves the complete millisecond value.
Written by the indexing model from the issue text.
Description
Search before asking
- I searched the
https://github.com/apache/linkis/issuesand found no similar issues.
Linkis Component
linkis-engineconn-plugins/jdbc
Steps to reproduce
- Use JDBC engine to query a table with datetime/timestamp columns containing milliseconds
- Execute SQL like:
SELECT timestamp_column FROM test_table - Observe the query result
Expected behavior
Datetime values should display complete with milliseconds, e.g., 1970-01-21 00:35:35.506
Actual behavior
Milliseconds are lost, displaying only 1970-01-21 00:35:35
Your environment
- Linkis version used: 1.1.2
- Environment name and version:
- cdh-5.14.2
- hdp-3.1.5
- hive-2.1.1
- spark-3.2.1
- scala-2.12.2
- jdk 1.8.0_121
Root Cause Analysis
- In
JDBCEngineConnExecutor.scala, the code usesresultSet.getString()for all types including datetime, which may lose milliseconds depending on JDBC driver implementation - In
DataType.scala, theTimestampTypehandling usesstripSuffix(".0")which removes all milliseconds, including non-zero ones
Solution
- Modify result set processing to directly call
toString()onjava.sql.Timestampobjects - Remove
stripSuffix(".0")from TimestampType conversion to preserve all milliseconds
Anything else
No response
Are you willing to submit a PR?
- Yes I am willing to submit a PR!
- Dominant language
- Java
- Stars
- 3.4k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/linkis
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 4/5 3-5 days Newbie friendliness 28/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Similar issues
-
Update license yearOpen0 - Backlog 1 - Ready documentation good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
cbor
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
FasterXML/jackson-dataformats-binary#844 ·
Maintainers usually reply within 1 day
-
Issue: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
OpenAPITools/openapi-generator#25107 ·
Maintainers usually reply within 1 day
-
improvement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/iceberg#18351 · 1 comment ·
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
repowise-dev/repowise#2945 · 1 comment ·
Maintainers usually reply within 1 day