Reputation: 13091
Is there a java code or SQL example to list all caches existing in Apache Ignite?
Also is there a java code or SQL example to list columns within one cache in Apache Ignite?
Upvotes: 1
Views: 1098
Reputation: 1006
org.apache.ignite.Ignite#cacheNames
lists all the available caches.
You can obtain information about columns from QueryEntries
set for a cache via CacheConfiguration#setQueryEntities
or CacheConfiguration#setIndexedTypes
.
Just call Collection<QueryEntity> queryEntities = cache.getConfiguration(CacheConfiguration.class).getQueryEntities();
and then call QueryEntity#getFields
on the QueryEntity
of your interest.
As well you can obtain information about extracted query fields while using SqlFieldsQuery
.
FieldsQueryCursor<List<?>> cursor = cache.query(new SqlFieldsQuery(query));
for (int i = 0; i < cursor.getColumnsCount(); ++i) {
String fieldName = cursor.getFieldName(i);
// ...
}
Upvotes: 1