cube-js / cube

📊 Cube — The Semantic Layer for Building Data Applications
https://cube.dev
Other
17.91k stars 1.77k forks source link

COUNT(*) Warning breaking Pushdown queries #8765

Open pauldheinrichs opened 3 weeks ago

pauldheinrichs commented 3 weeks ago

Describe the bug A clear and concise description of what the bug is.

Since this PR has been merged - querying in the BI tool to check counts results in an error rather than getting a count. With pushdown enabled - i wouldn't have anticipated this would be the expected flow if a count measure didn't exist.


If this is the expected outcome, then feel free to close!

cube(`Orders`, {
  sql: `
  select 1 as id, 100 as amount, 'new' status
  UNION ALL
  select 2 as id, 200 as amount, 'new' status
  UNION ALL
  select 3 as id, 300 as amount, 'processed' status
  UNION ALL
  select 4 as id, 500 as amount, 'processed' status
  UNION ALL
  select 5 as id, 600 as amount, 'shipped' status
  `,
  measures: {
    count: {
      type: `count`,
     public: false
    },
    totalAmount: {
      sql: `amount`,
      type: `sum`,
    },
    toRemove: {
      type: `count`,
    },
  },
  dimensions: {
    status: {
      sql: `status`,
      type: `string`,
    },
  },
});

view(`orders_view`, {
  cubes: [
    {
      join_path: Orders,
      prefix: true,
      includes: `*`
    },
}

When doing a select count(*) on the orders_View it will error out..

pauldheinrichs commented 2 weeks ago

Querying on on both the view and the cube break with this. @igorlukanin Just an FYI feels like a un-intended result of this change

pauldheinrichs commented 5 days ago

I've done more digging - and the source of the main issue in views container prefix: true, it cannot find the count(*) measure