[prev in list] [next in list] [prev in thread] [next in thread] 

List:       avro-dev
Subject:    Re: Handling empty string in avro file
From:       Ryan Blue <rblue () netflix ! com ! INVALID>
Date:       2016-03-22 17:44:18
Message-ID: CAO4re1=KG3oN9xsv4VSJmEp3n61Gk1vuLzRjje0NMxPkXf2KOw () mail ! gmail ! com
[Download RAW message or body]


Jegan,

It looks like the problem is that your zipcode type can't be a String. An
empty string isn't a valid value for int. You probably want to use null or
string for that field.

rb

On Mon, Mar 21, 2016 at 7:42 PM, Jegan <jeganbaskar@gmail.com> wrote:

> Hi All,
>
> I am using avro file format to load the data in to hive and source system
> is Teradata.  In the source i have a both NULL and empty string. But when
> it landed in the hive its storing both as NULL only. For example
>
> {
>   "type" : "record",
>   "name" : "Personal",
>   "fields" : [ {
>     "name" : "Id",
>     "type" : [ "null", "int" ]
>   }, {
>     "name" : "name",
>     "type" : [ "null", "string" ]
>   }, {
>     "name" : "age",
>     "type" : [ "null", "int" ]
>   }, {
>     "name" : "zipcode",
>     "type" : [ "null", "int" ]         --> have tried as "type" :int,
> "default" : ""
>   }]
> }
>
> Since integer value is empty in source, by above one comes as null as
> defined i tried give "type" : int as well and comes as NULL.
>
> Is there any way where i can get the empty string as it is in source.
> Because in my landing hive table should contain both NULL and emptystring
> and it has a different meaning for us . Your help would be appreciable.
>
> Thank you
>
> Regards,
> Jegan
>



-- 
Ryan Blue
Software Engineer
Netflix


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic