Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive, mail # dev - Review Request: HIVE-3840 -hive cli null representation in output is inconsistent


+
Thejas Nair 2013-04-05, 18:31
+
Thejas Nair 2013-04-05, 18:32
+
Ashutosh Chauhan 2013-04-05, 20:58
Copy link to this message
-
Re: Review Request: HIVE-3840 -hive cli null representation in output is inconsistent
Thejas Nair 2013-04-05, 21:40


> On April 5, 2013, 8:58 p.m., Ashutosh Chauhan wrote:
> > serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java, line 222
> > <https://reviews.apache.org/r/10312/diff/1/?file=278309#file278309line222>
> >
> >     Bit confusing to me. JSON_NULL is still null, how come than we have NULL being printed now.

The DelimitedJSONSerDe class which i used for serialized output of hive cli, calls - buildJSONString(StringBuilder sb, Object o, ObjectInspector oi, String nullStr) .
For all other uses  of this funcitonality that don't care about customizing top level null, you still have - public static String getJSONString(Object o, ObjectInspector oi). In that case, the default of JSON_NULL is used.

Note that only the *top level* null representation has been changed. ie, if the ObjectInspector.getXXX() returns null, then the custom null representation is used. For cases where there are nulls within it (eg one of the values in a struct is null), then the json style lowercase null continues to be used .
> On April 5, 2013, 8:58 p.m., Ashutosh Chauhan wrote:
> > serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java, line 60
> > <https://reviews.apache.org/r/10312/diff/1/?file=278308#file278308line60>
> >
> >     seems like serde's could have stored custom representation of null in properties which would have been used, aren't we taking away that capability now?

The change now lets you customize the null string, which wasn't the case earlier.
> On April 5, 2013, 8:58 p.m., Ashutosh Chauhan wrote:
> > ql/src/test/results/clientpositive/input5.q.out, line 129
> > <https://reviews.apache.org/r/10312/diff/1/?file=278299#file278299line129>
> >
> >     Couldn't understand the reason how come this change may affect the ordering of rows. Do you have any insight?

The ascii sequence is like this - A .. Z [ \ ] .. a .. z
'NULL' comes before [.. , while 'null' comes after [.. .

In fact, this makes things more SQL complaint. SQL order-by clause requires the nulls to be all at the end or the begining. Now the behavior of primitive types and complex types will be consistent.
- Thejas
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/10312/#review18732
-----------------------------------------------------------
On April 5, 2013, 6:32 p.m., Thejas Nair wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/10312/
> -----------------------------------------------------------
>
> (Updated April 5, 2013, 6:32 p.m.)
>
>
> Review request for hive.
>
>
> Description
> -------
>
> HIVE-3840 -hive cli null representation in output is inconsistent
>
>
> This addresses bug HIVE-3840.
>     https://issues.apache.org/jira/browse/HIVE-3840
>
>
> Diffs
> -----
>
>   ql/src/test/results/clientpositive/avro_nullable_fields.q.out 4f48fbf
>   ql/src/test/results/clientpositive/columnarserde_create_shortcut.q.out f4b2830
>   ql/src/test/results/clientpositive/create_nested_type.q.out 9c44708
>   ql/src/test/results/clientpositive/input17.q.out db02dfa
>   ql/src/test/results/clientpositive/input5.q.out 3ea7a70
>   ql/src/test/results/clientpositive/input_columnarserde.q.out defec4c
>   ql/src/test/results/clientpositive/input_dynamicserde.q.out b22aa45
>   ql/src/test/results/clientpositive/input_lazyserde.q.out f5fe60a
>   ql/src/test/results/clientpositive/input_testxpath3.q.out aa81734
>   ql/src/test/results/clientpositive/join_thrift.q.out 2ed9f61
>   ql/src/test/results/clientpositive/udf_percentile.q.out f3b2cfc
>   ql/src/test/results/clientpositive/udf_substr.q.out a7e690f
>   ql/src/test/results/clientpositive/udtf_stack.q.out fe57cd1
>   serde/src/java/org/apache/hadoop/hive/serde2/DelimitedJSONSerDe.java b728b18
>   serde/src/java/org/apache/hadoop/hive/serde2/SerDeUtils.java 4954b29
>
> Diff: https://reviews.apache.org/r/10312/diff/
+
Ashutosh Chauhan 2013-04-05, 21:46