This message was deleted.
# general
s
This message was deleted.
s
I have not used this contributor extension, but what I'm understanding is that it is meant to continuously run to maintain the view as data is loaded into its base data source. You need to query it using a
"queryType": "view"
. What is your expectation?
j
My expectation is to create a materialized view based on a data source that I already have loaded in druid, then I want to consult certain data from that source where I use lookups and convert that query into a materialized view, with the fields that I am going to need, that is my goal
s
Have you tried querying it with
"queryType":"view"
? then maybe loading more data into the base table and re-query to see the effect of the RUNNING supervisor?
j
I will try what you tell me
l run this
curl -H 'Content-Type:application/json' -d @my_view_query_sql.json http://<host>:<port>/druid/v2
where my query.json is:
Copy code
{
  "queryType": "view",
  "query": {
    "queryType": "sql",
    "dataSource": "sales",
    "intervals": [
      "2022-09-12/2023-09-13"
    ],
    "query": "SELECT country, SUM(sales) AS total FROM sales GROUP BY country ORDER BY total DESC LIMIT 10"
  }
}
I'm having this error: `{"error":"Unknown exception","errorMessage":"Please make sure to load all the necessary extensions and jars with type 'view' on 'druid/router' service. Could not resolve type id 'view' as a subtype of
org.apache.druid.query.Query
known type ids = [dataSourceMetadata, groupBy, scan, search, segmentMetadata, select, timeBoundary, timeseries, topN, windowOperator]\n at [Source:`
and verify that I have the extensions loaded correctly, I don't know what other configuration I am missing.
s
I don't think if this extension supports SQL queries. I think you'll need to use the JSON payload as described in the example. Notice that the note on the "query" field says "query must be groupBy, topN, or timeseries type."
j
change the query.json file like this:
Copy code
{
  "queryType": "view",
  "query": {
    "queryType": "groupBy",
    "dataSource": "ventas",
    "granularity": "all",
    "dimensions": [
      "AREA"
    ],
    "limitSpec": {
      "type": "default",
      "limit": 1,
      "columns": [
        {
          "dimension": "tickets",
          "direction": "descending",
          "dimensionOrder": "numeric"
        }
      ]
    },
    "aggregations": [
      {
        "type": "longSum",
        "name": "tickets",
        "fieldName": "tickets"
      }
    ],
    "intervals": [
      "2020-09-12/2023-09-13"
    ]
  }
}
and I have the same error: `{"error":"Unknown exception","errorMessage":"Please make sure to load all the necessary extensions and jars with type 'view' on 'druid/router' service. Could not resolve type id 'view' as a subtype of
org.apache.druid.query.Query
known type ids = [dataSourceMetadata, groupBy, scan, search, segmentMetadata, select, timeBoundary, timeseries, topN, windowOperator]\n at [Source: (org.eclipse.jetty.server.HttpInputOverHTTP); line: 1, column: 25]","errorClass":"com.fasterxml.jackson.databind.exc.InvalidTypeIdException","host":null}`
s
Oh… given that it is a contrib extension, the jars are not pre-loaded. Here’s some info on how to do that https://druid.apache.org/docs/latest/operations/pull-deps.html
👀 1