allegro / turnilo

Business intelligence, data exploration and visualization web application for Druid, formerly known as Swiv and Pivot
https://allegro.github.io/turnilo/
Apache License 2.0
726 stars 169 forks source link

Display Druid Query option not working as expected #418

Closed a2l007 closed 4 years ago

a2l007 commented 5 years ago

Attempting to access the "Display Druid Query" option lands in a blank page. I can see the following error in the logs:

Client Error: {"message":"Error: must filter on time unless the allowEternity flag is set","file":"http://proudshroud.corp.gq1.com:4443/app.7e094fdf734a95564ed7.js","line":1,"column":344988,"stack":"gt</e.prototype.timeFilterToIntervals@http://proudshroud.corp.gq1.com:4443/app.7e094fdf734a95564ed7.js:1:344988\ngt</e.prototype.filterToDruid@http://proudshroud.corp.gq1.yahoo.com:4443/app.7e094fdf734a95564ed7.js:1:344728\nIt</n.prototype.getQueryAndPostTransform@http://proudshroud.corp.gq1.com:4443/app.7e094fdf734a95564ed7.js:1:383805\nht</e.prototype.simulateValue@http://proudshroud.corp.gq1.com:4443/app.7e094fdf734a95564ed7.js:1:327279\nJe</e.prototype._computeResolvedSimulate/</<@http://proudshroud.corp.gq1.com:4443/app.7e094fdf734a95564ed7.js:1:220147\nn.fillDatasetExternalAlterations@http://proudshroud.corp.gq1.yahoo.com:4443/app.7e094fdf734a95564ed7.js:1:183113\nn.fillExpressionExternalAlteration@http://proudshroud.corp.gq1.com:4443/app.7e094fdf734a95564ed7.js:1:182817\nJe</e.prototype._computeResolvedSimulate/<@http://proudshroud.corp.gq1.com:4443/app.7e094fdf734a95564ed7.js:1:220112\nJe</e.prototype._computeResolvedSimulate@http://proudshroud.corp.gq1.com:4443/app.7e094fdf734a95564ed7.js:1:220092\nJe</e.prototype.simulateQueryPlan@http://proudshroud.corp.gq1.com:4443/app.7e094fdf734a95564ed7.js:1:219794\nn.DruidQueryModal@http://proudshroud.corp.gq1.yahoo.com:4443/app.7e094fdf734a95564ed7.js:37:1476617\nbeginWork@http://proudshroud.corp.gq1.com:4443/main.js?v=1.14.0:14:31711\nr@http://proudshroud.corp.gq1.com:4443/main.js?v=1.14.0:14:44327\na@http://proudshroud.corp.gq1.com:4443/main.js?v=1.14.0:14:44648\ns@http://proudshroud.corp.gq1.com:4443/main.js?v=1.14.0:14:44886\nw@http://proudshroud.corp.gq1.com:4443/main.js?v=1.14.0:14:48429\nS@http://proudshroud.corp.gq1.com:4443/main.js?v=1.14.0:14:48166\nbatchedUpdates@http://proudshroud.corp.gq1.com:4443/main.js?v=1.14.0:14:49595\nZ@http://proudshroud.corp.gq1.com:4443/main.js?v=1.14.0:14:9667\nke@http://proudshroud.corp.gq1.com:4443/main.js?v=1.14.0:14:14119\n","hash":"#Metrics_Cluster_V2/4/N4IgbglgzgrghgGwgLzgFwgewHYgFwhLYCmAtAMYAWcATmiADQgYC2xyOx+IAomuQHoAqgBUAwoxAAzCAjTEaUfAG1QaAJ4AHLgVZcmNYlO57JegAoKsAEyV5VIazBrosuAuZEBGABKSo8pr4pF5MGtrcCOjEASAAvgC6iUxQmkhodg7hOswQbJLWecTYUG4mRZIA5i7YMFE0EBrcnl4Asv6YdPig2g2Y1txmWjmFbCVlTIWG5Bg43HBQ5MWF2JWShsa6FXFMSCyN+LUICMkgUFYxKqAbCsVL3OSYMNj0TFKdLOjdzMPc1kZwOqvcCIGA5eI7a5GW7Ye4EYhgYoZSTvGifeh4NS/Aj/KSAuSSMCg8FxSEgG6GWE5fa4N4fL6Yn4RHEAoGE4mDUkMKFSGFwkCfAAeKPpGKxzMcrIJTCJCDBnNOmgg2BI1gAIkVxjhMiAAPrkOUBBT+BSQe5MNhoBrkSSUTCxBJMJUq4jWADKnQxIARSKUu2IlWWhzqCCYlAglUoSEjGKOJyAA"}
adrianmroz commented 5 years ago

What version?

Do you have filter on time dimension?

Does query works (i.e. visualisation loads as expected), but just modal breaks?

a2l007 commented 5 years ago

I'm on 1.14.0. I do have a time dimension filter. It loads into a blank page which means query is not working. Also once I'm in the blank page, the back button wouldn't take me back to the previous page.

adrianmroz commented 5 years ago

But before clicking „Display Druid Query”, visualisation loads? If so, can you paste view definition?

a2l007 commented 5 years ago

Yes it does. Following is the view definition:

{
  "dataCubeName": "Metrics_Cluster_V2",
  "viewDefinitionVersion": "4",
  "viewDefinition": {
    "visualization": "line-chart",
    "timezone": "Etc/UTC",
    "filters": [
      {
        "type": "time",
        "ref": "time",
        "timePeriods": [
          {
            "duration": "PT1H",
            "step": -1,
            "type": "latest"
          }
        ]
      }
    ],
    "splits": [
      {
        "type": "time",
        "dimension": "time",
        "granularity": "PT1M",
        "sort": {
          "period": "",
          "type": "dimension",
          "direction": "ascending",
          "ref": "time"
        },
        "limit": null
      }
    ],
    "series": [
      {
        "reference": "count",
        "format": {
          "type": "default",
          "value": ""
        }
      },
      {
        "reference": "events",
        "format": {
          "type": "default",
          "value": ""
        }
      },
      {
        "reference": "min",
        "format": {
          "type": "default",
          "value": ""
        }
      }
    ],
    "pinnedDimensions": [
      "_cluster",
      "service",
      "metric",
      "host"
    ],
    "pinnedSort": "events",
    "legend": null,
    "highlight": null
  }
}
adrianmroz commented 5 years ago

And I assume in config you have defined timeAttribute: time? Or you run without config? If not, maybe introspection can’t infer timeAttribute. Nevertheles, I will try reproduce issue.

a2l007 commented 5 years ago

Yeah I have timeAttribute: time set in my config.yaml. Are you able to see Druid queries on your end? I'm trying to figure out if it is a config issue on my side.

adrianmroz commented 5 years ago

Yes, Druid queries modal works in our configuration on 1.14. My only suspicion is that when creating simulated external (https://github.com/allegro/turnilo/blob/master/src/client/modals/druid-query-modal/druid-query-modal.tsx#L34) we somewhat lose knowledge about time dimension.

adrianmroz commented 5 years ago

Ok, I can't reproduce that on my end, but if you feel courageous, can you paste me there your plywood expression for this view? It is visible in Network tab in DevTools in Request Payload for plywood endpoint. If you have pinboard open, there will be two requests, you can paste both, I will figure out which is which.

Error you showed is thrown when filter expression is just LiteralExpression from plywood. It shouldn't be according to your ViewDefinition but who knows, maybe you hit some edge case ...

a2l007 commented 5 years ago

Clicking on Display Druid Query generates only one request and this request does not seem to have an plywood expression header. Maybe I'm looking at the wrong place? I'll try to investigate this further today

alexbusu commented 5 years ago

Maybe it's related. https://github.com/allegro/turnilo/pull/394 . Should be fixed in v1.15. Btw, @adrianmroz when is the release? :)

adrianmroz commented 5 years ago

Soon ...

On serious note, we're running beta in our company and it's looking promising, so I would say next week.

And here it is: https://github.com/allegro/turnilo/releases/tag/1.15.0

alexbusu commented 5 years ago

@a2l007 did the issue gone using version ^1.15?

adrianmroz commented 4 years ago

Close due to inactivity.