Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Druid Connector #1647

Closed
marktani opened this issue Jan 16, 2018 · 7 comments
Closed

Druid Connector #1647

marktani opened this issue Jan 16, 2018 · 7 comments

Comments

@marktani
Copy link
Contributor

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

@sorenbs
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
Copy link

sid88in commented Feb 14, 2018

@sorenbs this is awesome! 👍 🎉

@garyluoex
Copy link

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

@ploddi
Copy link

ploddi commented May 17, 2018

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

@itsmkj
Copy link

itsmkj commented Aug 30, 2018

This is great !!

@stale
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.

@stale stale bot added the status/stale Marked as state by the GitHub stalebot label Jan 9, 2019
@stale stale bot removed the status/stale Marked as state by the GitHub stalebot label Jan 9, 2019
@BelstrelGit
Copy link

Good day. I did not find information about connector to Druid Db. Where I can get it?
In our project we wants to get select join to PostgresQL and Druid DB like this:

SELECT postgresql.Title, druid.indicator, druid.unit, druid.value
FROM (SELECT * FROM druid_analytics LIMIT 10) AS druid
LEFT OUTER JOIN postgresql_Units AS postgresql ON (UPPER(druid.unit) = postgresql .Id);

Thanks

@janpio janpio closed this as completed Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants