全表统计用于统计全表,或某些选中的列。
组件配置
您可以使用以下任意一种方式,配置全表统计组件参数。
方式一:可视化方式
在Designer(原PAI-Studio)工作流页面配置组件参数。
页签 |
参数 |
描述 |
参数设置 |
输入列 |
选择输入列的字段,系统默认选择全部列。 |
执行调优 |
核数目 |
节点个数。 |
内存数 |
单个节点内存大小。 |
方式二:PAI命令方式
使用PAI命令方式,配置该组件参数。您可以使用SQL脚本组件进行PAI命令调用,详情请参见SQL脚本。
PAI -name stat_summary
-project algo_public
-DinputTableName=test_data
-DoutputTableName=test_summary_out
-DinputTablePartitions="ds='20160101'"
-DselectColNames=col0,col1,col2
-Dlifecycle=1
参数名称 |
参数描述 |
是否必选 |
inputTableName |
输入表名。 |
是 |
outputTableName |
输出表名。 |
是 |
inputTablePartitions |
输入表的分区,系统默认选择所有分区。 |
否 |
selectColNames |
需要统计的列名。 |
否 |
lifecycle |
输出结果表的生命周期,系统默认不设置生命周期。 说明 仅支持输入正整数。 |
否 |
coreNum |
节点数量。 说明 仅支持输入正整数。 |
否 |
memSizePerCore |
每个节点的内存数,取值范围[1024, 64*1024],单位MB。 说明 仅支持输入正整数。 |
否 |
输出格式
输出统计结果的全部字段,如下表所示。
列名 |
描述 |
colname |
列名 |
datatype |
类型 |
totalcount |
总数 |
count |
非NULL数量 |
missingcount |
NULL数量 |
nancount |
NAN数量 |
positiveinfinitycount |
正无穷数量 |
negativeinfinitycount |
负无穷数量 |
min |
最小值 |
max |
最大值 |
mean |
平均值 |
variance |
方差 |
standarddeviation |
标准差 |
standarderror |
标准误差 |
skewness |
偏度 |
kurtosis |
峰度 |
moment2 |
二阶矩 |
moment3 |
三阶矩 |
moment4 |
四阶矩 |
centralmoment2 |
二阶中心距 |
centralmoment3 |
三阶中心距 |
centralmoment4 |
四阶中心距 |
sum |
总和 |
sum2 |
平方和 |
sum3 |
立方和 |
sum4 |
四次方和 |
示例
-
输入数据
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 from dual union all select 'b' as col1, 2 as col2, 100.01 as col3 from dual ) tmp;
-
PAI命令
PAI -name stat_summary -project algo_public -DinputTableName=summary_test_input -DoutputTableName=summary_test_input_out -DselectColNames=col1,col2,col3 -Dlifecycle=1;
-
输出结果
| 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 |
内容没看懂? 不太想学习?想快速解决? 有偿解决: 联系专家
阿里云企业补贴进行中: 马上申请
腾讯云限时活动1折起,即将结束: 马上收藏
同尘科技为腾讯云授权服务中心。
购买腾讯云产品享受折上折,更有现金返利:同意关联,立享优惠
转转请注明出处:https://www.yunxiaoer.com/162655.html