Syam created HIVE-17984:
---------------------------
Summary: getMaxLength is not returning the previously set length
in ORC file
Key: HIVE-17984
URL: https://issues.apache.org/jira/browse/HIVE-17984
Project: Hive
Issue Type: Bug
Components: Hive, ORC
Environment: tested it against hive-exec 2.1
Reporter: Syam
getMaxLength is not returning the correct length for char/varchar datatypes.
I see that getMaxLength is returning 255 for CHAR type and 65535 for VARCHAR
type.
When I checked the same file using orcfiledump utility, I could see the correct
lengths.
Here is the snippet the code:
Reader _reader = OrcFile.createReader(new
Path(_fileName),OrcFile.readerOptions(conf).filesystem(fs)) ;
TypeDescription metarec = _reader.getSchema() ;
List <TypeDescription> cols = metarec.getChildren();
List <String> colNames = metarec.getFieldNames();
for (int i=0; i < cols.size(); i++)
{
TypeDescription fieldSchema = cols.get(i);
switch (fieldSchema.getCategory())
{
case CHAR:
header += "char(" + fieldSchema.getMaxLength() + ")" ;
break;
----------
----------
}
}
Please let me know your pointers please.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)