Skip to content

Min measure for a Date field throws "Float cannot represent non numeric value" #5652

Open
@iiq374

Description

@iiq374

Describe the bug
When using a min measure type on a DateTime field there is a casting error when querying via GraphQL

To Reproduce

  1. Have a Cube with a min measure type on a DateTime field (we are using PostGres):
minDate: {
      sql: `created_at`,
      type: `min`,
    },
  1. Query for the field using GraphQL:
query CubeQuery  { 
  cube {
    generalLedger_Income {
      minDate
     } 
  }
}
{"errors":[{"message":"**Float cannot represent non numeric value: \"2020-06-25T14:00:00.000\**"","locations":[{"line":6,"column":7}],"path":["cube",0,"generalLedger_Income","minDate"]}],"data":{"cube":[{"generalLedger_Income":{"minDate":null,"__typename":"GeneralLedger_IncomeMembers"},"__typename":"Result"}]}}

Expected behavior
Min and Max should be able to be used on Date fields as well

Screenshots
If applicable, add screenshots to help explain your problem.

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(`generalLedger_Income`, {
  sql: `
  select now() as created_at
  UNION ALL
  select now() as created_at
  `,
  measures: {
minDate: {
      sql: `created_at`,
      type: `min`,
    },
  },
});

Version:
0.31.11

Additional context

Metadata

Metadata

Assignees

Labels

api:graphqlIssues related to GraphQL API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions