Giter Club home page Giter Club logo

ama's Introduction

AMA

ask me anything in Issues.

I am a student of the SiChuan university and an intern in ShangHai now.

I like to talk with others.Fate makes us meet here,isn't it?

------ [email protected]


package org.apache.geode_examples.indexes;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.ClientCache;
import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.cache.client.ClientRegionFactory;
import org.apache.geode.cache.client.ClientRegionShortcut;
import org.apache.geode.cache.query.*;
import org.apache.geode.pdx.ReflectionBasedAutoSerializer;

import java.io.Serializable;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

@NoArgsConstructor
@Data
public class Book implements Serializable {
    String name;
    Map<String, List<FlightCode>> fmap;

    public static void main(String[] args) throws NameResolutionException, TypeMismatchException, QueryInvocationTargetException, FunctionDomainException {
        Book book = new Book();
        book.setName("hah");
        LinkedList<FlightCode> flights = new LinkedList<>();
        RegionPopulator.populateFlights(50, flights);
        Map<String, List<FlightCode>> tt = new HashMap<>();
        tt.put("key1", flights);
        book.setFmap(tt);

        // connect to the locator using default port 10334
        ClientCache cache = new ClientCacheFactory().addPoolLocator("127.0.0.1", 10334)
//                .setPdxSerializer(new ReflectionBasedAutoSerializer(
//                        "org.apache.geode_examples.Passenger",
//                        "org.apache.geode_examples.indexes.Book"))
                .set("log-level", "WARN").create();

        // create a local region that matches the server region
        ClientRegionFactory<String, Book> clientRegionFactory =
                cache.createClientRegionFactory(ClientRegionShortcut.PROXY);
//        Region<String, Book> region = clientRegionFactory.create("Book");
//        region.put(book.name, book);

        SelectResults res = (SelectResults) cache.getQueryService()
                .newQuery("select * from /Book b where ELEMENT(select v from /Book a, a.fmap['key1'] v).airlineCode = 'SKW'")
//                .newQuery("select * from /Book b where b.fmap['key1'][0].airlineCode = 'SKW' ")
                .execute();

        System.out.println(res.toString());

        // ELEMENT(select DISTINCT b.fmap['key1'] from /Book b).airlineCode = 'ASQ'
        // select DISTINCT * from /Book b
        // select DISTINCT b.fmap['key1'] from /Book b
        //select * from /Book where ELEMENT(select DISTINCT b.fmap['key1'] from /Book b).airlineCode = 'ASQ'
        // select * from /Book b where ELEMENT(b.fmap['key1']).airlineCode = 'SKW'
        // select * from /Book b where b.fmap['key1'][0].airlineCode = 'SKW'
    }


}

ama's People

Contributors

785172550 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.