You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2022/10/21 07:32:01 UTC
[jira] [Updated] (HIVE-18143) LazySimpleSerDe.LazyMap doesn't handle the condition of when map key is another column value
[ https://issues.apache.org/jira/browse/HIVE-18143?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stamatis Zampetakis updated HIVE-18143:
---------------------------------------
Fix Version/s: (was: 2.3.0)
I cleared the fixVersion field since this ticket is not resolved. Please review this ticket and if the fix is already committed to a specific version please set the version accordingly and mark the ticket as RESOLVED.
According to the JIRA guidelines (https://cwiki.apache.org/confluence/display/Hive/HowToContribute) the fixVersion should be set only when the issue is resolved/closed.
> LazySimpleSerDe.LazyMap doesn't handle the condition of when map key is another column value
> --------------------------------------------------------------------------------------------
>
> Key: HIVE-18143
> URL: https://issues.apache.org/jira/browse/HIVE-18143
> Project: Hive
> Issue Type: Bug
> Components: Serializers/Deserializers
> Affects Versions: 0.14.0, 1.2.2, 2.3.0
> Reporter: wei
> Assignee: wei
> Priority: Major
> Attachments: HIVE-18143.patch
>
>
> LazySimpleSerDe.LazyMap doesn't handle the condition of when map key is another column value.
> eg:
> CREATE TABLE `demo`(
> `create_timestamp` bigint,
> `ctime` string,
> `event_data` map<string,string>
> )
> ROW FORMAT SERDE
> 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
> STORED AS INPUTFORMAT
> 'org.apache.hadoop.mapred.TextInputFormat'
> OUTPUTFORMAT
> 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
> add data
> INSERT INTO TABLE demo
> select
> 1511192567909,
> '1511192567909',
> map('1511192567909', '05020918127a82816437ba9edac17fca42601');
> Do query:
> SELECT
> create_timestamp,
> ctime,
> event_data,
> event_data[create_timestamp],
> event_data[ctime]
> FROM demo;
> RES:
> | create_timestamp | ctime | event_data | _c3 | _c4 |
> +-------------------+----------------+------------------------------------------------------------+----------------------------------------+-------+--+
> | 1511192567909 | 1511192567909 | {"1511192567909":"05020918127a82816437ba9edac17fca42601"} | 05020918127a82816437ba9edac17fca42601 | NULL |
> event_data[ctime] get value NULL
> _______________________________________
> In LazyMap.getMapValueElement method.
> {code:java}
> // Some comments here
> public Object getMapValueElement(Object key) {
> if (!parsed) {
> parse();
> }
> // search for the key
> for (int i = 0; i < mapSize; i++) {
> LazyPrimitive<?, ?> lazyKeyI = uncheckedGetKey(i);
> if (lazyKeyI == null) {
> continue;
> }
> // getWritableObject() will convert LazyPrimitive to actual primitive
> // writable objects.
> Object keyI = lazyKeyI.getWritableObject();
> if (keyI == null) {
> continue;
> }
> if (keyI.equals(key)) {
> // Got a match, return the value
> return uncheckedGetValue(i);
> }
> }
> return null;
> }
> {code}
> When the key is a cloumn and don't need convert, the key will be a LazyPrimitive object.
> keyI = lazyKeyI.getWritableObject() is actual primitive writable objects.
> keyI.equals(key) will be false.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)