全表統(tǒng)計(jì)
全表統(tǒng)計(jì)用于統(tǒng)計(jì)全表,或某些選中的列。
組件配置
您可以使用以下任意一種方式,配置全表統(tǒng)計(jì)組件參數(shù)。
方式一:可視化方式
在Designer工作流頁面配置組件參數(shù)。
頁簽 | 參數(shù) | 描述 |
參數(shù)設(shè)置 | 輸入列 | 選擇輸入列的字段,系統(tǒng)默認(rèn)選擇全部列。 |
執(zhí)行調(diào)優(yōu) | 核數(shù)目 | 節(jié)點(diǎn)個(gè)數(shù)。 |
內(nèi)存數(shù) | 單個(gè)節(jié)點(diǎn)內(nèi)存大小。 |
方式二:PAI命令方式
使用PAI命令方式,配置該組件參數(shù)。您可以使用SQL腳本組件進(jìn)行PAI命令調(diào)用,詳情請(qǐng)參見SQL腳本。
PAI -name stat_summary
-project algo_public
-DinputTableName=test_data
-DoutputTableName=test_summary_out
-DinputTablePartitions="ds='20160101'"
-DselectColNames=col0,col1,col2
-Dlifecycle=1
參數(shù)名稱 | 參數(shù)描述 | 是否必選 |
inputTableName | 輸入表名。 | 是 |
outputTableName | 輸出表名。 | 是 |
inputTablePartitions | 輸入表的分區(qū),系統(tǒng)默認(rèn)選擇所有分區(qū)。 | 否 |
selectColNames | 需要統(tǒng)計(jì)的列名。 | 否 |
lifecycle | 輸出結(jié)果表的生命周期,系統(tǒng)默認(rèn)不設(shè)置生命周期。 說明 僅支持輸入正整數(shù)。 | 否 |
coreNum | 節(jié)點(diǎn)數(shù)量。 說明 僅支持輸入正整數(shù)。 | 否 |
memSizePerCore | 每個(gè)節(jié)點(diǎn)的內(nèi)存數(shù),取值范圍[1024, 64*1024],單位MB。 說明 僅支持輸入正整數(shù)。 | 否 |
輸出格式
輸出統(tǒng)計(jì)結(jié)果的全部字段,如下表所示。
列名 | 描述 |
colname | 列名 |
datatype | 類型 |
totalcount | 總數(shù) |
count | 非NULL數(shù)量 |
missingcount | NULL數(shù)量 |
nancount | NAN數(shù)量 |
positiveinfinitycount | 正無窮數(shù)量 |
negativeinfinitycount | 負(fù)無窮數(shù)量 |
min | 最小值 |
max | 最大值 |
mean | 平均值 |
variance | 方差 |
standarddeviation | 標(biāo)準(zhǔn)差 |
standarderror | 標(biāo)準(zhǔn)誤差 |
skewness | 偏度 |
kurtosis | 峰度 |
moment2 | 二階矩 |
moment3 | 三階矩 |
moment4 | 四階矩 |
centralmoment2 | 二階中心距 |
centralmoment3 | 三階中心距 |
centralmoment4 | 四階中心距 |
sum | 總和 |
sum2 | 平方和 |
sum3 | 立方和 |
sum4 | 四次方和 |
示例
輸入數(shù)據(jù)
drop table if exists summary_test_input; create table summary_test_input as select * from ( select 'a' as col1, 1 as col2, 0.001 as col3 union all select 'b' as col1, 2 as col2, 100.01 as col3 ) tmp;
PAI命令
PAI -name stat_summary -project algo_public -DinputTableName=summary_test_input -DoutputTableName=summary_test_input_out -DselectColNames=col1,col2,col3 -Dlifecycle=1;
輸出結(jié)果
| colname | datatype | totalcount | count | missingcount | nancount | positiveinfinitycount | negativeinfinitycount | min | max | mean | variance | standarddeviation | standarderror | skewness | kurtosis | moment2 | moment3 | moment4 | centralmoment2 | centralmoment3 | centralmoment4 | sum | sum2 | sum3 | sum4 | | col1 | string | 2 | 2 | 0 | 0 | 0 | 0 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | | col2 | bigint | 2 | 2 | 0 | 0 | 0 | 0 | 1 | 2 | 1.5 | 0.5 | 0.7071067811865476 | 0.5 | 0 | -2 | 2.5 | 4.5 | 8.5 | 0.25 | 0 | 0.0625 | 3 | 5 | 9 | 17 | | col3 | double | 2 | 2 | 0 | 0 | 0 | 0 | 0.001 | 100.01 | 50.0055 | 5000.900040500001 | 70.71704207968544 | 50.00450000000001 | 2.327677906939552e-16 | -1.999999999999999 | 5001.000050500001 | 500150.0150005006 | 50020003.00020002 | 2500.45002025 | 2.91038304567337e-11 | 6252250.303768232 | 100.011 | 10002.000101 | 1000300.030001001 | 100040006.0004 |