All Products
Search
Document Center

Realtime Compute for Apache Flink:Temporal sorting

Last Updated:Jun 18, 2024

This topic describes how the compatibility between a deployment and the state data is affected after you modify the temporal sorting in an SQL statement for the deployment.

Modifications that do not affect or partially affect the compatibility

  • If you use ORDER BY to sort data based on proctime in ascending order, you can modify a field in a SELECT statement. After this modification, the deployment remains fully compatible with the state data.

    -- Original SQL statement: 
    select a, b, c from MyTable order by proctime asc;
    
    -- Add the input field d to the SELECT statement. After this modification, the deployment remains fully compatible with the state data. 
    select a, b, c, d from MyTable order by proctime asc;
  • If you use ORDER BY to sort data based on keys in ascending order, you can modify a field in a SELECT statement. After this modification, the deployment remains fully compatible with the state data.

    // Original SQL statement:
    select a, b, ts from MyTable order by ts asc;
    // Remove the input field ts from the SELECT statement. After this modification, the deployment remains fully compatible with the state data.
    select a, b from MyTable order by ts asc;

Modifications that cause full incompatibility

  • If you use ORDER BY to sort data based on rowtime, you cannot modify a field in a SELECT statement. After this modification, the job becomes incompatible with the state data.

    -- Original SQL statement: 
    select a, b, c from MyTable order by ts asc;
    
    -- Add the input field d to the SELECT statement. After this modification, the job becomes incompatible with the state data. 
    select a, b, c, d from MyTable order by ts asc;
  • If you modify an attribute related to ORDER BY, such as the sorting fields and direction, the deployment becomes incompatible with the state data.

    -- Original SQL statement: 
    select a, b, c from MyTable order by ts asc;
    
    -- Add the field a to ORDER BY. After this modification, the deployment becomes incompatible with the state data. 
    select a, b, c from MyTable order by ts asc, a desc;