New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Druid Connector #1647

Open
marktani opened this Issue Jan 16, 2018 · 6 comments

Comments

Projects
None yet
8 participants
@marktani
Copy link
Contributor

marktani commented Jan 16, 2018

This feature requests serves as a central place to discuss development and progress for the Druid connector.

@sorenbs

This comment has been minimized.

Copy link
Member

sorenbs commented Feb 14, 2018

Here's an example query and how it could translate to GraphQL:

Druid

query

{
  "queryType": "timeseries",
  "dataSource": "sample_datasource",
  "granularity": "day",
  "descending": "true",
  "filter": {
    "type": "and",
    "fields": [
      { "type": "selector", "dimension": "sample_dimension1", "value": "sample_value1" },
      { "type": "or",
        "fields": [
          { "type": "selector", "dimension": "sample_dimension2", "value": "sample_value2" },
          { "type": "selector", "dimension": "sample_dimension3", "value": "sample_value3" }
        ]
      }
    ]
  },
  "aggregations": [
    { "type": "longSum", "name": "sample_name1", "fieldName": "sample_fieldName1" },
    { "type": "doubleSum", "name": "sample_name2", "fieldName": "sample_fieldName2" }
  ],
  "postAggregations": [
    { "type": "arithmetic",
      "name": "sample_divide",
      "fn": "/",
      "fields": [
        { "type": "fieldAccess", "name": "postAgg__sample_name1", "fieldName": "sample_name1" },
        { "type": "fieldAccess", "name": "postAgg__sample_name2", "fieldName": "sample_name2" }
      ]
    }
  ],
  "intervals": [ "2012-01-01T00:00:00.000/2012-01-03T00:00:00.000" ]
}

result

[
  {
    "timestamp": "2012-01-01T00:00:00.000Z",
    "result": { "sample_name1": "<some_value>", "sample_name2": "<some_value>", "sample_divide": "<some_value>" } 
  },
  {
    "timestamp": "2012-01-02T00:00:00.000Z",
    "result": { "sample_name1": "<some_value>", "sample_name2": "<some_value>", "sample_divide": "<some_value>" }
  }
]

GraphQL

query

{
  timeseries {
    sample_datasource(
      granularity: "day" # enum: all, none, second, minute, fifteen_minute, thirty_minute, hour, day, week, month, quarter, year
      descending: true
      filter: {
        sample_dimension1: "sample_value1"
        OR: {
          sample_dimension2: "sample_value2"
          sample_dimension3: "sample_value3"
        }
      }
      "intervals": [ "2012-01-01T00:00:00.000/2012-01-03T00:00:00.000" ]) {
        timestamp
        aggregations {
          sample_name1: longSum {
            sample_fieldname1
          }
          sample_name2: doubleSum {
            sample_fieldname2
          }
        }
        postAggregations {
          sample_divide: arithmetic(fn: "/", fields: [])
        }
    }
  }
}

result

{
  "timeseries": [
    {
      "timestamp": "2012-01-01T00:00:00.000Z"
      "aggregations" {
        "sample_name1": { "sample_name1": "<some_value>", "sample_name2": "<some_value>" }
      },
      "postAggregations": {
        "sample_divide": "<some_value>"
      }
    },
    {
      "timestamp": "2012-01-02T00:00:00.000Z"
      "aggregations" {
        "sample_name1": { "sample_name1": "<some_value>", "sample_name2": "<some_value>" }
      },
      "postAggregations": {
        "sample_divide": "<some_value>"
      }
    }
  ]
}

One thing to note is that Druid doesn't preserve the structure of the query in the output, and GraphQL does. I think this is an advantage of GraphQL, but it does make the output more verbose.

@sid88in

This comment has been minimized.

Copy link

sid88in commented Feb 14, 2018

@sorenbs this is awesome! 👍 🎉

@garyluoex

This comment has been minimized.

Copy link

garyluoex commented Apr 9, 2018

I second the awesome! Would love to help push this idea forward =)

@ploddi

This comment has been minimized.

Copy link

ploddi commented May 17, 2018

Absence of input union types support can introduce issues with highly polymorphic Druid query API.
facebook/graphql#114

@itsmkj

This comment has been minimized.

Copy link

itsmkj commented Aug 30, 2018

This is great !!

@stale

This comment has been minimized.

Copy link

stale bot commented Jan 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment