【问题标题】:Pig Latin Loading a file that has ! as delimiterPig Latin 正在加载具有 !作为分隔符
【发布时间】:2016-09-21 18:56:35
【问题描述】:

我是 Pig 新手,所以可能有一个简单的解决方案,但我无法弄清楚。

问题:我有一个以! 作为分隔符的平面文件,所以文件的结构看起来像这样

!id!value!value2
!1!100!200

当我尝试使用 pigstorage('\t') 加载此文件时,所有内容都加载到第一个变量中。

 foo=load'bar.txt' using Pigstorage('\t') as 
 Id:chararray,value:chararray,value3:chararray;

这不起作用,因为所有文件都被读入ID 列。 我想拆分负载,以便在其正确的列中读取每个值。

到目前为止,我尝试了在 how to load files with different delimiter each time in piglatin 上找到的 customloader

但是,这也不适用于!

提前致谢

【问题讨论】:

    标签: csv hadoop apache-pig


    【解决方案1】:

    你试过了吗

    foo=load'bar.txt' using Pigstorage('!') as 
     Id:chararray,value:chararray,value3:chararray;
    

    【讨论】:

      猜你喜欢
      • 2023-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-20
      • 1970-01-01
      相关资源
      最近更新 更多