Ilya,

The “long.class” was a bug-feature (creature feature) that I was trying to trap 
in a unit test.

My unit test was asserting that the returned indexTypes would have … 
“java.lang.String” as an element in the array, but would fail the assertion 
because it would find a “long.class” instead.

Alas – my assumption was incorrect because “indexTypes” was in fact … null 
(hence my email about this).

While I waited for your response, I pivoted and instead made my assertions on 
the QueryEntities (and of course modified to NOT have long.class).

It was not my intention to send you the “long.class”, so my apologies for that 
part of the confusion – I was in a hurry to write up the snippet and got lazy 
with copy/paste instead.

I understood the motivation for the chaining, but I thought it was an oversight 
to have that field “indexedTypes” existing, but not populated – ever?.   Looks 
like its no longer used.   Should I fork the project and kill the field?   
(desirable or undesirable change?) – will give back the edit (of course).  Or 
instead, I could also make the getIndexedTypes scan the query entities and 
return an array of the values that are currently stored in the collection of 
query entities (maybe a better fix as it maintains backward compatibility and 
accurately reports the expected data).

Cheers,

SCott

From: Ilya Kasnacheev <[email protected]>
Sent: Tuesday, March 5, 2019 8:34 AM
To: [email protected]
Subject: Re: proper usage of sql configuration in ignite question

Hello!

Recent versions of Ignite will indeed fill QueryEntity and never use 
indexedTypes field. QueryEntity and Indexed Types are mutually exclusive anyway.

Return type is CacheConfiguration for invocations chaining, so that you can use:

CacheConfiguration cacheConfiguration = new CacheConfiguration()
     .setName(cacheName)
     .setTypes(keyClazz, valueClazz)
     .setIndexedTypes(long.class, valueClazz)
     .setSqlSchema("PUBLIC");

Why do you have keyClazz !=  indexed types key class?

Regards,
--
Ilya Kasnacheev


пн, 4 мар. 2019 г. в 19:27, Scott Cote <[email protected]<mailto:[email protected]>>:
Hello Igniters:

I am programmatically setting the index type data in ignite.

I was establishing the index types by doing something like:

CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setName(cacheName);
cacheConfiguration.setTypes(keyClazz, valueClazz);
cacheConfiguration.setIndexedTypes(long.class, valueClazz);
cacheConfiguration.setSqlSchema("PUBLIC");


But I discovered that my index type data was not setting ….
Under the hood, I saw that the QueryEntitiy for the “long.class,valueClazz” was 
getting created, but the field inside CacheConfig called “indexedTypes” was NOT 
getting set for my instance called cacheConfiguration.

Then I noticed that the “setIndexTypes” method is not a bean method … not a 
void return, but returns “this” .   (this is what I get for not reading the 
Javadoc closely, but instead relying in the method name to imply the usage ….  
).   Nonetheless, the returned “this” doesn’t have the value set either (the 
query entity does have it set).  When does the field “indexedTypes” get set?  
Only assignment that I saw was from the copy constructor …..

Is getIndexTypes useful still?

SCott


Reply via email to