0
我想要CONCAT在我的豬列如果某些條件得到匹配,我使用下面的代碼,但它是拋出錯誤。Concat檢查豬的條件後
CODE:
STOCK_A = LOAD '/user/cloudera/pati1.hl7' USING PigStorage('|');
data = FILTER STOCK_A BY ($0 matches '.*OBR.*' or $0 matches '.*OBX.*');
MSH_DATA = FOREACH data GENERATE ($0=='OBR' ? CONCAT('OBR',CurrentTime(),$1) : ($0=='OBX' ? CONCAT('OBR',CurrentTime(),$1))) AS Uid; , $1 AS id, $5 AS result, $3 AS resultname;
Dump MSH_DATA;
ERROR:
ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: <line 13, column 122> mismatched input ')' expecting COLON
感謝您的詳細解釋,它幫助了很多。我嘗試了,但我得到錯誤'ERROR org.apache.pig.tools.grunt.Grunt - 錯誤1052: <第3行,第62列>無法將日期時間轉換爲chararray' – animal
請upvote問題,如果你喜歡它。 – animal
@animal我已經編輯了答案。您將不得不使用ToString()來投射日期時間對象。根據您的要求使用正確的日期時間格式。 –