cube icon indicating copy to clipboard operation
cube copied to clipboard

Issue with QuestDB query with multiple filter option (Error : exception in function factory)

Open IntuzMayankP opened this issue 2 years ago • 6 comments

Describe the bug Hi CubeDev Team, I got the issue in filtering the data while run the graph view. I have tried with given "operators" like Equals, Contains, etc. When I try to filter the one dimension with multiple values. Example : Dimension : sn SoC is the attribute value I need to show SoC values of thingId = MP2250005, multiple Sn(MP225000501, MP225000502,...) I get error while try to filter with multiple thingId You can refer the attached screenshot.

To Reproduce Steps to reproduce the behavior: You can check my cube cloud URL for issue Cloud URL : https://macp2022.cubecloud.dev/deployments/2/playground?query=%7B%22measures%22%3A%5B%22[…]ues%22%3A%5B%22GA2210000%22%2C%22GA2210002%22%5D%7D%5D%7D

Expected behavior It should display value for both Sn(MP225000501, MP225000502) instead of error

Screenshots image

Minimally reproducible Cube Schema In case your bug report is data modelling related please put your minimally reproducible Cube Schema here. You can use selects without tables in order to achieve that as follows.

cube(`Ss804Fixed`, {
  sql: `SELECT * FROM "Ss804Fixed"`,
  
  preAggregations: {
    // Pre-Aggregations definitions go here
    // Learn more here: https://cube.dev/docs/caching/pre-aggregations/getting-started
    dataByCreated: {
      type: `rollup`,
      measures: [socAvg,AAvg,VAvg,ModTmpAvgAvg],
      timeDimension: ts,
      granularity: `hour`,
      refreshKey: {
        every: `1 hour`,
      },
    },  
  },
  
  joins: {
    
  },
  
  measures: {
    count: {
      type: `count`,
      drillMembers: [thingId]
    },
    socAvg: {
      sql: `SoC`,
      type: `avg`,
    },
    VAvg: {
      sql: `V`,
      type: `avg`,
    },
    AAvg: {
      sql: `A`,
      type: `avg`,
    },
    StAvg: {
      sql: `St`,
      type: `avg`,
    },
    ModTmpAvgAvg: {
      sql: `ModTmpAvg`,
      type: `avg`,
    },
    Evt1Avg: {
      sql: `Evt1`,
      type: `avg`,
    }
  },
  
  dimensions: {
    thingId: {
      sql: `thing_id`,
      type: `string`
    },
    
    sn: {
      sql: `${CUBE}."SN"`,
      type: `string`
    },
    
    ts: {
      sql: `ts`,
      type: `time`
    },
    SoC: {
      sql: `SoC`,
      type: `number`
    },
    // W: {
    //   sql: `w`,
    //   type: `number`
    // },
    A: {
      sql: `A`,
      type: `number`
    },
    V: {
      sql: `V`,
      type: `number`
    },
    St: {
      sql: `St`,
      type: `number`
    },
    ModTmpAvg: {
      sql: `ModTmpAvg`,
      type: `number`
    },
    Evt1: {
      sql: `Evt1`,
      type: `number`
    }
  },
  
  dataSource: `default`
});

Version: [e.g. 0.4.5]

Additional context It is blocker for us. Can you please look on this as soon as possible? We have a deliverable in next week. Let us know if this is not possible.

IntuzMayankP avatar Jun 27 '22 13:06 IntuzMayankP

https://app.slack.com/client/TC0C1HURK/threads

Chat thread history with the Cubdev team

IntuzMayankP avatar Jun 27 '22 13:06 IntuzMayankP

If you are interested in working on this issue, please leave a comment below and we will be happy to assign the issue to you. If this is the first time you are contributing a Pull Request to Cube.js, please check our contribution guidelines. You can also post any questions while contributing in the #contributors channel in the Cube.js Slack.

github-actions[bot] avatar Jun 28 '22 11:06 github-actions[bot]

@paveltiunov is there any update on this.?

IntuzMayankP avatar Jul 20 '22 11:07 IntuzMayankP

@puzpuzpuz You may probably want to give an update here.

paveltiunov avatar Jul 29 '22 05:07 paveltiunov

@IntuzMayankP could you share the query that gets generated? It should be in both cube and QuestDB logs.

puzpuzpuz avatar Jul 29 '22 09:07 puzpuzpuz

@IntuzMayankP there seems to be a bug around bind variables used in IN () operator on STRING column in QuestDB. I'll submit a patch to fix the issue. In the meanwhile, SYMBOL type seems to work fine for me. Could you try changing thing_id and SN columns' types to SYMBOL?

puzpuzpuz avatar Aug 02 '22 08:08 puzpuzpuz