fedSql

execDirect

Description

The `fedSql.execDirect` action submits a SAS FedSQL language statement for immediate execution on the CAS server. It enables standard SQL operations such as selecting, joining, and aggregating data distributed across CAS tables. This action supports advanced optimization controls, giving developers the ability to view query plans (`showPlan`) and execution stages (`showStages`), or to enforce specific execution behaviors like full pass-through.

Settings
ParameterDescription
querySpecifies the SAS FedSQL language statement to execute. This is the only required parameter.
cntlSpecifies a list of optional control parameters to tune query optimization (e.g., `disablePassThrough`, `preserveJoinOrder`).
methodWhen set to True, prints a brief description of the FedSQL query plan to the log.
showPlanWhen set to True, prints an XML tree representing the detailed FedSQL query plan.
showStagesWhen set to True, prints a brief description of query plans along with detailed execution stage information.
validateOnlyWhen set to True, validates the query syntax and checks for errors without executing the statement.
Data Preparation View data prep sheet
Create Sample Data

Generate a sample CAS table named 'Cars' for the SQL examples.

Copied!
1 
2PROC CAS;
3dataStep.runCode / code="
4data casuser.cars;
5set sashelp.cars;
6 
7run;
8";
9 
10RUN;
11 

Examples

Selects specific columns (Make, Model) from the Cars table where the Origin is 'Asia'.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3fedSql.execDirect / query="select Make, Model from casuser.cars where Origin='Asia'";
4 
5RUN;
6 
Result :
A result set displaying the Make and Model for all cars originating from Asia.

Calculates the average MSRP by Make, while enabling the display of the execution plan and stages to analyze performance.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3fedSql.execDirect / query="select Make, avg(MSRP) as AvgPrice from casuser.cars group by Make" showPlan=true showStages=true;
4 
5RUN;
6 
Result :
A table showing the average price per car manufacturer, with the XML query plan and execution stages printed in the log for analysis.

FAQ

What is the primary purpose of the execDirect action?
Which parameter is mandatory when using the execDirect action?
How can I validate a FedSQL query without executing it?
What options are available to view the FedSQL query plan?
How can I ensure that a query only runs if full implicit pass-through is achieved?
What does the 'dynamicCardinality' control parameter do?
How can I optimize precision for VARCHAR or VARBINARY data types?
Is it possible to force a specific join order for tables?
What is the default behavior for implicit pass-through in the execDirect action?
How can I get details about query execution stages?