Good, then we can do the same for the value type's name. Vladimir, what’s your opinion? If everybody agrees I’ll simply update this ticket expanding it: https://issues.apache.org/jira/browse/IGNITE-6242
— Denis > On Sep 2, 2017, at 1:41 AM, Alexander Paschenko > <[email protected]> wrote: > > Sounds good to me. > > – Alex > > 2017-09-02 9:12 GMT+02:00 Denis Magda <[email protected]>: >> Igniters, >> >> Consider a table and cache created this way: >> >> CREATE TABLE `city` ( >> `ID` INT(11), >> `Name` CHAR(35), >> `CountryCode` CHAR(3), >> `District` CHAR(20), >> `Population` INT(11), >> PRIMARY KEY (`ID`, `CountryCode`) >> ) WITH "template=partitioned, backups=1, affinityKey=CountryCode"; >> Now in addition to SQL I want to process the data from this cache using >> *key-value* and *compute affinity* APIs. To do that I need to build a valid >> key first (like CityKey(cityId, countryCode) where countryCode is an >> affinityKey). >> >> Seems it’s not achievable (or at least usable) because the key type name is >> defined by DDL/DML and a bit scary - >> SQL_PUBLIC_CITY_3f4e9fbf_3464_4598_8394_1307b86dc4e7_KEY. >> >> Will my case be addressed if we do the following? >> >> - Let a user pass a key type’s name into WITH clause. Assume CityKey was >> chosen for this example. >> >> - DML operations keep using the same BinaryObjectBuilders for the key >> generation internally but passing CityKey as a type name instead of the >> auto-generated one. >> >> - The end user now can construct a valid key using the same >> BinaryObjectBuilders or CityKey object (making sure hashCode and equals are >> implemented properly) and, for instance, execute a compute.affinityRun over >> the City cache. >> >> Please suggest another alternatives if I overlook something. >> >> — >> Denis >> >>
