Re: Inconsistency reading cache from code and via REST?

2018-05-09 Thread aealexsandrov
Hi,

qryexe doesn't work correct. At some reason it ignores _key and _value in
2.4. You can use qryfldexe as it was describe here:

http://apache-ignite-users.70518.x6.nabble.com/Example-of-SQL-query-td21427.html

BR,
Andrei





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Inconsistency reading cache from code and via REST?

2018-05-02 Thread michael
Hi 

revisiting this now I am actually connecting to a data source and filling
the cache with data:

For simplicity the attached code 
cacheTableTest.java
 
 
only gets an update of a single string key value pair when in reality there
will be 100s of updates. I'm aware that creating the table MyData multiple
times will fail again this is so the code is a bit neater.

My problem is I am still unclear how to get data from a REST call. In
particular, whether I need the data in a cache or in a table, so the example
shows populating both.

A simple "get" by key works:
http://127.0.0.1:8080/ignite?cmd=get=MyCache="key123;

{"successStatus":0,"affinityNodeId":"05f313de-6f41-47bb-856a-03a32a0fe467","error":null,"response":"value123","sessionToken":null}

but my guess on the cache:
http://127.0.0.1:8080/ignite?cmd=qryexe=MyCache=1=String=key123=_key%20%3D%20%3F

fails:
{"successStatus":1,"error":"class org.apache.ignite.IgniteException:
null","response":null,"sessionToken":null}

and I dont understand how to query the table

thanks
Michael






--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Inconsistency reading cache from code and via REST?

2018-04-24 Thread michael
ok that's great; wasn't too clear from the docs that I needed the
addQueryField



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Inconsistency reading cache from code and via REST?

2018-04-23 Thread aealexsandrov
Also I will check why it's not working in next case:

CacheConfiguration cfg = new
CacheConfiguration<>();

cfg.setIndexedTypes(String.class, String.class);
cfg.setName(CACHE_NAME);

IgniteCache cache = ignite.getOrCreateCache(cfg)

and 

http://127.0.0.1:8080/ignite?cmd=qryexe=StartNode=1=String=2=_key%20%3D%20%3F

Andrei



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Inconsistency reading cache from code and via REST?

2018-04-23 Thread aealexsandrov
Hi Michael,

You are trying to work with sql queries. Let me provide to you the example
how you can do it:

1) Start ingnite server node
2) Start ignite client node that will create the cache and put some values:

StartNode.java
  

3)Run next command:

http://127.0.0.1:8080/ignite?cmd=qryexe=Value=1=mycache=15=key%20%3D%20%3F

Here "key%20%3D%20%3F" is "key = ?"

where ? is a value from arg1.

It's not working without arg1_argN: e.g  key = 1. Looks like it depends of
parsing process. I will check.

The result should be like next:

{"successStatus":0,"error":null,"sessionToken":null,"response":{"items":[{"key":{"key":15},"value":{"value":"Value
15"}}],"last":true,"queryId":0,"fieldsMetadata":[]}}

All components of this query should be described here:

https://apacheignite.readme.io/docs/rest-api#section-sql-query-execute

Thank you,
Andrei



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Inconsistency reading cache from code and via REST?

2018-04-23 Thread michael
Following on from his example of a simple cache with key value pairs (now
strings! IgniteCache), how would I create a sql query on the
data:

http://127.0.0.1:8080/ignite?cmd=qryexe=GridCacheTest=1=String=_key+%3D+1

gives:
{"successStatus":1,"error":"class org.apache.ignite.IgniteException:
null","sessionToken":null,"response":null}

Does this only make sense if the value is a complex type/structure


Similarly how would I do a qryfldexe to see all values



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Inconsistency reading cache from code and via REST?

2018-04-20 Thread michael
Hi Andrei

I simpler workaround for me for now is just to have keys a strings so REST

A few toString() tweaks to the sample code to put/get as strings instead of
integers shows this now works as expected both checking the cache in code
and from a browser.

thanks
Michael





--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Inconsistency reading cache from code and via REST?

2018-04-19 Thread aealexsandrov
Hi Michael,

I reproduced your problem. It's a known issue. Please take a look at this
responce to find the workaround:

http://apache-ignite-users.70518.x6.nabble.com/How-to-use-rest-api-to-put-an-object-into-cache-td5897.html#a5955

Looks like this problem will be solved for basic types at next releases: 

https://issues.apache.org/jira/browse/IGNITE-3345 

Best regards,
Andrei



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Inconsistency reading cache from code and via REST?

2018-04-19 Thread michael
Hi Andrei


1. Ignite version is 2.3.0
2. xml config -  attached.  Actually example-ignite.xml and imported
resource example-default.xml.
N.B. this is the deafult xml I got from install but with
peerClassLoadingEnabled set to true since I was also testing the broadcast
functionality.
3. GridCacheTest.java - attached. As I mentioned, pretty much as the
included example code with some additions:
- added some compute broadcast to test that functionality and also check
that the nodes can see each other
- cache.size() and cache.get(100) to check that the key/value (100,101)
added via REST from the browser gets added. When I do add an item using
REST, cache.size reports 21 but cache.get(100) gives null.

thank you

Michael

GridCacheTest.java
  
example-default.xml
 
 
example-ignite.xml
  



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/


Re: Inconsistency reading cache from code and via REST?

2018-04-18 Thread aealexsandrov
Hi Michail,

Could you please provide next information:

1)Ignite version
2)your ignite xml config
3)your reproducer (GridCacheTest). Looks like it wasn't attached.

Also if you are using Ignite 2.4 then do you add your servers to baseline
topology using control.sh before cluster activation?

Thank you,
Andrei



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/