Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3304

C# thrift.dll generates default values of fields instead of 'null'

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 0.9.2
    • Fix Version/s: None
    • Component/s: C# - Compiler, C# - Library
    • Labels:
    • Environment:

      Windows 8, Hive1.1.0, HiveServer2


      I'm currently using HiveServer2 with thrift.dll library. If I try to make a tuple from a thrift object, I expect that fields that were not set in the object, are marked null in tuple. However instead default values are put into the tuple. E.g.

      HqlConnection con = new HqlConnection("localhost", 10001, HiveServer.HiveServer2);
      HqlCommand createCommand1 = new HqlCommand("select id,name,age,DOB,marks from engineer_list", con);
      HqlDataReader reader = createCommand1.ExecuteReader();

      expected output should be

      {(1,'John',24,2010-01-01 10:22:47,45.6), (2,null,null,null,null)}

      but actual result was:

      {(1,'John',24,2010-01-01 10:22:47,45.6), (2,,,0,0)}

      When we send request to call numeric column which contain NULL value for a type (int, double, long, float..) means ‘thrift.dll’ itself return as zero instead of 'null' or 'DBNull.value'.
      For string, timestamp type mean 'thrift.dll' itself return as empty string instead of 'null' or 'DBNull.value'.
      By analyzing the source of thrift.dll, we trigger out the method for reading the column by following
      Class: Thrift.Protocol.TBinaryProtocol
      Method: ReadAll(buffer, offset, length) by default it return as zero.
      Description: This will get stream of data from thriftServer port

      For Int value following method are call this will return as '0' if data contain 'null'

      private byte[] i32in = new byte[4];
      public override int ReadI32()
        ReadAll(i32in, 0, 4);
        return (int)(((i32in[0] & 0xff) << 24) | ((i32in[1] & 0xff) << 16) | ((i32in[2] & 0xff) << 8) | ((i32in[3] & 0xff)));




            • Assignee:
              KaveenBigdata Kaveen Raajan


              • Created:

                Issue deployment