Re: Geode - store and query JSON documents

2020-11-25 Thread ankit Soni
Hi Anil, Thanks a lot for your guidance. This has really helped me to
proceed.

My intended queries are working and returning projected data (as a struct).
Just wondering is there any api that does a struct --> JSON string
conversation..

-Ankit.

On Wed, Nov 25, 2020, 12:21 AM Anilkumar Gingade 
wrote:

> Ankit,
>
> Here is how to query col2.
> "SELECT d.col2 FROM /JsonRegion v, v.data d, d.col2 c where c.k21 =
> '22'";
>
> You can find example on how to query nested collections:
>
> https://geode.apache.org/docs/guide/18/getting_started/querying_quick_reference.html
>
> When you want to select a nested collection and inspect its value; you
> need to create iterator in the from clause (E.g.  d.col2 in the above query)
>
> You can find other ways to query arrays in the above sample.
>
> -Anil.
>
>
>
> On 11/23/20, 10:02 PM, "ankit Soni"  wrote:
>
> Hi Anil,
>
> Thanks a lot for your reply. This really helps to proceed. The query
> shared
> by you worked but I need a slight variation of it, i.e where clause
> contains col2 (data.col2.k21 = '22') which is array unlike col1
> (object).
>
> FYI: value is stored in cache.
> PDX[28847624, __GEMFIRE_JSON]{
> data=[PDX[28847624, __GEMFIRE_JSON] {
> col1=PDX[28626794, __GEMFIRE_JSON] {k11=aaa, k12=true, k13=,
> k14=2020-12-31T00..}
> Col2=[PDX[25385544, __GEMFIRE_JSON]{k21=, k22=true}]}]}
> Based on OQL querying doc shared, tried few ways but no luck on
> querying
> based on Col2.
>
> It will be really helpful if you share updated query.
>
> Thanks
> Ankit.
>
> On Tue, Nov 24, 2020, 2:42 AM Anilkumar Gingade 
> wrote:
>
> > Ankit,
> >
> > Here is how you can query your JSON object.
> >
> > String queryStr = "SELECT d.col1 FROM /JsonRegion v, v.data d where
> > d.col1.k11 = 'aaa'";
> >
> > As replied earlier; the data is stored as PdxInstance type in the
> cache.
> > In the PdxInstance, the data is stored as top level or nested
> collection of
> > objects/values based on input JSON object structure.
> > The query engine queries on the PdxInstance type and returns the
> value.
> >
> > To see, how the PdxInstance data looks like in the cache, you can
> print
> > the returned value from querying the region values:
> > E.g.:
> >  String queryStr = "SELECT v FROM /JsonRegion v";
> >  SelectResults results = (SelectResults)
> > QueryService().newQuery(queryStr).execute();
> >   Object[] value = results.asList().toArray();
> >   System.out.println(" Projected value: " + value[0]);
> >
> > You can find sample queries on different type of objects
> (collections,
> > etc) at:
> >
> >
> https://geode.apache.org/docs/guide/18/getting_started/querying_quick_reference.html
> >
> > Also in order to determine where the time is getting spent, can you
> > separate out object creation through JSONFormatter from put
> operation.
> > E.g.:
> > PdxInstance pdxInstance = JSONFormatter.fromJSON(jsonDoc_2);
> > // Time taken to format:
> > region.put("1", pdxInstance);
> > // Time taken to add to cache:
> >
> > And measure the time separately. It will help to see if the time is
> spent
> > in getting the PdxInstance or in doing puts. Also, can you measure
> the time
> > in avg.
> > E.g. Say time measured for puts from 1000 to 2000 and avg time for
> those
> > puts.
> >
> > -Anil.
> >
> >
> > On 11/23/20, 11:27 AM, "ankit Soni" 
> wrote:
> >
> >  Hello geode-dev,
> >
> > I am *evaluating usage of Geode (1.12) with storing JSON
> documents and
> > querying the same*. I am able to store the json records
> successfully in
> > geode but seeking guidance on how to query them.
> > More details on code and sample json is,
> >
> >
> > *Sample client-code*
> >
> > import org.apache.geode.cache.client.ClientCache;
> > import org.apache.geode.cache.client.ClientCacheFactory;
> > import org.apache.geode.cache.client.ClientRegionShortcut;
> > import org.apache.geode.pdx.JSONFormatter;
> > import org.apache.geode.pdx.PdxInstance;
> >
> > public class MyTest {
> >
> > *//NOTE: Below is truncated json, single json document can
> max
> > contain an array of col1...col30 (30 diff attributes) within
> data. *
> > public final static  String jsonDoc_2 = "{" +
> > "\"data\":[{" +
> > "\"col1\": {" +
> > "\"k11\": \"aaa\"," +
> > "\"k12\":true," +
> > "\"k13\": ," +
> > "\"k14\":
> \"2020-12-31:00:00:00\"" +
> > "}," +
> >   

[DISCUSS] Geode 1.14

2020-11-25 Thread Owen Nichols
The trigger in @Alexander’s July 28 proposal to postpone 1.14 has been met (we 
shipped 1.13).
It’s time to discuss when we want to cut the 1.14 branch.  I will volunteer as 
Release Manager.

Below are all release dates since Geode adopted a time-based release cadence.

Minor releases:
1.13   branch cut May 4 2020, 1.13.0 shipped Sep 9 2020
1.12   branch cut Feb 4 20201.12.0 shipped Mar 31 2020
1.11   branch cut Nov 4 2019   1.11.0 shipped Dec 31 2019
1.10   branch cut Aug 2 2019   1.10.0 shipped Sep 26 2019
1.9  branch cut Feb 19 2019 1.9.0 shipped Apr 24 2019
1.8  branch cut Nov 1 2018   1.8.0 shipped Dec 12 2018

Patch releases:
1.13.1shipped Nov 18 2020
1.9.2  shipped Nov 14 2019
1.9.1  shipped Sep 6 2019

I’ll toss out an initial suggestion: Let’s cut the support/1.14 branch on the 
next date in the original quarterly cadence: Feb 1 2021.

-Owen

From: Alexander Murmann 
Date: Tuesday, July 28, 2020 at 4:34 PM
To: dev@geode.apache.org 
Subject: [PROPOSAL] Postpone Geode 1.14
Hi all,

As mentioned on the previous discuss thread, I propose to hold off cutting
1.14 until we have shipped 1.13.

Once we have shipped 1.13, we should discuss when we want to cut the 1.14
release. The actual ship date for Geode 1.13 is important information for
that conversation. Thus we cannot have that conversation before then.


Re: [DISCUSS] Geode 1.14

2020-11-25 Thread Jens Deppe
Hi Owen,

Thanks for starting this conversation and especially for volunteering as 
Release Manager!

Since we're already a couple of quarters 'behind', in terms of releases, I'd 
prefer cutting the 1.14 branch ASAP. Leaving it until Feb means we'll have 9 
months of changes to stabilize. How long might that take to finally get 
shipped? (rhetorical).

--Jens

On 11/25/20, 6:05 PM, "Owen Nichols"  wrote:

The trigger in @Alexander’s July 28 proposal to postpone 1.14 has been met 
(we shipped 1.13).
It’s time to discuss when we want to cut the 1.14 branch.  I will volunteer 
as Release Manager.

Below are all release dates since Geode adopted a time-based release 
cadence.

Minor releases:
1.13   branch cut May 4 2020, 1.13.0 shipped Sep 9 2020
1.12   branch cut Feb 4 20201.12.0 shipped Mar 31 2020
1.11   branch cut Nov 4 2019   1.11.0 shipped Dec 31 2019
1.10   branch cut Aug 2 2019   1.10.0 shipped Sep 26 2019
1.9  branch cut Feb 19 2019 1.9.0 shipped Apr 24 2019
1.8  branch cut Nov 1 2018   1.8.0 shipped Dec 12 2018

Patch releases:
1.13.1shipped Nov 18 2020
1.9.2  shipped Nov 14 2019
1.9.1  shipped Sep 6 2019

I’ll toss out an initial suggestion: Let’s cut the support/1.14 branch on 
the next date in the original quarterly cadence: Feb 1 2021.

-Owen

From: Alexander Murmann 
Date: Tuesday, July 28, 2020 at 4:34 PM
To: dev@geode.apache.org 
Subject: [PROPOSAL] Postpone Geode 1.14
Hi all,

As mentioned on the previous discuss thread, I propose to hold off cutting
1.14 until we have shipped 1.13.

Once we have shipped 1.13, we should discuss when we want to cut the 1.14
release. The actual ship date for Geode 1.13 is important information for
that conversation. Thus we cannot have that conversation before then.