Skip to content

[Bug]: miss projection and watermark in LogDynamicSource::copy method #4455

Done

Description

@Aireed

What happened?

  1. define one amoro mixed_hive table with logstore enabled,
Image
  1. Flink SQL: use create table like to define watermark (only use part columns of table schema)

create table tmp_xzl_ai_beh (
market_id AS COALESCE(JSON_VALUE(btn_title, '$.market_id'), 'unknown'),
tab_name AS COALESCE(JSON_VALUE(btn_title, '$.tab_name'), 'unknown'),
recvtime_ts AS CAST(recvtime AS TIMESTAMP(3)),
WATERMARK FOR recvtime_ts AS recvtime_ts - INTERVAL '5' SECOND
) like amoro_catalog.amoro_v7.ht_pk_logstore_1;

  1. create a view from logstore

CREATE view evt_view AS

SELECT
deviceid,
tab_name,
recvtime_ts,
market_id,
stock_code
FROM tmp_xzl_ai_beh/*+ OPTIONS('streaming' = 'true','arctic.read.mode' = 'log','scan.startup.mode'='latest') */;

4、insert into xxx select * from evt_view, and the exception thrown

2026-10-15 17:46:36
java.lang.ClassCastException: org.apache.flink.table.data.binary.BinaryStringData cannot be cast to org.apache.flink.table.data.TimestampData
at org.apache.flink.table.data.GenericRowData.getTimestamp(GenericRowData.java:179)
at org.apache.flink.table.data.RowData.lambda$createFieldGetter$39385f9c$1(RowData.java:260)
at org.apache.flink.table.data.RowData.lambda$createFieldGetter$25774257$1(RowData.java:296)
at org.apache.flink.table.runtime.typeutils.RowDataSerializer.toBinaryRow(RowDataSerializer.java:207)
at org.apache.flink.table.runtime.typeutils.RowDataSerializer.serialize(RowDataSerializer.java:103)
at org.apache.flink.table.runtime.typeutils.RowDataSerializer.serialize(RowDataSerializer.java:48)
at org.apache.flink.streaming.runtime.streamrecord.StreamElementSerializer.serialize(StreamElementSerializer.java:165)
at org.apache.flink.streaming.runtime.streamrecord.StreamElementSerializer.serialize(StreamElementSerializer.java:43)
at org.apache.flink.runtime.plugable.SerializationDelegate.write(SerializationDelegate.java:54)
at org.apache.flink.runtime.io.network.api.writer.RecordWriter.serializeRecord(RecordWriter.java:141)
at org.apache.flink.runtime.io.network.api.writer.RecordWriter.emit(RecordWriter.java:107)
at org.apache.flink.runtime.io.network.api.writer.ChannelSelectorRecordWriter.emit(ChannelSelectorRecordWriter.java:55)
at org.apache.flink.streaming.runtime.io.RecordWriterOutput.pushToRecordWriter(RecordWriterOutput.java:134)
at org.apache.flink.streaming.runtime.io.RecordWriterOutput.collectAndCheckIfChained(RecordWriterOutput.java:114)
at org.apache.flink.streaming.runtime.io.RecordWriterOutput.collect(RecordWriterOutput.java:95)
at org.apache.flink.streaming.runtime.io.RecordWriterOutput.collect(RecordWriterOutput.java:48)
at org.apache.flink.streaming.api.operators.CountingOutput.collect(CountingOutput.java:59)
at org.apache.flink.streaming.api.operators.CountingOutput.collect(CountingOutput.java:31)
at org.apache.flink.streaming.runtime.tasks.SourceOperatorStreamTask$AsyncDataOutputToOutput.emitRecord(SourceOperatorStreamTask.java:309)
at org.apache.flink.streaming.api.operators.source.SourceOutputWithWatermarks.collect(SourceOutputWithWatermarks.java:110)
at org.apache.amoro.flink.read.source.log.kafka.LogKafkaRecordEmitter.emitRecord(LogKafkaRecordEmitter.java:41)
at org.apache.amoro.flink.read.source.log.kafka.LogKafkaRecordEmitter.emitRecord(LogKafkaRecordEmitter.java:28)
at org.apache.flink.connector.base.source.reader.SourceReaderBase.pollNext(SourceReaderBase.java:160)
at org.apache.flink.streaming.api.operators.SourceOperator.emitNext(SourceOperator.java:419)
at org.apache.flink.streaming.runtime.io.StreamTaskSourceInput.emitNext(StreamTaskSourceInput.java:68)
at org.apache.flink.streaming.runtime.io.StreamOneInputProcessor.processInput(StreamOneInputProcessor.java:65)
at org.apache.flink.streaming.runtime.tasks.StreamTask.processInput(StreamTask.java:562)
at org.apache.flink.streaming.runtime.tasks.mailbox.MailboxProcessor.runMailboxLoop(MailboxProcessor.java:231)
at org.apache.flink.streaming.runtime.tasks.StreamTask.runMailboxLoop(StreamTask.java:858)
at org.apache.flink.streaming.runtime.tasks.StreamTask.invoke(StreamTask.java:807)
at org.apache.flink.runtime.taskmanager.Task.runWithSystemExitMonitoring(Task.java:953)
at org.apache.flink.runtime.taskmanager.Task.restoreAndInvoke(Task.java:932)
at org.apache.flink.runtime.taskmanager.Task.doRun(Task.java:746)
at org.apache.flink.runtime.taskmanager.Task.run(Task.java:562)
at java.lang.Thread.run(Thread.java:748)

Affects Versions

master

What table formats are you seeing the problem on?

Mixed-Hive

What engines are you seeing the problem on?

Flink

How to reproduce

No response

Relevant log output

Anything else

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    type:bug
    on Oct 20, 2026
  2. hutiefang76 commented on Oct 21, 2026

    @hutiefang76
    Contributor

    Hi @Aireed, have you started working on a patch? I can pick up a focused fix for LogDynamicSource.copy() to preserve projection and watermark state, with regression tests for both. If you already have a patch underway, I can help review or test it instead.

    AI-assisted.

  3. sarthakdev143-lite commented on Nov 16, 2026

    @sarthakdev143-lite
    Contributor

    take

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

Metadata

Metadata

Labels

type:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions