取出指定列处理

【问题】

i've got a questions regarding on how to process a delimited file with a large number of columns (>3000). I tried to extract the fields with the standard delimited file input component, but creating the schema takes hours and when i run the job i get an error, because the toString() method exceeds the 65535 bytes limit. At that point i can run the job but all the columns are messed up and i cant realy work with them anymore.

Is it possible to split that .csv-file with talend? Is there any other handling possible, maybe with some sort of java code? If you have any further questions dont hesitate to comment.

Cheers!

【回答】

你的要求是1:处理大csv文件。2:简化3000个字段的访问(schema )。3:用java访问。

这种情况下可以用SPL来实现,SPL中可用游标访问大文件,具有丰富的结构化计算函数,且容易被JAVA集成。比如只读出大文件的某几列,代码如下:

A
1=file("d:\\data.csv").cursor@tc(field,fieldYouNeed)

上述代码很容易和JAVA集成(可参考Java 如何调用 SPL 脚本)。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值