馬哈魚直接數據流元素介紹

直接數據流介紹

本文將介紹一些生成直接數據流的SQL元素,這些元素是生產數據流的主要原型。

1、Select

示例語句:

SELECT a.empName "eName" FROM scott.emp a Where sal > 1000

目標列「eName」的數據來自scott.emp.empName列,所以我們有這樣一個直接的數據流:

scott.emp.empName -> direct -> RS-1."eName"

選擇列表生成的結果集RS-1是一個關係,包括列和行。

dataflow in XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dlineage>
  <table id="2" schema="scott" name="scott.emp" alias="a" type="table" coordinate="[2,6,0],[2,17,0]">
      <column id="3" name="empName" coordinate="[1,8,0],[1,17,0]"/>
  </table>
  <resultset id="5" name="RS-1" type="select_list" coordinate="[1,8,0],[1,25,0]">
      <column id="6" name=""eName"" coordinate="[1,8,0],[1,25,0]"/>
  </resultset>
  <relation id="1" type="fdd" effectType="select">
      <target id="6" column=""eName"" parent_id="5" parent_name="RS-1" coordinate="[1,8,0],[1,25,0]"/>
      <source id="3" column="empName" parent_id="2" parent_name="scott.emp" coordinate="[1,8,0],[1,17,0]"/>
  </relation>
</dlineage>

上述關係表示從id=3的源列到id=6的目標列的數據流.

數據流圖示:

2. Function

在數據流分析過程中,function起著關鍵作用,它接受列作為參數,並生成可能是標量值或集合值的結果。

select round(salary) as sal from scott.emp

在上述SQL中,從列salary到round函數生成一個直接數據流:

scott.emp.salary -> direct -> round(salary) -> direct -> sal

數據流圖示:

dataflow in xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<dlineage>
  <table id="2" schema="scott" name="scott.emp" type="table" coordinate="[1,34,0],[1,43,0]">
      <column id="3" name="salary" coordinate="[1,14,0],[1,20,0]"/>
  </table>
  <resultset id="5" name="RS-1" type="select_list" coordinate="[1,8,0],[1,28,0]">
      <column id="6" name="sal" coordinate="[1,8,0],[1,28,0]"/>
  </resultset>
  <resultset id="8" name="FUNCTION-1" type="function" coordinate="[1,8,0],[1,21,0]">
      <column id="9" name="round" coordinate="[1,8,0],[1,13,0]"/>
  </resultset>
  <relation id="1" type="fdd" effectType="select">
      <target id="6" column="sal" parent_id="5" parent_name="RS-1" coordinate="[1,8,0],[1,28,0]"/>
      <source id="9" column="round" parent_id="8" parent_name="FUNCTION-1" coordinate="[1,8,0],[1,13,0]"/>
  </relation>
  <relation id="2" type="fdd" effectType="function">
      <target id="9" column="round" parent_id="8" parent_name="FUNCTION-1" coordinate="[1,8,0],[1,13,0]"/>
      <source id="3" column="salary" parent_id="2" parent_name="scott.emp" coordinate="[1,14,0],[1,20,0]"/>
  </relation>
</dlineage>

數據流圖示:

如果您關閉「show function」,設置「/if」選項,數據流結果如下:

3、參考

馬哈魚數據血緣分析器: //sqlflow.gudusoft.com

馬哈魚數據血緣分析器中文網站: //www.sqlflow.cn