Code Monkey home page Code Monkey logo

java-pilosa's Introduction

Java Client for Pilosa

This repo archived Sept 2022 as part of the transition from Pilosa to FeatureBase. Please contact community[at]featurebase[dot]com with any questions.

Javadocs

Java client for Pilosa high performance distributed index.

What's New?

See: CHANGELOG

Requirements

  • JDK 7 and higher
  • Maven 3 and higher

Install

Add the following dependency in your pom.xml:

<dependencies>
    <dependency>
        <groupId>com.pilosa</groupId>
        <artifactId>pilosa-client</artifactId>
        <version>1.4.0</version>
    </dependency>
</dependencies>

Usage

Quick overview

Assuming Pilosa server is running at localhost:10101 (the default):

// Create the default client
PilosaClient client = PilosaClient.defaultClient();

// Retrieve the schema
Schema schema = client.readSchema();

// Create an Index object
Index myindex = schema.index("myindex");

// Create a Field object
Field myfield = myindex.field("myfield");

// make sure the index and field exists on the server
client.syncSchema(schema);

// Send a Set query. PilosaException is thrown if execution of the query fails.
client.query(myfield.set(5, 42));

// Send a Row query. PilosaException is thrown if execution of the query fails.
QueryResponse response = client.query(myfield.row(5));

// Get the result
QueryResult result = response.getResult();

// Act on the result
if (result != null) {
    List<Long> columns = result.getRow().getColumns();
    System.out.println("Got columns: " + columns);
}

// You can batch queries to improve throughput
response = client.query(
    myindex.batchQuery(
        myfield.row(5),
        myfield.row(10)
    )
);
for (Object r : response.getResults()) {
    // Act on the result
}

Documentation

Data Model and Queries

See: Data Model and Queries

Executing Queries

See: Server Interaction

Importing and Exporting Data

See: Importing Data

Contributing

See: CONTRIBUTING

License

See: LICENSE

java-pilosa's People

Contributors

ajnavarro avatar benbjohnson avatar codysoyland avatar dependabot[bot] avatar janstenpickle avatar jnewhouse avatar kcrodgers24 avatar tgruben avatar travisturner avatar yuce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-pilosa's Issues

Bump the release version please?

Hi team, I'm not sure what the process to request this is, but would you be able to release a new version of the client? I'm working on the project that heavily relies on aggregators. The changes to the GroupBy query clause to support filter and limit is really exciting for me to see! It makes the code so much neater and the contract looks extremely easy to work with. I'd love to see it in an official release ๐Ÿ™

groupBy does not take a filter option

Per the Pilosa documentation, GroupBy can be used with a filter option:
https://www.pilosa.com/docs/latest/query-language/#read-operations

The optional filter argument takes any type of Row query (e.g. Row, Union, Intersect, etc.) which will be intersected with each result prior to returning the count. This is analogous to a WHERE clause applied to a relational GROUP BY query.

Currently this is not supported via the Java client.
https://github.com/pilosa/java-pilosa/blob/master/com.pilosa.client/src/main/java/com/pilosa/client/orm/Index.java#L322

Everything is simply concatenated with a comma, meaning I have to convert the query to a string, add the filter=(...) string myself, then cast it back to a PqlQuery

Timestamp not set on column when using bulk importer

Client version: 1.3.3, server version: 1.3.1 and master

As per the title, it seems the timestamp isn't being set when using the bulk importer. I've tried with both epoch millis and epoch seconds, and neither seem to work.

It seems the timestamp field is getting set on the protobufs payload, but it's not getting picked up by the server. If it looks like a problem with the server I can raise there too.

Should not compare instances with ==

PqlBatchQuery :
line 116:

    public void add(PqlQuery query) {
        if (query.getIndex() != this.getIndex()) {
// Should be: if (!query.getIndex().getName().equals(this.getIndex().getName())) {
            throw new PilosaException("Query index should be the same as PqlBatchQuery index");
        }
        this.queries.add(query);
    }

Error Handling during "unready" cluster states

Hi,
First of all, I'd like to thank you for making pilosa OS and available freely.
We have been using 2.0 from master branch for a while now.

During write operations if the cluster is not in ready state is it possible to handle these without throwing exceptions? A check prior to every operation might be costly, but how about providing a subscription end point on the server side to broadcast a state like writable readable unavailable

Field options drop string keys setting when field type is time quantum.

As per the title, the java client drops the keys option when setting the field type to time quantum, despite the server supporting this setting. I'm currently using version 1.3.0 of the java client.

FieldOptions.builder().fieldTime(TimeQuantum.YEAR_MONTH_DAY_HOUR).setKeys(true).build().isKeys() == true

However the output of toString is {"options":{"timeQuantum":"YMDH","type":"time"}}.

Pilos will accept field options for time quantum with a string field when the following options are posted via curl: { "options": { "keys": true, "timeQuantum":"YMDH","type":"time" } }

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.