Giter Club home page Giter Club logo

druid-java-client's Introduction

druid在这里是一个实时的查询和分析系统,特别适合按照时间进行聚合查询的场景。但是druid的api当前版本只能使用http请求。在使用上不是很方便,本项目对相关的请求接口做了进一步的封装,底层还是使用http请求durid的api.

使用例子:

// datasource查询
public void testDatasourceQuery() {
        MetadataQuery dataSourceMetadataQuery = new MetadataQuery();
        dataSourceMetadataQuery.querySegment().setDataSource("member-consume-statics-test");
        DruidClient druidClient = new DruidClient("http://10.10.50.225:8082");
        DruidResponse aa = druidClient.execute(dataSourceMetadataQuery);
        System.out.println(aa);
    }

 // timeSeries查询:查询商户
    @Test
    public void testTimeSeriesQuery() {
        TimeseriesQuery timeseriesQuery = new TimeseriesQuery();
        timeseriesQuery.setDataSource("member-consume-statics-test");
        timeseriesQuery.setGranularity(GranularityEnum.ALL.getValue());
        timeseriesQuery.setIntervals("2018-02-26T00:00:00+08:00/2018-02-26T23:59:59+08:00");
        timeseriesQuery.setFilter(new AndFilter().add(new SelectorFilter().dimension("memberId").value("45642442"))
                        .add(new NotFilter().field(new SelectorFilter().dimension("payChannel").value("6"))));
        timeseriesQuery.setAggregations(new Aggregator[] {new SumAggregator("orderNum").fieldName("count").longSum(), new SumAggregator("paySum")
                        .fieldName("payFee").longSum(), new CardinalityAggregator("membercount").fields("memberId")});
        DruidClient druidClient = new DruidClient("http://10.10.50.225:8082");
        DruidResponse aa = druidClient.execute(timeseriesQuery);
        System.out.println(aa);
    }

官方文档请参照:http://druid.io/docs/latest/design/

druid-java-client's People

Contributors

linxdeng avatar

Stargazers

 avatar nc_mouse avatar  avatar

Watchers

 avatar

Forkers

jauadoc

druid-java-client's Issues

关于封装json后转换成json字符串方法的问题

看到你源码中XxxSelect最终都是通过getJson方法转换
而转换中的实现都是通过拼接字符串的方式
想咨询下,如果改成供jackson或者fastjson自动转换会有什么问题没?
因为本人也在做这个,所以请教下,是否这样写是为了规避某些风险/坑,还是只是个人风格。

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.