[ 
https://issues.apache.org/jira/browse/IMPALA-8665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gabor Kaszab updated IMPALA-8665:
---------------------------------
    Description: 
{code:java}
select cast("2000" as date); 
ERROR: UDF ERROR: String to Date parse failed.
{code}
 If we assume the user has millions of rows in a table and makes a cast on them 
it's hard to debug which one of the made the cast fail as there is no 
indication in the error message. Let's include at least the input value of the 
cast to the message.

Here we have everything available to do so:
https://github.com/apache/impala/blob/94652d74521e95e8606ea2d22aabcaddde6fc471/be/src/exprs/cast-functions-ir.cc#L313
{code:java}
DateVal CastFunctions::CastToDateVal(FunctionContext* ctx, const StringVal& 
val) {
  if (val.is_null) return DateVal::null();
  DateValue dv = DateValue::Parse(reinterpret_cast<char*>(val.ptr), val.len, 
true);
  if (UNLIKELY(!dv.IsValid())) {
    ctx->SetError("String to Date parse failed.");
    return DateVal::null();
  }
  return dv.ToDateVal();
}
{code}


  was:

{code:java}
select cast("2000" as date); 
ERROR: UDF ERROR: String to Date parse failed.
{code}
 If we assume the user has millions of rows in a table and makes a cast on them 
it's hard to debug which one of the made the cast fail as there is no 
indication in the error message. Let's include at least the input value of the 
cast to the message.


> Include extra info in error message when date cast fails
> --------------------------------------------------------
>
>                 Key: IMPALA-8665
>                 URL: https://issues.apache.org/jira/browse/IMPALA-8665
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Backend
>    Affects Versions: Impala 3.3.0
>            Reporter: Gabor Kaszab
>            Priority: Major
>              Labels: newbie, supportability
>
> {code:java}
> select cast("2000" as date); 
> ERROR: UDF ERROR: String to Date parse failed.
> {code}
>  If we assume the user has millions of rows in a table and makes a cast on 
> them it's hard to debug which one of the made the cast fail as there is no 
> indication in the error message. Let's include at least the input value of 
> the cast to the message.
> Here we have everything available to do so:
> https://github.com/apache/impala/blob/94652d74521e95e8606ea2d22aabcaddde6fc471/be/src/exprs/cast-functions-ir.cc#L313
> {code:java}
> DateVal CastFunctions::CastToDateVal(FunctionContext* ctx, const StringVal& 
> val) {
>   if (val.is_null) return DateVal::null();
>   DateValue dv = DateValue::Parse(reinterpret_cast<char*>(val.ptr), val.len, 
> true);
>   if (UNLIKELY(!dv.IsValid())) {
>     ctx->SetError("String to Date parse failed.");
>     return DateVal::null();
>   }
>   return dv.ToDateVal();
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to