在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;
这些方法可以根据具体情况选择合适的处理方式来处理NULL值。