[HADOOP] 돼지 - 제거 줄 바꿈, 반환 및 탭
HADOOP돼지 - 제거 줄 바꿈, 반환 및 탭
나는 문자를 제거하기 위해 노력하고있어 : 돼지의 열에서 \ n을 \의 t와 \의 연구를하지만 잘못된 출력을 얻고있다.
여기에 내가 뭘하는지 있습니다 :
qr_1 = LOAD 'hdfs://localhost:9000/sample.csv' USING PigStorage(',') as (Id:int,PostTypeId:int,AcceptedAnswerId:int,ParentId:int,CreationDate:chararray,DeletionDate:chararray,Score:int,ViewCount:int,Body:chararray,OwnerUserId:int,OwnerDisplayName:chararray,LastEditorUserId:int,LastEditorDisplayName:chararray,LastEditDate:chararray,LastActivityDate:chararray,Title:chararray,Tags:chararray,AnswerCount:int,CommentCount:int,FavoriteCount:int,ClosedDate:chararray,CommunityOwnedDate:chararray);
qr_1 = FOREACH qr_1 GENERATE Id .. ViewCount, REPLACE(Body,'\n','') as Body, OwnerUserId .. ;
qr_1 = FOREACH qr_1 GENERATE Id .. ViewCount, REPLACE(Body,'\r','') as Body, OwnerUserId .. ;
qr_1 = FOREACH qr_1 GENERATE Id .. ViewCount, REPLACE(Body,'\t','') as Body, OwnerUserId .. ;
입력:
5585779,1,5585800,,2011-04-07 18:27:54,,1432,3090250,"<p>How can I convert a <code>String</code> to an <code>int</code> in Java?</p>
<p>My String contains only numbers and I want to return the number it represents.</p>
<p>For example, given the string <code>""""1234""""</code> the result should be the number <code>1234</code>.</p>",537967,,2756409,user166390,2015-09-10 21:30:42,2016-03-07 00:42:49,Converting String to Int in Java?,<java><string><type-conversion>,12,0,239
산출:
(5585779,1,5585800,,2011-04-07 18:27:54,,1432,3090250,"<p>How can I convert a <code>String</code> to an <code>int</code> in Java?</p>,,,,,,,,,,,,,)
(,,,,,,,,,,,,,,,,,,,,,)
(,,,,,,,,,,,,,,,,,,,,)
(,,,,,,,,,,,,,,,,,,,,,)
(,,537967,,2756409,user166390,,,Converting String to Int in Java?,,12,0,239,,,,,,,,,)
내가 무엇을하고 있니?
감사.
또한 "\\ n"은 차이를 만들지 않습니다.
해결법
-
==============================
1.이 쉼표는 데이터에 있으며 필드와 스키마가없는 matching.Use CSVLoader 된 후 '\\ t을'대체 REPLACE 명령을 사용하는 이유는,의 '\\ n'을, '\\ R'
이 쉼표는 데이터에 있으며 필드와 스키마가없는 matching.Use CSVLoader 된 후 '\\ t을'대체 REPLACE 명령을 사용하는 이유는,의 '\\ n'을, '\\ R'
<p>For example, given the string
from https://stackoverflow.com/questions/36212024/pig-remove-line-feed-return-and-tab by cc-by-sa and MIT license
'HADOOP' 카테고리의 다른 글
[HADOOP] 어떻게 HBase를에 플랫 파일 (안 구분 된 파일)을로드? (0) | 2019.10.20 |
---|---|
[HADOOP] 진수에 하이브 CsvSerde 표를 구분 (0) | 2019.10.20 |
[HADOOP] 때 JVM (또는 OS) 비정상적으로 파일 핸들러를 닫을 수 있습니다? (0) | 2019.10.20 |
[HADOOP] java.lang.OutOfMemoryError와 얻기 :지도 감소 제출하는 동안 GC 오버 헤드 제한 초과 (0) | 2019.10.20 |
[HADOOP] 아파치 기린과 하이브 - JDBC - 스토리지 - 핸들러 빌드 큐브 문제 (0) | 2019.10.20 |