日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

Deduplication

本文為您介紹Deduplication修改的可兼容性和不可兼容性詳情。

可兼容的變更

  • 當基于proctime做order by且按升序排序時(order by proctime asc),可以修改除partition by key之前的字段,該修改屬于完全兼容變更。

    -- 原始SQL。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime ASC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 新增輸入字段:d,該修改屬于完全兼容變更。
    SELECT a, b, c, d FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime ASC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 刪除輸入字段:b,該修改屬于完全兼容變更。
    SELECT a, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime ASC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 修改輸入字段:c -> substring(c, 1, 5),該修改屬于完全兼容變更。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime ASC) AS rk
       FROM (SELECT a, b, SUBSTRING(c,1,5) as c, proctime FROM MyTable))
    WHERE rk = 1;
  • 修改partition key的順序,該修改屬于完全兼容變更。

    -- 原始SQL。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a, b, c ORDER BY proctime ASC) as rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 修改partition key順序,該修改屬于完全兼容
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY c, a, b ORDER BY proctime ASC) as rk
       FROM MyTable)
    WHERE rk = 1;
  • 當基于rowtime進行order by或基于proctime進行order by且按降序排序(order by proctime desc) 時,若schema不變,該修改屬于完全兼容變更。

    -- 原始SQL。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime DESC) AS rk
       FROM MyTable)
    WHERE rk = 1 AND c > 10;
    
    -- 刪除一個字段,但不影響Schema,屬于完全兼容變更。
    SELECT a, b FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime DESC) AS rk
       FROM MyTable)
    WHERE rk = 1 AND c > 10;

不兼容的修改

  • 新增、刪除、修改partition by key或者partition by key涉及字段的計算邏輯發生變化,該修改屬于不兼容變更。

    -- 原始SQL。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime ASC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 新增partition by字段:d,該修改屬于不兼容變更。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a,d ORDER BY proctime ASC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    
    -- 刪除partition by字段:a,該修改屬于不兼容變更。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (ORDER BY proctime ASC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 修改partition by字段:a -> a + 1,該修改屬于不兼容變更。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (ORDER BY proctime ASC) AS rk
       FROM (SELECT a + 1 AS a, b, c, proctime FROM MyTable))
    WHERE rk = 1;
  • 修改order by相關屬性(排序字段和方向),該修改屬于不兼容變更。

    -- 原始SQL。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime ASC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 修改order key:proctime -> ts,當前修改屬于不兼容變更。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY ts ASC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 修改order:asc -> desc,當前修改屬于不兼容變更。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime DESC) AS rk
       FROM MyTable)
    WHERE rk = 1;
  • 當基于rowtime做order by或基于proctime進行order by且按降序排序(order by proctime desc) 時,修改了輸入字段,或者schema發生變化。則修改屬于不兼容變更。

    -- 原始SQL。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime DESC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 新增輸入字段:d,當前修改屬于不兼容變更。
    SELECT a, b, c, d FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime DESC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 刪除輸入字段:c,當前修改屬于不兼容變更。
    SELECT a, b FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime DESC) AS rk
       FROM MyTable)
    WHERE rk = 1;
    
    -- 輸入字段:c -> substring(c, 1, 5),當前修改屬于不兼容變更。
    SELECT a, b, c FROM (
      SELECT *,
       ROW_NUMBER() OVER (PARTITION BY a ORDER BY proctime DESC) AS rk
       FROM (select a, b, substring(c, 1, 5) as c, ts from MyTable))
    WHERE rk = 1;