Sergey Nuyanzin created FLINK-36415:
---------------------------------------

             Summary: ProjectWatermarkAssignerTransposeRule can generate extra 
casts which do not make sense
                 Key: FLINK-36415
                 URL: https://issues.apache.org/jira/browse/FLINK-36415
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
            Reporter: Sergey Nuyanzin
            Assignee: Sergey Nuyanzin


For instance
if there is a table containing deeply nested array and rows  like this
{code:sql}
`chart` row<`result` array<row<`meta` row<`symbol` string not null> not null> 
not null> not null>
{code}

the optimized plan will look like 
{noformat}
LogicalProject(EXPR$0=[CAST(CAST(CAST(CAST(ITEM($0.result, 
1).meta):RecordType:peek_no_expand(VARCHAR(2147483647) CHARACTER SET "UTF-16LE" 
NOT NULL symbol)):RecordType:peek_no_expand(VARCHAR(2147483647) CHARACTER SET 
"UTF-16LE" NOT NULL symbol).symbol):VARCHAR(2147483647) CHARACTER SET 
"UTF-16LE"):VARCHAR(2147483647) CHARACTER SET "UTF-16LE"])
+- LogicalTableScan(table=[[default_catalog, default_database, ItemTable, 
project=[chart], metadata=[]]])
{noformat}

while it should contain only 2 casts (one to cast to Varchar and another for 
RecordType:peek_no_expand), to others are useless



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

Reply via email to