Skip to content

[Bug] Flink Connector DATETIME decoding regression: 26.3.0 returns 1970 timestamps, 25.0.0 returns correct values #68392

Description

@MxlIzumi

Summary

When reading a DATETIME column from SelectDB 2.1.8-3 using the Doris Flink Connector over Thrift, version 26.3.0 produces an incorrect 1970 timestamp. Switching the test task to Connector 25.0.0 restores the expected value.

This is a report against a SelectDB distribution, not a claim that the same behavior has already been reproduced on stock Apache Doris 2.1.8.

Environment

  • Flink: company distribution based on 1.20
  • Server: SelectDB 2.1.8-3
  • Artifact: org.apache.doris:flink-doris-connector-1.20
  • Affected version tested: 26.3.0
  • Working version tested: 25.0.0
  • Read protocol: Thrift; FE arrow_flight_sql_port is -1, and Flight SQL was not used
  • Date/time comparison below uses UTC+08:00
  • Doris DATETIME mapped to Flink TIMESTAMP(0)

Observed behavior

Value ctime / mtime
Direct query in Doris 2026-07-30 19:44:28
Flink Connector 26.3.0 1970-01-01 08:29:45.411868
Flink Connector 25.0.0 after switching versions 2026-07-30 19:44:28

The incorrect value is present in the raw TaskManager output, not just the platform's result viewer. Casting the Flink timestamp to STRING still gives the incorrect value. Other fields are read successfully.

SQL shape used for testing (anonymized)

The source is an existing Doris OLAP table with BIGINT, VARCHAR and DATETIME columns. Table names, identifiers and connection details below have been replaced with placeholders; this exact standalone example has not been independently rerun on stock Apache Doris.

CREATE TABLE doris_datetime_probe (
    id BIGINT,
    name STRING,
    ctime TIMESTAMP(0),
    mtime TIMESTAMP(0)
) WITH (
    'connector' = 'doris',
    'fenodes' = '<FE_HOST>:<HTTP_PORT>',
    'table.identifier' = 'test.datetime_probe',
    'username' = '<USER>',
    'password' = '<PASSWORD>'
);

CREATE TABLE datetime_probe_print (
    id BIGINT,
    name STRING,
    ctime STRING,
    mtime STRING
) WITH (
    'connector' = 'print'
);

INSERT INTO datetime_probe_print
SELECT id, name, CAST(ctime AS STRING), CAST(mtime AS STRING)
FROM doris_datetime_probe
WHERE id = 1;

Use a source row whose ctime and mtime are 2026-07-30 19:44:28, and compare the output between the two Connector versions. The id/name in the example are anonymized.

Source-code observations / suspected cause

The official published source packages show a relevant change in org.apache.doris.flink.serialization.RowBatch:

  • In 25.0.0, getDateTime() delegates to longToLocalDateTime(long), which infers seconds / milliseconds / microseconds from the numeric magnitude. Its comment states: "Currently, the scale of doris's arrow datetimev2 is hardcoded to 6, and there is also a time zone problem in arrow, so use timestamp to convert first" (approximately lines 554–576).
  • In 26.3.0, getDateTime() uses the Arrow timestamp metadata. For timestamps with timezone metadata it calls longToLocalDateTime(value, timestampType.getUnit(), DEFAULT_ZONE_ID); the MICROSECOND branch divides by 1,000,000 (approximately lines 702–741). For timestamps without timezone metadata it delegates to vector.getObject().

In UTC+08:00, the expected date corresponds to epoch seconds 1785411868. Interpreting that same integer as microseconds produces exactly 1970-01-01 08:29:45.411868.

This suggests a mismatch between the actual numeric unit and the declared Arrow unit, which the older magnitude-based conversion may have tolerated. We have NOT yet captured the raw Arrow value/unit/timezone or the loaded class location, so this is a hypothesis rather than a confirmed wire-level diagnosis. We also have not identified the first affected Connector release between 25.0.0 and 26.3.0.

Sources:

Questions

  1. Is this a known server/Connector compatibility issue or regression in handling legacy Arrow timestamp encoding?
  2. Which Doris/SelectDB versions and read protocols are affected?
  3. Is there a fix or recommended Connector/server combination? Is there a safe compatibility option rather than relying on timestamp magnitude heuristics?
  4. Could the compatibility documentation mention any applicable restrictions? The broad Doris version range does not make this behavior apparent.

Happy to provide additional sanitized diagnostics. Please advise if this should be tracked in the Connector repository or with the SelectDB distribution instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions