Skip to content

Commit

Permalink
feat: Support probing LIMIT 0 queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-str committed May 13, 2024
1 parent ef09ee1 commit 117f332
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/cubejs-api-gateway/src/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const querySchema = Joi.object().keys({
),
segments: Joi.array().items(Joi.alternatives(id, memberExpression)),
timezone: Joi.string(),
limit: Joi.number().integer().min(1),
limit: Joi.number().integer().min(0),
offset: Joi.number().integer().min(0),
total: Joi.boolean(),
renewQuery: Joi.boolean(),
Expand Down
6 changes: 6 additions & 0 deletions packages/cubejs-testing/test/smoke-cubesql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,5 +269,11 @@ limit
const resDate = await connection.query(queryCtor('createdAtMaxProxy'));
expect(resDate.rows).toMatchSnapshot('date case');
});

test('zero limited dimension aggregated queries', async () => {
const query = 'SELECT MAX(createdAt) FROM Orders LIMIT 0';
const res = await connection.query(query);
expect(res.rows).toEqual([]);
});
});
});

0 comments on commit 117f332

Please sign in to comment.