Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug] JDBC engine query time in milliseconds lost

Open
#5,307 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java, scala
Domain
database

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

bug
Search before asking
  • I searched the https://github.com/apache/linkis/issues and found no similar issues.
Linkis Component

linkis-engineconn-plugins/jdbc

Steps to reproduce
  1. Use JDBC engine to query a table with datetime/timestamp columns containing milliseconds
  2. Execute SQL like: SELECT timestamp_column FROM test_table
  3. 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
  1. In JDBCEngineConnExecutor.scala, the code uses resultSet.getString() for all types including datetime, which may lose milliseconds depending on JDBC driver implementation
  2. In DataType.scala, the TimestampType handling uses stripSuffix(".0") which removes all milliseconds, including non-zero ones
Solution
  1. Modify result set processing to directly call toString() on java.sql.Timestamp objects
  2. 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/linkis

All issues in apache/linkis

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.