You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Dawid Wysakowicz (Jira)" <ji...@apache.org> on 2025/01/10 14:18:00 UTC

[jira] [Created] (FLINK-37098) Can not select time attribute from a view

Dawid Wysakowicz created FLINK-37098:
----------------------------------------

             Summary: Can not select time attribute from a view
                 Key: FLINK-37098
                 URL: https://issues.apache.org/jira/browse/FLINK-37098
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Planner
    Affects Versions: 1.20.0
            Reporter: Dawid Wysakowicz
            Assignee: Dawid Wysakowicz
             Fix For: 2.0.0, 1.20.2


Unfortunately the solution in [FLINK-36883] is not fully functional, because of a check in {{SqlToRelConverter}}. If the time attribute should be returned from a query using such a view it will fail with:

{code}
Conversion to relational algebra failed to preserve datatypes:
validated type:
RecordType(VARCHAR(2147483647) CHARACTER SET "UTF-16LE" NOT NULL order_id, INTEGER customer_id, BIGINT product_id, TIMESTAMP_WITH_LOCAL_TIME_ZONE(3) NOT NULL $rowtime) NOT NULL
converted type:
RecordType(VARCHAR(2147483647) CHARACTER SET "UTF-16LE" NOT NULL order_id, INTEGER customer_id, BIGINT product_id, TIMESTAMP_LTZ(3) *ROWTIME* NOT NULL $rowtime) NOT NULL
rel:
LogicalProject(order_id=[$0], customer_id=[$1], product_id=[$2], $rowtime=[$3])
  LogicalProject(order_id=[$0], customer_id=[$1], product_id=[$6], $rowtime=[$5])
    LogicalCorrelate(correlation=[$cor0], joinType=[inner], requiredColumns=[{2}])
      LogicalWatermarkAssigner(rowtime=[$rowtime], watermark=[SOURCE_WATERMARK()])
        LogicalProject(order_id=[$0], customer_id=[$1], product_ids=[$2], price=[$3], order_details=[$4], $rowtime=[CAST($5):TIMESTAMP_LTZ(3) *ROWTIME* NOT NULL])
          LogicalTableScan(table=[[prod, marketplace, orders, metadata=[$rowtime]]])
      LogicalProject(product_id=[$0])
        Uncollect
          LogicalProject(product_ids=[$cor0.product_ids])
            LogicalValues(tuples=[[{ 0 }]])
{code}



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