I'm trying to detect in Java which fields in a cache are exposed to SQL by
looking at
"((QueryEntity)ignite.cache("cacheName").getConfiguration(CacheConfiguration.class).getQueryEntities().iterator().next()).getFields()".
This accurately reflects a table's initial schema. However, changes made
with "ALTER TABLE ADD COLUMN" and "DROP COLUMN" are not reflected in the
QueryEntity. For example, if I create then alter a table via a SQL client
with:
---
CREATE TABLE test1 (
"key" VARCHAR(30) NOT NULL,
"id" BIGINT(20) NOT NULL,
"testColumn1" VARCHAR(24) NOT NULL,
PRIMARY KEY("key"))
WITH "affinitykey=key, backups=1, write_synchronization_mode=FULL_SYNC,
atomicity=transactional, cache_name=test1, value_type=test1,
key_type=arrivals_key";
ALTER TABLE test1 ADD COLUMN "testColumn2" VARCHAR(24) NOT NULL;
---
... then try to print out the result of
"((QueryEntity)ignite.cache("test1").getConfiguration(CacheConfiguration.class).getQueryEntities().iterator().next()).getFields()"
I get "{key=java.lang.String, id=java.lang.Long,
testColumn1=java.lang.String}" which doesn't include the new column.
Dropping columns is likewise not reflected.
When I do try to query the cache via SQL, the added and dropped columns are
reflected in the result, so it's clear the change didn't fail to go through
entirely.
Is there something I'm missing? Is it possible to alter a table and then
detect the column changes in Java without entirely recreating the cache?
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/