The Normality Test component checks whether a dataset follows a normal distribution. Run it before applying statistical methods that assume normality—such as t-tests, linear regression, or ANOVA—to validate that assumption on your data.
The component supports three methods: the Anderson-Darling test, the Kolmogorov-Smirnov test, and the Q-Q plot test. Run one or all three in a single execution.
How it works
Each method approaches normality detection differently:
| Method | Approach | Best for |
|---|---|---|
| Anderson-Darling test | Measures the weighted squared difference between the empirical and theoretical cumulative distribution functions (CDFs), with extra weight on the tails | Detecting tail deviations from normality |
| Kolmogorov-Smirnov test | Calculates the maximum absolute difference between the empirical CDF and a reference distribution | General goodness-of-fit testing on continuous distributions |
| Q-Q plot test | Plots sample quantiles against theoretical quantiles to reveal distributional shape visually | Visually diagnosing the type and location of deviations |
Choosing a method:
-
Use the Anderson-Darling test when your data may have heavy or skewed tails and you need a sensitive statistical test.
-
Use the Kolmogorov-Smirnov test for a standard non-parametric comparison against a normal reference distribution.
-
Use the Q-Q plot test alongside either statistical test to visually confirm the result.
-
Enable all three to cross-validate conclusions. If results disagree, the Q-Q plot often clarifies which test to trust.
Configure the component
Method 1: Configure on the pipeline page
Add a Normality Test component to your pipeline and set the following parameters:
| Category | Parameter | Description |
|---|---|---|
| Fields Setting | Columns | The column to run the normality test on |
| Parameters Setting | Anderson-Darling Test | Whether to run the Anderson-Darling test |
| Kolmogorov-Smirnov Test | Whether to run the Kolmogorov-Smirnov test | |
| Use QQ Plot | Whether to run the Q-Q plot test | |
| Tuning | Computing Cores | The number of cores to use. Must be a positive integer |
| Memory Size per Core (Unit: MB) | The memory allocated to each core |
Method 2: Use PAI commands
Run the component via a PAI command in a SQL Script component. For details on the SQL Script component, see SQL script.
PAI -name normality_test
-project algo_public
-DinputTableName=test
-DoutputTableName=test_out
-DselectedColNames=col1,col2
-Dlifecycle=1;
Parameters:
| Parameter | Required | Default | Description |
|---|---|---|---|
inputTableName |
Yes | — | The name of the input table |
outputTableName |
Yes | — | The name of the output table |
selectedColNames |
No | — | The columns to test. Accepts DOUBLE or BIGINT type columns. Separate multiple columns with commas |
inputTablePartitions |
No | "" |
The partition of the input table |
enableQQplot |
No | true |
Whether to run the Q-Q plot test |
enableADtest |
No | true |
Whether to run the Anderson-Darling test |
enableKStest |
No | true |
Whether to run the Kolmogorov-Smirnov test |
lifecycle |
No | -1 |
The lifecycle of the output table. The value is an integer that is greater than or equal to -1. Set to -1 to leave the lifecycle unset |
coreNum |
No | -1 |
The number of compute cores. Set to -1 to let the system determine based on input size |
memSizePerCore |
No | -1 |
Memory per core, in MB. Valid values: (100, 64×1024). Set to -1 to let the system determine based on input size |
Example
This example creates a sample input table with 10 rows and runs the Anderson-Darling and Kolmogorov-Smirnov tests on column x.
Step 1: Create the input table
Add a SQL Script component. Deselect Use Script Mode and Whether the system adds a create table statement, then enter the following SQL:
drop table if exists normality_test_input;
create table normality_test_input as
select * from
(
select 1 as x union all
select 2 as x union all
select 3 as x union all
select 4 as x union all
select 5 as x union all
select 6 as x union all
select 7 as x union all
select 8 as x union all
select 9 as x union all
select 10 as x
) tmp;
Step 2: Run the normality test
Add another SQL Script component. Deselect Use Script Mode and Whether the system adds a create table statement, then enter the following PAI command. Connect the output of Step 1 to this component.
drop table if exists ${o1};
PAI -name normality_test
-project algo_public
-DinputTableName=normality_test_input
-DoutputTableName=${o1}
-DselectedColNames=x
-Dlifecycle=1;
Step 3: Run the pipeline
Click the
icon in the upper left corner to run the pipeline.
Step 4: View the results
Right-click the SQL Script component from Step 2 and choose View Data > SQL Script Output.
The output table has four columns: colname, testname, testvalue, and pvalue:
| colname | testname | testvalue | pvalue |
|---|---|---|---|
| x | 1.0 | 0.8173291742279805 | |
| x | 2.0 | 2.470864450785345 | |
| x | 3.0 | 3.5156067948020056 | |
| x | 4.0 | 4.3632330349313095 | |
| x | 5.0 | 5.128868067945126 | |
| x | 6.0 | 5.871131932054874 | |
| x | 7.0 | 6.6367669650686905 | |
| x | 8.0 | 7.4843932051979944 | |
| x | 9.0 | 8.529135549214654 | |
| x | 10.0 | 10.182670825772018 | |
| x | Anderson_Darling_Test | 0.1411092332197832 | 0.9566579606430077 |
| x | Kolmogorov_Smirnov_Test | 0.09551932503797644 | 0.9999888659426232 |
In this example, both tests return high p-values (Anderson-Darling: 0.957, Kolmogorov-Smirnov: 0.9999888...), indicating no significant departure from normality for column x.