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

Andrey Mashenkov updated IGNITE-12561:
--------------------------------------
    Description: 
If key and value types of an SQL-enabled cache have the same fields annotated 
with `@QuerySqlEntity` the cache will start without errors but the key's field 
will not be queryable:
  

 
{noformat}
// here, you can't query Key.a via SQL
class Key {
   @QuerySqlField int a; 
   @QuerySqlField int b; 
}
class Value { 
   @QuerySqlField int a;
   @QuerySqlField int c;
}
{noformat}
To workaround that, one needs to specify a different name for one of the `a` 
fields:
 

 
{noformat}
class Key {
   @QuerySqlField(name = "key_a") int a;
   @QuerySqlField int b; 
}
class Value {
   @QuerySqlField int a; 
   @QuerySqlField int c;
}
{noformat}

 The first configuration is obviously incorrect - one can't use the `Key.a` in 
SQL but annotates it as queryable. We need to issue an error or at least a 
warning for starting a configuration like this.

  was:
If key and value types of an SQL-enabled cache have the same fields annotated 
with `@QuerySqlEntity` the cache will start without errors but the key's field 
will not be queryable:
 
{color:#172b4d}{{{color:#505f79}// here, you can't query Key.a via 
SQL{color}{color:#0052cc}class{color} {color:#6554c0}Key{color} { 
@QuerySqlField {color:#0052cc}int{color} a; @QuerySqlField 
{color:#0052cc}int{color} b; }{color:#0052cc}class{color} 
{color:#6554c0}Value{color} { @QuerySqlField {color:#0052cc}int{color} a; 
@QuerySqlField {color:#0052cc}int{color} c; }}}{color}
To workaround that, one needs to specify a different name for one of the `a` 
fields:
 
{color:#172b4d}{{{color:#0052cc}class{color} {color:#6554c0}Key{color} { 
@QuerySqlField(name = {color:#36b37e}"key_a"{color}) {color:#0052cc}int{color} 
a; @QuerySqlField {color:#0052cc}int{color} b; }{color:#0052cc}class{color} 
{color:#6554c0}Value{color} { @QuerySqlField {color:#0052cc}int{color} a; 
@QuerySqlField {color:#0052cc}int{color} c; }}}{color}
The first configuration is obviously incorrect - one can't use the `Key.a` in 
SQL but annotates it as queryable. We need to issue an error or at least a 
warning for starting a configuration like this.


> Add a check for conflict of field names in key and value
> --------------------------------------------------------
>
>                 Key: IGNITE-12561
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12561
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Evgeniy Rudenko
>            Assignee: Evgeniy Rudenko
>            Priority: Major
>
> If key and value types of an SQL-enabled cache have the same fields annotated 
> with `@QuerySqlEntity` the cache will start without errors but the key's 
> field will not be queryable:
>   
>  
> {noformat}
> // here, you can't query Key.a via SQL
> class Key {
>    @QuerySqlField int a; 
>    @QuerySqlField int b; 
> }
> class Value { 
>    @QuerySqlField int a;
>    @QuerySqlField int c;
> }
> {noformat}
> To workaround that, one needs to specify a different name for one of the `a` 
> fields:
>  
>  
> {noformat}
> class Key {
>    @QuerySqlField(name = "key_a") int a;
>    @QuerySqlField int b; 
> }
> class Value {
>    @QuerySqlField int a; 
>    @QuerySqlField int c;
> }
> {noformat}
>  The first configuration is obviously incorrect - one can't use the `Key.a` 
> in SQL but annotates it as queryable. We need to issue an error or at least a 
> warning for starting a configuration like this.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to