Skip to content

Conversation

@dyp12
Copy link
Contributor

@dyp12 dyp12 commented Jun 3, 2025

Purpose of this pull request

close #8352

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@Hisoka-X
Copy link
Member

Hisoka-X commented Jun 4, 2025

cc @liugddx

@Hisoka-X Hisoka-X changed the title ArrowToSeatunnelRowReader convertSeatunnelRowValue add handle Second TIMESTAMP type [Fix][Connector-Doris] ArrowToSeatunnelRowReader convertSeatunnelRowValue add handle Second TIMESTAMP type Jun 4, 2025
@Hisoka-X Hisoka-X changed the title [Fix][Connector-Doris] ArrowToSeatunnelRowReader convertSeatunnelRowValue add handle Second TIMESTAMP type [Fix][Connector-V2] ArrowToSeatunnelRowReader convertSeatunnelRowValue add handle Second TIMESTAMP type Jun 4, 2025
.atZone(ZoneId.systemDefault())
.toLocalDateTime();
// this TIMESTAMP value may be SECOND not milliseconds
if (((Long) fieldValue).toString().length() == 10) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should get the precision from the type rather than judging directly by the size of the value, which may be wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should get the precision from the type rather than judging directly by the size of the value, which may be wrong.

sorry, i fix it, using Types.MinorType to know

@Hisoka-X
Copy link
Member

Hisoka-X commented Jun 4, 2025

Please add test case

@nielifeng nielifeng requested a review from Copilot June 5, 2025 01:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements a fix for the ArrowToSeatunnelRowReader, adding support for handling TIMESTAMP values with SECOND precision (with and without timezone). The main changes include updating data type mappings in test helpers, adjusting test cases to verify new timestamp behaviors, and adding a new TimeStampSecConverter.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
SeaTunnelDataTypeHolder.java Added cases for "timestampSec" and "timestampSecTz" mapping to LocalDateTime.
ArrowToSeatunnelRowReaderTest.java Extended tests to cover SECOND precision timestamp vectors.
META-INF/services/.../Converter Registered the new TimeStampSecConverter.
ArrowToSeatunnelRowReader.java Updated row value conversion logic to handle second timestamps.
TimeStampSecConverter.java Introduced a converter to transform second precision Arrow timestamp values.
Comments suppressed due to low confidence (2)

seatunnel-connectors-v2/connector-common/src/main/java/org/apache/seatunnel/connectors/seatunnel/common/source/arrow/reader/ArrowToSeatunnelRowReader.java:208

  • Consider adding more detailed comments to explain why TIMESTAMP values are treated as seconds rather than milliseconds in this block, to improve code clarity and maintainability.
if (Types.MinorType.TIMESTAMPSEC == minorType || Types.MinorType.TIMESTAMPSECTZ == minorType) {

seatunnel-connectors-v2/connector-common/src/main/java/org/apache/seatunnel/connectors/seatunnel/common/source/arrow/converter/TimeStampSecConverter.java:33

  • Add a comment clarifying that this converter assumes the input timestamp is in UTC before converting it to the system default timezone.
LocalDateTime localDateTime = fieldVector.getObject(rowIndex);

@Hisoka-X Hisoka-X merged commit 0555f85 into apache:dev Jun 5, 2025
5 checks passed
@dyp12
Copy link
Contributor Author

dyp12 commented Jun 5, 2025

Please add test case

thank you for your help

dybyte pushed a commit to dybyte/seatunnel that referenced this pull request Jul 23, 2025
…e add handle Second TIMESTAMP type (apache#9393)

Signed-off-by: dyp12 <[email protected]>
Co-authored-by: dyp12 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [Doris] 从Doris表中同步数据时datetime类型读取错误

3 participants