在Pig中處理NULL值有幾種方法:
A = LOAD 'data' AS (col1: int, col2: chararray);
B = FOREACH A GENERATE COALESCE(col1, -1) AS col1, COALESCE(col2, 'N/A') AS col2;
A = LOAD 'data' AS (col1: int, col2: chararray);
B = FILTER A BY NOT IsEmpty(col1) AND NOT IsEmpty(col2);
A = LOAD 'data' AS (col1: int, col2: chararray);
B = FOREACH A GENERATE (col1 IS NULL ? -1 : col1) AS col1, (col2 IS NULL ? 'N/A' : col2) AS col2;
這些方法可以根據(jù)具體情況選擇合適的處理方式來處理NULL值。