Hi DmitryB, Could you please provide the full class name of "List"? Is it java.util.List or some Scala collection? Can you try putting java.util.ArrayList and see if it works?
Vladimir. On Fri, Mar 4, 2016 at 6:59 AM, DmitryB <ifi...@yandex.ru> wrote: > Hi team, > > I found that fields with collection type are not properly handled by sql > query; > > here is my code: > > import annotation.meta.field > import org.apache.ignite.cache.query.annotations.QuerySqlField > > case class TRow1( > @(QuerySqlField @field)(index = true) strP: String, > @(QuerySqlField @field)(index = true) intP: Int, > @(QuerySqlField @field)(index = true) doubleP: Double, > @(QuerySqlField @field)(index = false) listP: List[String] > ) extends Serializable {} > > // gen test data > val rdd = sc.parallelize(1 to 10).map(x => TRow1("str-"+x, x, x*10, (1 to > x).map(x => "val-" + x).toList )) > val pair_rdd = rdd.map(r => (r.intP, r)) > > // prep cache > val igniteContext = new IgniteContext[Int, TRow1](sc, () => new > IgniteConfiguration().setPeerClassLoadingEnabled(true), false) > val cacheCfg = new CacheConfiguration[Int, TRow1]() > cacheCfg.setName("cache01") > cacheCfg.setIndexedTypes(classOf[Int], classOf[TRow1]) > val cache = igniteContext.fromCache(cacheCfg) > >> res6: org.apache.ignite.spark.IgniteRDD[Int,sandbox.TRow1] = > IgniteRDD[4] > >> at RDD at IgniteAbstractRDD.scala:27 > > // get results > scala> val count = cache.count > count: Long = 10 > > scala> cache.take(1) > res5: Array[(Int, sandbox.TRow1)] = > Array((1,TRow1(str-1,1,10.0,List(val-1)))) > > *scala> val result = cache.sql("select strP, intP, doubleP, listP from > TRow1").take(1) > result: Array[org.apache.spark.sql.Row] = Array([str-1,1,10.0,[]])* > > *So, field with collection type (List) is not returned back by sql query * > > > > > > > > -- > View this message in context: > http://apache-ignite-users.70518.x6.nabble.com/QuerySqlField-for-collections-tp3364.html > Sent from the Apache Ignite Users mailing list archive at Nabble.com. >