Dear Hive Support Team,

I hope you are doing well. I am writing to inquire about a specific behavior I 
encountered in Hive, related to the 
org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector 
class.


Sql to reply this behavior:
```
-- add JsonSerDe jar
ADD JAR hive-hcatalog-core-1.1.0-cdh5.13.1.jar;
-- create json table, the `struct<MD5:string&gt;` will become to lower case: 
`struct<md5:string&gt;`.
CREATE TABLE `test.hive_json_struct_schema`(
&nbsp; `cond_keys` struct<MD5:string&gt;
)
ROW FORMAT SERDE 
&nbsp; 'org.apache.hive.hcatalog.data.JsonSerDe' 
STORED AS INPUTFORMAT 
&nbsp; 'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
&nbsp; 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'

```


When using the StandardStructObjectInspector class, it appears that field names 
are being automatically converted to lowercase in the following code snippet:


```
this.fieldName = fieldName.toLowerCase();
```


This behavior subsequently causes issues when querying JSON formatted tables, 
particularly when nested Struct field names within the JSON data contain a mix 
of uppercase and lowercase characters. Since field names are being changed to 
lowercase by the StandardStructObjectInspector class, the actual field names no 
longer match the expected field names, which leads to errors when reading the 
data.(Not with SQL)


I would appreciate if you could kindly provide an explanation for this design 
choice and whether there are any available workarounds or alternative solutions 
for this scenario. I understand that the class may have been implemented to 
avoid case sensitivity issues, but in cases like mine where field name case 
matters, it would be helpful to have a better understanding of how to handle 
this situation.


Thank you in advance for your assistance and guidance. I look forward to 
hearing from you.


Best regards,


Chang

Reply via email to