[
https://issues.apache.org/jira/browse/PHOENIX-2734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15187471#comment-15187471
]
James Taylor commented on PHOENIX-2734:
---------------------------------------
This check should be further simplified:
{code}
if (!actualType.isCoercibleTo(type, value) &&
(!actualType.equals(PVarchar.INSTANCE) ||
- !(type.equals(PDate.INSTANCE) ||
type.equals(PTimestamp.INSTANCE) || type.equals(PTime.INSTANCE)))) {
+ !(type.isCoercibleTo(PDate.INSTANCE) ||
+ type.isCoercibleTo(PTimestamp.INSTANCE) ||
+ type.isCoercibleTo(PTime.INSTANCE)))) {
throw TypeMismatchException.newException(type, actualType,
value.toString());
}
{code}
To this:
{code}
if (!actualType.isCoercibleTo(type, value)) {
throw TypeMismatchException.newException(type, actualType,
value.toString());
}
{code}
and remove this comment as it doesn't make sense:
{code}
// For array we should check individual element in it?
// It would be costly though!!!!!
// UpsertStatement can try to cast varchar to date type but PVarchar
can't CoercibleTo Date or Timestamp
// otherwise TO_NUMBER like functions will fail
{code}
> Literal expressions for UNSIGNED_DATE/UNSIGNED_TIME/etc
> -------------------------------------------------------
>
> Key: PHOENIX-2734
> URL: https://issues.apache.org/jira/browse/PHOENIX-2734
> Project: Phoenix
> Issue Type: Bug
> Reporter: Sergey Soldatov
> Assignee: Sergey Soldatov
> Attachments: PHOENIX-2734.patch
>
>
> At the moment LiteralExpression accepts convertion from varchar to PDate,
> PTimestamp and PTime, but not for the PUnsigned... type. Is there any reason
> for that or we can just add an additional check for Unsigned types as well?
> The problem is that there is no way to load values to Unsigned date/time
> types using bulk load ( for regular upsert there is an workaround to use
> TO_TIME/etc functions). [~pctony] what do you think?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)