Kaveen Raajan created THRIFT-3304:
-------------------------------------
Summary: C# thrift.dll generates default values of fields instead
of null
Key: THRIFT-3304
URL: https://issues.apache.org/jira/browse/THRIFT-3304
Project: Thrift
Issue Type: Bug
Components: C# - Compiler, C# - Library
Affects Versions: 0.9.2
Environment: Windows 8, Hive1.1.0, HiveServer2
Reporter: Kaveen Raajan
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.
{code}
HqlConnection con = new HqlConnection("localhost", 10001,
HiveServer.HiveServer2);
con.Open();
HqlCommand createCommand1 = new HqlCommand("select id,name,age,DOB,marks from
engineer_list", con);
createCommand1.ExecuteNonQuery();
HqlDataReader reader = createCommand1.ExecuteReader();
{code}
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'
{code}
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)));
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)