【pig】挑选合适的数据类型(待翻译)

As discussed elsewhere, Pig can run with or without data type information. In cases
where the load function you are using creates data that is already typed, there is little
you need to do to optimize the performance. However, if you are using the default
PigStorage load function that reads tab-delimited files, then whether you use types will
affect your performance.
On the one hand, converting fields from bytearray to the appropriate type has a cost.
So, if you do not need type information, you should not declare it. For example, if you
are just counting records, you can omit the type declaration without affecting the out-
come of your script.
On the other hand, if you are doing integer calculations, types can help your script
perform better. When Pig is asked to do a numeric calculation on a bytearray, it treats
that bytearray as a double because this is the safest assumption. But floating-point
arithmetic is much slower than integer arithmetic on most machines. For example, if
you are doing a SUM over integer values, you will get better performance by declaring
them to be of type integer.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值