SqlDataFrame in Expression Language: Difference between revisions
No edit summary |
No edit summary |
||
Line 84: | Line 84: | ||
||Number of rows (Integer) | ||Number of rows (Integer) | ||
||Same functionality as in the [[DataFrame_in_Expression_Language|DataFrame]]. | ||Same functionality as in the [[DataFrame_in_Expression_Language|DataFrame]]. | ||
|- | |||
||WithDenseRankNumberColumn (DataFrame) | |||
|| | |||
# New column name (String) | |||
# Order by columns (String array) | |||
# Partition by columns (String array) | |||
|| | |||
Same functionality as in the [[DataFrame_in_Expression_Language|DataFrame]]. | |||
|- | |||
||WithExpressionColumn (DataFrame) | |||
|| | |||
# New column name (String) | |||
# Calculation expression | |||
|| | |||
Same functionality as in the [[DataFrame_in_Expression_Language|DataFrame]]. | |||
|- | |||
||WithRankColumn (DataFrame) | |||
|| | |||
# New column name (String) | |||
# Order by columns (String array) | |||
# Partition by columns (String array) | |||
|| | |||
Same functionality as in the [[DataFrame_in_Expression_Language|DataFrame]]. | |||
|- | |||
||WithRowNumberColumn (DataFrame) | |||
|| | |||
Same functionality as in the [[DataFrame_in_Expression_Language|DataFrame]]. | |||
|- | |- | ||
||Where (SqlDataFrame) | ||Where (SqlDataFrame) |
Revision as of 15:37, 17 May 2021
SqlDataFrame represents tabular data similar to a result of an SQL query. Data in the SqlDataFrames are processed in the original datasource where the data is located (not in the QPR ProcessAnalyzer server in-memory). For each SqlDataFrame, there is an SQL query that processes and generates the actual data in the datasource.
Running SqlDataFrames and operations between them don't yet execute the SQL in the original datasource. This happens when the Collect function is called for an SqlDataFrame, which executes the SQL query of the SqlDataFrames and loads the data into QPR ProcessAnalyzer server in-memory dataframe (where it can be presented in a dashboard).
Each SqlDataFrames contain information about the datasource where the SQL query will be executed. When writing queries with several SqlDataFrames, the SqlDataFrames need to be located in the same datasource, because otherwise the queries cannot be executed. To do that, data needs to be moved between datasources, and that can be done using the Import or Persist functions. Alternatively, processing can be done in the in-memory core by calling Collect for the SqlDataFrames and continuing queries using the in-memory DataFrames.
There is a similar API for the SqlDataFrames as there is for the DataFrames.
SqlDataFrame functions | Parameters | Description |
---|---|---|
Aggregate (DataFrame) |
|
Same functionality as in the DataFrame. |
Collect (DataFrame) | (none) |
Executes the SQL query for the SqlDataFrame in the datasource and returns results as an in-memory DataFrame. Then processing of the data can be continued as the in-memory DataFrame. In addition to the Persist function, Collect function is the only way to get the actual SQL query executed to see the results (or store them to a table). Examples: DataTableById(123).SqlDataFrame.Head(100).Collect().ToCsv() Returns the top 100 rows from datatable id 123. |
ExcludeValues (SqlDataFrame) |
|
Same functionality as in the DataFrame. |
GroupBy (GroupedDataFrame) |
Grouped columns (string array) |
Same functionality as in the DataFrame. |
Head (SqlDataFrame) | Number of top rows |
Same functionality as in the DataFrame. |
IncludeOnlyValues (SqlDataFrame) |
|
Same functionality as in the DataFrame. |
Join (SqlDataFrame) |
|
Same functionality as in the DataFrame. |
OrderByColumns (SqlDataFrame) |
|
Same functionality as in the DataFrame. |
Persist (SqlDataFrame) |
|
Same functionality as in the DataFrame. If the SQL query for the SqlDataFrame is run in the same system as the target Datatable, for efficient operation, all data processing and storage is done within the system. |
Select (SqlDataFrame) |
Column names (string array, or key-value pairs) |
Same functionality as in the DataFrame. |
TakeSample (SqlDataFrame) | Number of rows (Integer) | Same functionality as in the DataFrame. |
WithDenseRankNumberColumn (DataFrame) |
|
Same functionality as in the DataFrame. |
WithExpressionColumn (DataFrame) |
|
Same functionality as in the DataFrame. |
WithRankColumn (DataFrame) |
|
Same functionality as in the DataFrame. |
WithRowNumberColumn (DataFrame) |
Same functionality as in the DataFrame. | |
Where (SqlDataFrame) | Condition expression | Same functionality as in the DataFrame. Note that not all expression language functionality are available in the condition expression, as the condition is converted into SQL having differences and limitations comparing to the expression language functionality. |