[
https://issues.apache.org/jira/browse/HIVE-24748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18004011#comment-18004011
]
Stamatis Zampetakis commented on HIVE-24748:
--------------------------------------------
If I recall well Hive does not officially support periods greater than 9999.
This is [documented for the DATE
type|https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=82706456#LanguageManualTypes-date]
but I guess for the TIMESTAMP type it should be the same. Having said that, I
am not opposed to improvements that could make the current behavior less
surprising if they are well localized and low risk.
> The result of TimestampWritableV2.toString() is wrong when year is larger
> than 9999.
> ------------------------------------------------------------------------------------
>
> Key: HIVE-24748
> URL: https://issues.apache.org/jira/browse/HIVE-24748
> Project: Hive
> Issue Type: Bug
> Components: Serializers/Deserializers
> Affects Versions: 4.0.0, 4.0.1
> Environment: Master branch
> Reporter: Qiang.Kang
> Assignee: Qiang.Kang
> Priority: Critical
> Labels: hive-4.1.0-must, pull-request-available
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Hi, I found that `TimestampWritableV2.toString()` can be wrong when year is
> larger than 9999. Here is what I get:
> - test code:
> {code:java}
> // code placeholder
> @Test
> public void testTimestampWritableV2toString() {
> TimestampWritableV2 timestampWritableV2 = new TimestampWritableV2(
> Timestamp.valueOf("10001-01-01 01:01:23"));
>
> assertEquals("+10001-01-01 01:01:23", timestampWritableV2.toString());
> }{code}
> - output:
> {code:java}
> // code placeholder
> org.junit.ComparisonFailure:
> Expected :+10001-01-01 01:01:23
> Actual :+10001-01-01 01:01:2323
> {code}
> The patch below removes some 'wrong' code in
> `TimestampWritableV2.toString()`, for the reason that the length of
> `org.apache.hadoop.hive.common.type.Timestamp#toString` can be larger than
> 19, even its nano-of-second is zero.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)