IMPALA-4711: clarify is_null semantics in udf.h

This is to reduce the chance of confusion about what the UDF interface
guarantees. E.g. I've seen users post code that assumes that the len
field of a NULL StringVal is 0, which we do not guarantee.

Change-Id: I2b3fe0b3e57f055682fa93a4ea3c20490058450b
Reviewed-on: http://gerrit.cloudera.org:8080/6311
Tested-by: Impala Public Jenkins
Reviewed-by: Tim Armstrong <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/ec469347
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/ec469347
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/ec469347

Branch: refs/heads/master
Commit: ec469347fd08467d5763bdfc2ce707e6df77998a
Parents: d3cc23e
Author: Tim Armstrong <[email protected]>
Authored: Tue Mar 7 17:00:35 2017 -0800
Committer: Tim Armstrong <[email protected]>
Committed: Wed Mar 8 06:16:08 2017 +0000

----------------------------------------------------------------------
 be/src/udf/udf.h | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/ec469347/be/src/udf/udf.h
----------------------------------------------------------------------
diff --git a/be/src/udf/udf.h b/be/src/udf/udf.h
index b6846db..725abe8 100644
--- a/be/src/udf/udf.h
+++ b/be/src/udf/udf.h
@@ -404,6 +404,9 @@ typedef ResultType (*UdaFinalize)(FunctionContext* context, 
const IntermediateTy
 //-------------Implementation of the *Val structs ----------------------------
 //----------------------------------------------------------------------------
 struct AnyVal {
+  // Whether this value is NULL. If true, all other fields contain arbitrary 
values.
+  // UDF code should *not* assume that other fields of a NULL *Val struct have 
any
+  // particular value (e.g. 0 or -1).
   bool is_null;
   AnyVal(bool is_null = false) : is_null(is_null) {}
 };

Reply via email to