文档

全表统计

更新时间:

全表统计用于统计全表,或某些选中的列。

组件配置

您可以使用以下任意一种方式,配置全表统计组件参数。

方式一:可视化方式

Designer工作流页面配置组件参数。

页签

参数

描述

参数设置

输入列

选择输入列的字段,系统默认选择全部列。

执行调优

核数目

节点个数。

内存数

单个节点内存大小。

方式二: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)
文档反馈