Reputation: 5636
Similar question is asked here. However in this question I have tried to include more details and executable code if needed. Also here I am executing this code via Zeppelin.
Here is the code snippets from Zeppelin notebooks:
Notebook-1 - stores some data to ignite cache.
val ic = new IgniteContext(sc, () => new IgniteConfiguration())
val cacheConfig = new CacheConfiguration[Int, Int]()
cacheConfig.setName("test")
cacheConfig.setIndexedTypes(classOf[Int], classOf[Int])
val cacheRdd = ic.fromCache[Int,Int](cacheConfig)
cacheRdd.savePairs(sc.parallelize(1 to 10000, 10).map(i => (i, i)))
part - 2: Reading from the cache where we stored some data from notebook-1.
val ic = new IgniteContext(sc, () => new IgniteConfiguration())
val cacheConfig = new CacheConfiguration[Int, Int]()
cacheConfig.setName("partitioned")
cacheConfig.setIndexedTypes(classOf[Int], classOf[Int])
val ic = new IgniteContext(sc, () => new IgniteConfiguration())
val cacheRdd = ic.fromCache(cacheConfig)
cacheRdd.sql("select _val from Integer")
Code from first notebook is executed fine. However while executing second notebook it is failing with exception mentioned in header.
Full exception:
javax.cache.CacheException: Indexing is disabled for cache: test. Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.
at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.validate(IgniteCacheProxy.java:831)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:690)
at org.apache.ignite.spark.IgniteRDD.sql(IgniteRDD.scala:147)
... 64 elided
Upvotes: 2
Views: 441
Reputation: 4637
Perhaps you should try same above code with creating a new cache. I think its referring to some old cache configuration with which the cache was initially created. Or destroy the cache and try recreating it with the same name and above mentioned configuration.
Upvotes: 2