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

Pavel Pereslegin updated IGNITE-27577:
--------------------------------------
    Description: 
Example (TupleImpl):
{code:java}
  Tuple tuple = Tuple.create().set("ID", 10);
      
  // throws ClassCastException: class java.lang.Integer cannot be cast to class 
java.lang.String
  tuple.stringValue("ID");
{code}

Example (tuple obtained from table):
{code:java}
  igniteSql().executeScript("CREATE TABLE TEST (ID INT PRIMARY KEY); INSERT 
INTO TEST VALUES (10)");
  Tuple tuple = table("TEST").recordView().get(null, Tuple.create().set("ID", 
10));

  // throws ClassCastException: Column with name 'ID' has type INT32 but STRING 
was requested
  tuple.stringValue("ID");
{code}

We need to unify these messages and include column name/index to message raised 
by {{TupleImpl}} and {{SqlRowImpl}}.

P.s. Probably ArithmeticException message (when converting INT64 -> INT8 for 
example), should also include column name/index.

P.s. unmute test related to this issue

  was:
Example (TupleImpl):
{code:java}
  Tuple tuple = Tuple.create().set("ID", 10);
      
  // throws ClassCastException: class java.lang.Integer cannot be cast to class 
java.lang.String
  tuple.stringValue("ID");
{code}

Example (tuple obtained from table):
{code:java}
  igniteSql().executeScript("CREATE TABLE TEST (ID INT PRIMARY KEY); INSERT 
INTO TEST VALUES (10)");
  Tuple tuple = table("TEST").recordView().get(null, Tuple.create().set("ID", 
10));

  // throws ClassCastException: Column with name 'ID' has type INT32 but STRING 
was requested
  tuple.stringValue("ID");
{code}

We need to unify these messages and include column name/index to message raised 
by TupleImpl and SqlRowImpl.

P.s. Probably ArithmeticException message (when converting INT64 -> INT8 for 
example), should also include column name/index.


> Unify the message text of ClassCastException when a wrong method is used to 
> access the value of a tuple field.
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-27577
>                 URL: https://issues.apache.org/jira/browse/IGNITE-27577
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql ai3
>            Reporter: Pavel Pereslegin
>            Priority: Major
>              Labels: ignite-3
>
> Example (TupleImpl):
> {code:java}
>   Tuple tuple = Tuple.create().set("ID", 10);
>       
>   // throws ClassCastException: class java.lang.Integer cannot be cast to 
> class java.lang.String
>   tuple.stringValue("ID");
> {code}
> Example (tuple obtained from table):
> {code:java}
>   igniteSql().executeScript("CREATE TABLE TEST (ID INT PRIMARY KEY); INSERT 
> INTO TEST VALUES (10)");
>   Tuple tuple = table("TEST").recordView().get(null, Tuple.create().set("ID", 
> 10));
>   // throws ClassCastException: Column with name 'ID' has type INT32 but 
> STRING was requested
>   tuple.stringValue("ID");
> {code}
> We need to unify these messages and include column name/index to message 
> raised by {{TupleImpl}} and {{SqlRowImpl}}.
> P.s. Probably ArithmeticException message (when converting INT64 -> INT8 for 
> example), should also include column name/index.
> P.s. unmute test related to this issue



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to