DataFlow in Expression Language: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
DataFlow is an object representing a stream of tabular data. DataFlow contains data with the similar structure as DataFrame, but difference is that in the DataFrame all its contents is stored to the system memory. If there is lot of data, also lot of memory is required when using DataFrames. On the other hand in the DataFlow, contents "flows" from the source to the destination, and data can be manipulated, while having only a small portion of the entire data in memory at the same time. Thus, DataFlows are suitable for ETL where data volumes are high.
DataFlow is an object in the expression language representing a stream of tabular data. Data structure in the DataFlow is similar to the DataFrame, but difference is that in the DataFrame all its contents is stored to the system memory. If there is large volume of data, also lot of memory is required when managing the data in DataFrames. On the other hand, in the DataFlow the content "flows" from the source to the destination, and data can be manipulated while having only a small portion of the entire dataset in memory at the same time. Thus, DataFlows are suitable for ETL where data volumes are high.


DataFlow continues to run until it ''completes''. DataFlow will complete automatically, when all queried items have been returned. DataFlow can also be completed explicitly by calling the ''Complete'' function. When the DataFlow has been completed, no new items can be added to it. When collecting the DataFlow to an in-memory DataFrame, the ''Collect'' call waits until the DataFlow completes, to make sure all items are included to the DataFrame.
DataFlow continues to run until it ''completes''. DataFlow will complete automatically, when all queried items have been returned. DataFlow can also be completed explicitly by calling the ''Complete'' function. When the DataFlow has been completed, no new items can be added to it. When collecting the DataFlow to an in-memory DataFrame, the ''Collect'' call waits until the DataFlow completes, to make sure all items are included to the DataFrame.

Revision as of 21:51, 8 December 2022

DataFlow is an object in the expression language representing a stream of tabular data. Data structure in the DataFlow is similar to the DataFrame, but difference is that in the DataFrame all its contents is stored to the system memory. If there is large volume of data, also lot of memory is required when managing the data in DataFrames. On the other hand, in the DataFlow the content "flows" from the source to the destination, and data can be manipulated while having only a small portion of the entire dataset in memory at the same time. Thus, DataFlows are suitable for ETL where data volumes are high.

DataFlow continues to run until it completes. DataFlow will complete automatically, when all queried items have been returned. DataFlow can also be completed explicitly by calling the Complete function. When the DataFlow has been completed, no new items can be added to it. When collecting the DataFlow to an in-memory DataFrame, the Collect call waits until the DataFlow completes, to make sure all items are included to the DataFrame.

Property Description
IsCompleted (boolean) Returns true when the Complete function has been called for the DataFlow and there are no more unread items in it.
Function Parameters Description
Append (DataFlow) DataFrame to append

Adds given DataFrame to DataFlow. Examples:

let myDataFlow = ToDataFlow(ToDataFrame([], ["id", "color"]));
myDataFlow
  .Append(ToDataFrame([[1, "red"], [2, "green"]], ["id", "color"]));
myDataFlow
  .Complete()
  .Collect()
  .ToCsv()
Collect (DataFrame) Parameters (Dictionary)

Returns in-memory DataFrame extracted from DataFlow. Returns null if either the timeout has been exceeded or the flow has been completed and is empty. Parameters:

  1. CollectChunk: When true, returns the current DataFlow contents as a DataFrame. When false, waits for the DataFlow to complete and returns the entire DataFlow contents.
  2. Timeout: Maximum number of milliseconds to wait for data to appear into the DataFlow before exiting with null value as result.

Examples:

ToDataFlow(ToDataFrame([], ["id", "color"]))
  .Append(ToDataFrame([[1, "red"], [2, "green"]], ["id", "color"]))
  .Append(ToDataFrame([[3, "blue"]], ["id", "color"]))
  .Complete()
  .Collect(#{"CollectChunk": true})
  .ToCsv()
Complete (DataFlow) (none)

Declares that the DataFlow is completed, i.e., there won't be any new items anymore added to the DataFlow.

Examples:

myDataFlow.Complete();
Persist (Datatable)
  1. Datatable name (String)
  2. Additional parameters (Dictionary)
Writes DataFlow into datatable. Works similarly as the same function in the DataFrame.

Create new DataFlow:

Function Parameters Description
ToDataFlow (DataFlow)

Initialization DataFrame

Creates new DataFlow and optionally initializes it with given DataFrame.

Examples:

ToDataFlow(ToDataFrame([[1, "red"], [2, "green"]], ["id", "color"]))
  .Append(ToDataFrame([[3, "blue"]], ["id", "color"]))
  .Complete()
  .Collect()
  .ToCsv()