Arvid Heise created FLINK-40926:
-----------------------------------

             Summary: Projection push down records a ReadingMetadata ability 
without metadata keys
                 Key: FLINK-40926
                 URL: https://issues.apache.org/jira/browse/FLINK-40926
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
    Affects Versions: 2.4.0
            Reporter: Arvid Heise
            Assignee: Arvid Heise


For a source that implements SupportsReadingMetadata, the planner records a 
ReadingMetadata ability even if the query reads no metadata column:

{code:sql}
CREATE TABLE src (a INT, b BIGINT) WITH ('connector' = 'values');
SELECT a FROM src WHERE b > 1;
{code}

{noformat}
TableSourceScan(table=[[default_catalog, default_database, src, filter=[...], 
project=[a], metadata=[]]], fields=[a])
{noformat}

The compiled plan carries the same entry:

{code:json}
{ "type" : "ReadingMetadata", "metadataKeys" : [ ], "producedType" : "ROW<`a` 
INT> NOT NULL" }
{code}

The entry is added by PushProjectIntoTableSourceScanRule (similarly in 
ScanReuser) whenever the source supports metadata, independent of whether any 
metadata key is projected. On restore it results in an applyReadableMetadata 
call with an empty key list.

It is unclear whether this entry is needed at all; most restore test plans in 
flink-table-planner contain it.

Found while reviewing https://github.com/apache/flink/pull/29385.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to