Hi,
I re-try my use-case on Apache Hive 4.0.0-beta-1 release. ??Just with create
table statement.??
This behavior still exists.
Best regards,
Chang
------------------ ???????? ------------------
??????:
"user"
<[email protected]>;
????????: 2024??2??1??(??????) ????4:21
??????: "user"<[email protected]>;"hang.wd"<[email protected]>;
????: Re: [Hive Support] Query about StandardStructObjectInspector
converting field names to lowercase
Hi Chang,
The hive-hcatalog-core-1.1.0-cdh5.13.1.jar jar file is not something
maintained by Apache. For vendor specific problems you should reach
out to the respective support team from where you obtained the
product.
Apart from that the version that you are using (5.13.1) is quite old.
Please re-try your use-case with the latest Apache Hive 4.0.0-beta-1
release [1] and report back if you still observe unexpected behavior.
Best,
Stamatis
[1] https://hive.apache.org/general/downloads/
On Mon, Jan 29, 2024 at 5:52?6?2AM chang.wd <[email protected]> wrote:
>
> 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>` will become to lower
case: `struct<md5:string>`.
> CREATE TABLE `test.hive_json_struct_schema`(
> `cond_keys` struct<MD5:string>
> )
> ROW FORMAT SERDE
> 'org.apache.hive.hcatalog.data.JsonSerDe'
> STORED AS INPUTFORMAT
> 'org.apache.hadoop.mapred.TextInputFormat'
> OUTPUTFORMAT
> '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