Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 893A3200D0C for ; Wed, 20 Sep 2017 21:28:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 878D11609E2; Wed, 20 Sep 2017 19:28:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 238F91609D8 for ; Wed, 20 Sep 2017 21:28:11 +0200 (CEST) Received: (qmail 81699 invoked by uid 500); 20 Sep 2017 19:28:11 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 81689 invoked by uid 99); 20 Sep 2017 19:28:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Sep 2017 19:28:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id A45A41A3F17 for ; Wed, 20 Sep 2017 19:28:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 75Di5veTk48p for ; Wed, 20 Sep 2017 19:28:08 +0000 (UTC) Received: from mail-qk0-f181.google.com (mail-qk0-f181.google.com [209.85.220.181]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 255A261116 for ; Wed, 20 Sep 2017 19:28:08 +0000 (UTC) Received: by mail-qk0-f181.google.com with SMTP id j5so3783185qkd.0 for ; Wed, 20 Sep 2017 12:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=wIFuQo1w11obHIjwjiThAki9A9C5VHSyRK9PLN187z0=; b=BAA7nLLN2gdoW59DnBoWzY8gN341MyPXlgOnmSdaaKqXhaOsqGP/p5QcnPQJsFis3V /2W34uTuCt//WZamdgsiPVlgJjxewLyOeycv50ZyXjWiEihHVDfjpeNDcHlWkdDdxzn3 2ZQ1UN453kjLv3xy4hXw1w9Zfq1Yv8N48KHcRyzwzXzFCgetrsL2Be/W4x6leJq+bXHk hyuiyDWbs6cqn8T4Kvt0dL53l/JMJYvW5lNlqCZwalaespn+EhiOBXi5WPvC1w7OgTUC Qx24w56lP5bXbq59e5EB6z9J9d63Tz+VdROoOMxWVBtnYIhfQZZvWjwADAp2FbvECIcQ FAKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=wIFuQo1w11obHIjwjiThAki9A9C5VHSyRK9PLN187z0=; b=lptKbRwASCKVMyRQ7CmdyOyZr6rIwWHCsMqkJt6+J2pQMfLTei50RbXN17xw3GOOI7 ie6U621pnfnx1NBwbAM8vMksb4hakYVLT9pYE3p1eKGaB5f5SjBaFzwlbYvsQk3KewXs wFAIECQOO6yiQP12HKTHO27EhA7T5pg2lU31zWeO4rlwzq+M7VA8Tf2/OBlLp0s2jZ3i EAEzmeLiOhY0ZH5wkuz56IeUcylb/gJa0HmEmx5OrCuHxlm0MmxdhRK8dG3V9netrtZO UwAdcUV2PpZGQlk/1OOSlpNhp4rTVdGYNt0iYlPMFm1o4WfkgYtNYqJQT9Nq2sxdm120 pU4A== X-Gm-Message-State: AHPjjUgGCO8431T5DtWb8iARkh2hF6+NXLLUH55KJR5uhgIa3hGvuweu hgV/24VnB7qe2kxQNBk5eQCxSBB6vr8Fmr6j3alKxw== X-Google-Smtp-Source: AOwi7QC5yJiGflpRJjpliFcSPGju+ctBdIBNFjFtM8uqq2/+nsMRkTcBq/CxfWrVol3pmetW+5sgZLCp8F/fP+NDK+w= X-Received: by 10.55.157.195 with SMTP id g186mr8290134qke.347.1505935687550; Wed, 20 Sep 2017 12:28:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.57.196 with HTTP; Wed, 20 Sep 2017 12:28:07 -0700 (PDT) In-Reply-To: References: From: ANJANEYA PRASAD NIDUBROLU Date: Thu, 21 Sep 2017 00:58:07 +0530 Message-ID: Subject: Re: REST API response json is empty. To: user@ignite.apache.org Content-Type: multipart/alternative; boundary="001a114d8ad0b60b210559a3f98e" archived-at: Wed, 20 Sep 2017 19:28:13 -0000 --001a114d8ad0b60b210559a3f98e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello Denis, Many thanks. Its working now and it solved both the problems. Thanks, Anji. On Wed, Sep 20, 2017 at 4:41 PM, Denis Mekhanikov wrote: > Hi Anji! > > Parameters of constructor of College class are not marked with val > keyword, so @BeanProperty annotations have no effect. > > Adding val keyword before every constructor parameter should solve your > second problem. > > Denis > > =D1=81=D1=80, 20 =D1=81=D0=B5=D0=BD=D1=82. 2017 =D0=B3. =D0=B2 6:37, ANJA= NEYA PRASAD NIDUBROLU < > anjaneya4u@gmail.com>: > >> 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" >> 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 docum= ent >>> 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 respo= nse). >>> >>> 1) Though the Bean class I created has 8 columns - the cache created ha= s >>> only 7 columns, what happened to final one? [even "*cache -c=3D<> -sca= n*" >>> 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* >>> >>> >>> >>> >>> >> CacheConfiguration"> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> *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 =3D 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) >>> } >>> >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D >>> *MainProcess.scala* >>> >>> val ic =3D new IgniteContext(sc, "/home/ops/College/src/main/resources/= ignite-config.xml", >>> true) >>> >>> var sharedRDDCollege: IgniteRDD[String, College] =3D >>> ic.fromCache("CollegeCache") >>> //sharedRDDCollege.collect().foreach(print) >>> >>> var CollegeCache =3D test2.rdd.map(x =3D> (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) >>> >>> >>>> --001a114d8ad0b60b210559a3f98e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello Denis,

Many thanks. Its working n= ow and it solved both the problems.

Thanks,
<= div>Anji.

On Wed, Sep 20, 2017 at 4:41 PM, Denis Mekhanikov <= ;dmekhanikov@gma= il.com> wrote:
Hi=C2=A0Anji!

Parameters of=C2=A0constructor of College class are not ma= rked with val keyword, so @BeanProperty annotations have no effect.

Adding val keyword before every constructor parameter sho= uld solve your second problem.

Denis
=D1=81=D1=80, 20 =D1=81=D0=B5= =D0=BD=D1=82. 2017 =D0=B3. =D0=B2 6:37, ANJANEYA PRASAD NIDUBROLU <anjaneya4u@gmail.com>:

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 o= ver there.

Thanks,
Anji.

On 19 Sep 2017 00:26, "ANJANEYA PRASAD NIDU= BROLU" <a= njaneya4u@gmail.com> 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 sparkR= DD to cache. Also, the attached document has REST requests and responses al= ong with respective logs.

As the Spark RDD/ DF I a= m using has more columns, i have created scala bean class so that I can sav= e it on to IgniteCache as Key, Value.

Ignite serve= r and clients are able to talk to each other. Cache is created and loaded s= uccessfully.
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 a= nd their response).

1) Though the Bean class I cre= ated has 8 columns - the cache created has only 7 columns, what happened to= final one? =C2=A0[even "cache = -c=3D<> -scan" command from "visor" = results has 7 columns.]
2) The REST API responses says it is succ= ess 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=3D"cacheConfiguration">
=C2=A0 =C2=A0 <list>
=C2=A0 =C2=A0 =C2=A0 =C2=A0= <!-- College Cache -->
=C2=A0 =C2=A0 =C2=A0 =C2=A0 <bean class=3D"org.apache.ignit= e.configuration.CacheConfiguration">
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = <property name=3D"name" value=3D"CollegeCache"/><= /font>
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 <property name=3D"backups" value=3D"= 1"/>
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <property name=3D"atomicityMode&= quot; value=3D"ATOMIC"/>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <property name= =3D"cacheMode" value=3D"PARTITIONED"/>
<= div> =C2=A0 =C2=A0 <property name=3D"queryEntities">
<list>
=C2=A0 =C2=A0 = =C2=A0 =C2=A0=C2=A0 <bean cl= ass=3D"org.apache.ignite.cache.QueryEntity">
=
<!-- Key Type -->
<pro= perty name=3D"keyType" value=3D"java.lang.String"/><= /font>
<!-- Value Type -->
= <property name=3D"valueType" value=3D"org.anjaneya= .prasad.loadbean.College"/> <!-- value=3D"java.lang.St= ring"/> -->
<!-- Fields to be use= d from SQL -->
<property name=3D"fie= lds">
<map>
= <!--<entry key=3D"values" value=3D"java.lang= .String"/> -->
<entry key=3D&qu= ot;register_number" =C2=A0 =C2=A0 =C2=A0 =C2=A0 value=3D"java.lan= g.String"/>
<entry key=3D"cur= rent_city" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0value=3D"java= .lang.String"/>
<entry key=3D"= ;date2" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= value=3D"java.lang.String"/>
&l= t;entry key=3D"date_of_birth" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = value=3D"java.lang.String"/>
<= ;entry key=3D"student_code" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0value=3D"java.lang.String"/>
<entry key=3D"native_city" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 value=3D"java.lang.String"/>
= <entry key=3D"college_end_date_1" =C2=A0 =C2=A0 =C2=A0= value=3D"java.lang.String"/>
<= ;entry key=3D"college_start_date_1" =C2=A0 =C2=A0value=3D"ja= va.lang.String"/>
</map><= /div>
</property>

= <!-- Assign an unique = name for the key to access it from SQL easily. -->
= <!-- <property name=3D"keyFieldName" value=3D"r= egister_number"/> -->
<property n= ame=3D"tableName" value=3D"CollegeTab"/>

<!-- Defining indexed fields.-->
<pro= perty name=3D"indexes">
<list&= gt;
<!-- Single field (aka. column) index = -->
<bean class=3D"org.apache.igni= te.cache.QueryIndex">
<const= ructor-arg value=3D"register_number"/>
= </bean>
<= br>
<!-- Single field (aka. column) index= =C2=A0
<bean class=3D"org.apache.igni= te.cache.QueryIndex">
<const= ructor-arg value=3D"native_city"/>
</bean>
<bean class=3D"org.a= pache.ignite.cache.QueryIndex">
<constructor-arg value=3D"current_city"/>
= </bean>
-->

</list>
</property>
<= div> </bean>
</list><= /div>
</property>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </bean>
=C2=A0 =C2=A0 </list>
</property> <= /span>

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D
<= b>College.scala

package org.anjaney= a.prasad.loadbean
import scal= a.beans.BeanProperty
<= br>
class College(@Bea= nProperty register_number :String,=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 @BeanPr= operty current_city: String,=C2=A0
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 @BeanProperty= date2: String,=C2=A0
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 @BeanProperty date_of_birt= h: String,
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 @BeanProperty student_code: String,= =C2=A0
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 @BeanProperty native_city: String,
=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 @BeanProperty college_end_date_1: String,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 @BeanProperty college_start_date_1: String
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0) extends Serializable{
=C2=A0 override def toString: String =3D s"College: $re= gister_number, $current_city, $date2, $date_of_birth, $student_code, $nativ= e_city, =C2=A0$college_end_date_1, college_start_date_1"=C2=A0<= /div>

//return format("%s, %s, %s, %s, %s, %s, = %s, %s", register_number , native_city , current_city , student_code, = =C2=A0 =C2=A0college_end_date_1, =C2=A0date_of_birth, =C2=A0date2)
}

<= div>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
MainProcess.scal= a

val ic =3D new IgniteContext(sc, "/home/ops/College/src/main/re= sources/ignite-config.xml", true)

var sharedRDDCollege: IgniteRDD[String, College] =3D ic.fromCache("= ;CollegeCache")
/= /sharedRDDCollege.collect().foreach(print)

var CollegeCache =3D test2.rdd.map(x =3D> (x.getString(0),
=C2=A0 =C2=A0 =C2=A0 =C2= =A0new College(x.getString(0) , x.getString(1) , x.getString(2) , x.getStri= ng(3) , x.getString(4) , x.getString(5) , x.getString(6) , x.getString(7)))= )

//CollegeCache.collect.foreach(p= rint)
sharedRDDCollege= .savePairs(CollegeCache)



--001a114d8ad0b60b210559a3f98e--