Any luck with my query? What am i missing? Why REST response is blank though the cache has data, i tried scan on visor i can see the data over there.
Thanks, Anji. On 19 Sep 2017 00:26, "ANJANEYA PRASAD NIDUBROLU" <[email protected]> wrote: > Hello All, > > Hope you are doing great!. > > I have tried Ignite's REST API via postman. It is not throwing any errors, > but the response json's value part has nothing in it. > > Here I am pasting cache config (piece of xml file), bean class and main > class where I am saving the sparkRDD to cache. Also, the attached document > has REST requests and responses along with respective logs. > > As the Spark RDD/ DF I am using has more columns, i have created scala > bean class so that I can save it on to IgniteCache as Key, Value. > > Ignite server and clients are able to talk to each other. Cache is created > and loaded successfully. > So far so good, trouble started when I am trying to trigger from REST API > (the attached notepad has REST APIs i tried to test and their response). > > 1) Though the Bean class I created has 8 columns - the cache created has > only 7 columns, what happened to final one? [even "*cache -c=<> -scan*" > command from "*visor*" results has 7 columns.] > 2) The REST API responses says it is success but the response json's value > part is empty. > > Not sure what went wrong. Happy to provide more details if required. > Many Thanks, > Anji. > > *ignite-config.xml* > > <property name="cacheConfiguration"> > <list> > <!-- College Cache --> > <bean class="org.apache.ignite.configuration.CacheConfiguration"> > <property name="name" value="CollegeCache"/> > <property name="backups" value="1"/> > <property name="atomicityMode" value="ATOMIC"/> > <property name="cacheMode" value="PARTITIONED"/> > <property name="queryEntities"> > <list> > <bean class="org.apache.ignite.cache.QueryEntity"> > <!-- Key Type --> > <property name="keyType" value="java.lang.String"/> > <!-- Value Type --> > <property name="valueType" value="org.anjaneya.prasad.loadbean.College"/> > <!-- value="java.lang.String"/> --> > <!-- Fields to be used from SQL --> > <property name="fields"> > <map> > <!--<entry key="values" value="java.lang.String"/> --> > <entry key="register_number" value="java.lang.String"/> > <entry key="current_city" value="java.lang.String"/> > <entry key="date2" value="java.lang.String"/> > <entry key="date_of_birth" value="java.lang.String"/> > <entry key="student_code" value="java.lang.String"/> > <entry key="native_city" value="java.lang.String"/> > <entry key="college_end_date_1" value="java.lang.String"/> > <entry key="college_start_date_1" value="java.lang.String"/> > </map> > </property> > > <!-- Assign an unique name for the key to access it from SQL easily. --> > <!-- <property name="keyFieldName" value="register_number"/> --> > <property name="tableName" value="CollegeTab"/> > > <!-- Defining indexed fields.--> > <property name="indexes"> > <list> > <!-- Single field (aka. column) index --> > <bean class="org.apache.ignite.cache.QueryIndex"> > <constructor-arg value="register_number"/> > </bean> > > <!-- Single field (aka. column) index > <bean class="org.apache.ignite.cache.QueryIndex"> > <constructor-arg value="native_city"/> > </bean> > <bean class="org.apache.ignite.cache.QueryIndex"> > <constructor-arg value="current_city"/> > </bean> > --> > > </list> > </property> > </bean> > </list> > </property> > </bean> > </list> > </property> > > ===================================================== > *College.scala* > > package org.anjaneya.prasad.loadbean > import scala.beans.BeanProperty > > class College(@BeanProperty register_number :String, > @BeanProperty current_city: String, > @BeanProperty date2: String, > @BeanProperty date_of_birth: String, > @BeanProperty student_code: String, > @BeanProperty native_city: String, > @BeanProperty college_end_date_1: String, > @BeanProperty college_start_date_1: String > ) extends Serializable{ > override def toString: String = s"College: $register_number, > $current_city, $date2, $date_of_birth, $student_code, $native_city, > $college_end_date_1, college_start_date_1" > > //return format("%s, %s, %s, %s, %s, %s, %s, %s", register_number , > native_city , current_city , student_code, college_end_date_1, > date_of_birth, date2) > } > > > ======================================================== > *MainProcess.scala* > > val ic = new IgniteContext(sc, > "/home/ops/College/src/main/resources/ignite-config.xml", > true) > > var sharedRDDCollege: IgniteRDD[String, College] = > ic.fromCache("CollegeCache") > //sharedRDDCollege.collect().foreach(print) > > var CollegeCache = test2.rdd.map(x => (x.getString(0), > new College(x.getString(0) , x.getString(1) , x.getString(2) , > x.getString(3) , x.getString(4) , x.getString(5) , x.getString(6) , > x.getString(7)))) > > //CollegeCache.collect.foreach(print) > sharedRDDCollege.savePairs(CollegeCache) > > >>
