You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "David Mollitor (JIRA)" <ji...@apache.org> on 2019/03/07 17:49:00 UTC
[jira] [Comment Edited] (HIVE-21264) Improvements Around
CharTypeInfo
[ https://issues.apache.org/jira/browse/HIVE-21264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16787019#comment-16787019 ]
David Mollitor edited comment on HIVE-21264 at 3/7/19 5:48 PM:
---------------------------------------------------------------
[~gopalv] Thank you so much for the review.
If you prefer viewing changes in GitHub, I added a PR: https://github.com/apache/hive/pull/561
So, {{CharTypeInfo}} and {{VarcharTypeInfo}} are decedents of both {{BaseCharTypeInfo}} and {{PrimitiveTypeInfo}}. And with this proposed change, {{CharTypeInfo}} and {{VarcharTypeInfo}} do not override the {{hashcode}} or {{equals}} method. The equality check to ensure that they are the same type occurs in {{PrimitiveTypeInfo}} and the check that they are of the same length occurs in {{BaseCharTypeInfo}}. There is no need to do this check explicitly in the child classes.
I have added a unit test to my patch to demonstrate.
was (Author: belugabehr):
[~gopalv] Thank you so much for the review.
If you prefer viewing changes in GitHub, I added a PR: https://github.com/apache/hive/pull/561
So, {{CharTypeInfo}} and {{VarcharTypeInfo}} are decedents of both {{BaseCharTypeInfo}} and {{PrimitiveTypeInfo}}. And with this proposed change, {{CharTypeInfo}} and {{VarcharTypeInfo}} do not override the {{hashcode}} or {{equals}} method. The equality check to ensure that they are the same type occurs in {{PrimitiveTypeInfo} and the check that they are of the same length occurs in {{BaseCharTypeInfo}}. There is no need to do this check explicitly in the child classes.
I have added a unit test to my patch to demonstrate.
> Improvements Around CharTypeInfo
> --------------------------------
>
> Key: HIVE-21264
> URL: https://issues.apache.org/jira/browse/HIVE-21264
> Project: Hive
> Issue Type: Improvement
> Affects Versions: 4.0.0, 3.2.0
> Reporter: David Mollitor
> Assignee: David Mollitor
> Priority: Minor
> Labels: pull-request-available
> Attachments: HIVE-21264.1.patch, HIVE-21264.2.patch, HIVE-21264.3.patch
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The {{CharTypeInfo}} stores the type name of the data type (char/varchar) and the length (1-255). {{CharTypeInfo}} objects are often getting cached once they are created.
> The {{hashcode()}} and {{equals()}} of its sub-classes varchar and char are inconsistent.
> * Make hashcode and equals consistent (and fast)
> * Simplify the {{getQualifiedName}} implementation and reduce the scope to protected
> * Other related nits
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)