mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 12:31:52 +03:00
6e752a7876
Fixes https://github.com/hasura/graphql-engine/issues/5704 by checking, for aggregate fields whether we are handling a numeric aggregation. This PR also adds type information to `ColFld` such that we know the type of the field. This is the second attempt. See #319 for a less invasive approach. @nicuveo suggested type information might be useful, and since it wasn't hard to add, I think this version is better as well. GitOrigin-RevId: aa6a259fd5debe9466df6302839ddbbd0ea659b5
387 lines
9.8 KiB
YAML
387 lines
9.8 KiB
YAML
descriptions: Select aggregations on article table along with it's nodes where id > 1
|
|
url: /v1/graphql
|
|
status: 200
|
|
response:
|
|
data:
|
|
article_aggregate:
|
|
aggregate:
|
|
count: 2
|
|
count_columns_id: 2
|
|
count_columns_id_distinct: 2
|
|
sum:
|
|
id: 5
|
|
id_sum: 5
|
|
author_id: 3
|
|
author_id_sum: 3
|
|
read_time: '11.1'
|
|
sum_fields:
|
|
id: 5
|
|
id_sum: 5
|
|
author_id: 3
|
|
author_id_sum: 3
|
|
read_time: '11.1'
|
|
avg:
|
|
id: 2.5
|
|
id_avg: 2.5
|
|
author_id: 1.5
|
|
author_id_avg: 1.5
|
|
read_time: '5.5500000000000000'
|
|
avg_fields:
|
|
id: 2.5
|
|
id_avg: 2.5
|
|
author_id: 1.5
|
|
author_id_avg: 1.5
|
|
read_time: '5.5500000000000000'
|
|
stddev:
|
|
id: 0.7071067811865476
|
|
id_stddev: 0.7071067811865476
|
|
author_id: 0.7071067811865476
|
|
author_id_stddev: 0.7071067811865476
|
|
read_time: '3.1819805153394639'
|
|
stddev_fields:
|
|
id: 0.7071067811865476
|
|
id_stddev: 0.7071067811865476
|
|
author_id: 0.7071067811865476
|
|
author_id_stddev: 0.7071067811865476
|
|
read_time: '3.1819805153394639'
|
|
stddev_samp:
|
|
id: 0.7071067811865476
|
|
id_stddev_samp: 0.7071067811865476
|
|
author_id: 0.7071067811865476
|
|
author_id_stddev_samp: 0.7071067811865476
|
|
read_time: '3.1819805153394639'
|
|
stddev_samp_fields:
|
|
id: 0.7071067811865476
|
|
id_stddev_samp: 0.7071067811865476
|
|
author_id: 0.7071067811865476
|
|
author_id_stddev_samp: 0.7071067811865476
|
|
read_time: '3.1819805153394639'
|
|
stddev_pop:
|
|
id: 0.5
|
|
id_stddev_pop: 0.5
|
|
author_id: 0.5
|
|
author_id_stddev_pop: 0.5
|
|
read_time: '2.2500000000000000'
|
|
stddev_pop_fields:
|
|
id: 0.5
|
|
id_stddev_pop: 0.5
|
|
author_id: 0.5
|
|
author_id_stddev_pop: 0.5
|
|
read_time: '2.2500000000000000'
|
|
variance:
|
|
id: 0.5
|
|
id_variance: 0.5
|
|
author_id: 0.5
|
|
author_id_variance: 0.5
|
|
read_time: '10.1250000000000000'
|
|
variance_fields:
|
|
id: 0.5
|
|
id_variance: 0.5
|
|
author_id: 0.5
|
|
author_id_variance: 0.5
|
|
read_time: '10.1250000000000000'
|
|
var_samp:
|
|
id: 0.5
|
|
id_var_samp: 0.5
|
|
author_id: 0.5
|
|
author_id_var_samp: 0.5
|
|
read_time: '10.1250000000000000'
|
|
var_samp_fields:
|
|
id: 0.25
|
|
id_var_pop: 0.25
|
|
author_id: 0.25
|
|
author_id_var_pop: 0.25
|
|
read_time: '5.0625000000000000'
|
|
var_pop:
|
|
id: 0.25
|
|
id_var_pop: 0.25
|
|
author_id: 0.25
|
|
author_id_var_pop: 0.25
|
|
read_time: '5.0625000000000000'
|
|
var_pop_fields:
|
|
id: 0.25
|
|
id_var_pop: 0.25
|
|
author_id: 0.25
|
|
author_id_var_pop: 0.25
|
|
read_time: '5.0625000000000000'
|
|
max:
|
|
id: 3
|
|
id_max: 3
|
|
title: Article 3
|
|
title_max: Article 3
|
|
content: Sample article content 3
|
|
content_max: Sample article content 3
|
|
author_id: 2
|
|
author_id_max: 2
|
|
published_on: '1999-01-09T04:05:06'
|
|
published_on_max: '1999-01-09T04:05:06'
|
|
read_time: '7.8'
|
|
max_fields:
|
|
id: 3
|
|
id_max: 3
|
|
title: Article 3
|
|
title_max: Article 3
|
|
content: Sample article content 3
|
|
content_max: Sample article content 3
|
|
author_id: 2
|
|
author_id_max: 2
|
|
published_on: '1999-01-09T04:05:06'
|
|
published_on_max: '1999-01-09T04:05:06'
|
|
read_time: '7.8'
|
|
min:
|
|
id: 2
|
|
id_min: 2
|
|
title: Article 2
|
|
title_min: Article 2
|
|
content: Sample article content 2
|
|
content_min: Sample article content 2
|
|
author_id: 1
|
|
author_id_min: 1
|
|
published_on: '1999-01-08T04:05:07'
|
|
published_on_min: '1999-01-08T04:05:07'
|
|
read_time: '3.3'
|
|
min_fields:
|
|
id: 2
|
|
id_min: 2
|
|
title: Article 2
|
|
title_min: Article 2
|
|
content: Sample article content 2
|
|
content_min: Sample article content 2
|
|
author_id: 1
|
|
author_id_min: 1
|
|
published_on: '1999-01-08T04:05:07'
|
|
published_on_min: '1999-01-08T04:05:07'
|
|
read_time: '3.3'
|
|
nodes:
|
|
- id: 2
|
|
title: Article 2
|
|
content: Sample article content 2
|
|
is_published: true
|
|
published_on: '1999-01-08T04:05:07'
|
|
author:
|
|
id: 1
|
|
name: Author 1
|
|
- id: 3
|
|
title: Article 3
|
|
content: Sample article content 3
|
|
is_published: true
|
|
published_on: '1999-01-09T04:05:06'
|
|
author:
|
|
id: 2
|
|
name: Author 2
|
|
articles:
|
|
- id: 2
|
|
title: Article 2
|
|
content: Sample article content 2
|
|
is_published: true
|
|
published_on: '1999-01-08T04:05:07'
|
|
author:
|
|
id: 1
|
|
name: Author 1
|
|
- id: 3
|
|
title: Article 3
|
|
content: Sample article content 3
|
|
is_published: true
|
|
published_on: '1999-01-09T04:05:06'
|
|
author:
|
|
id: 2
|
|
name: Author 2
|
|
|
|
query:
|
|
query: |
|
|
query {
|
|
article_aggregate(where: {id: {_gt: 1}}) {
|
|
aggregate {
|
|
count
|
|
count_columns_id: count(columns: [id])
|
|
count_columns_id_distinct: count(columns: [id], distinct: true)
|
|
sum {
|
|
id
|
|
id_sum: id
|
|
author_id
|
|
author_id_sum: author_id
|
|
read_time
|
|
}
|
|
sum_fields: sum {
|
|
id
|
|
id_sum: id
|
|
author_id
|
|
author_id_sum: author_id
|
|
read_time
|
|
}
|
|
avg {
|
|
id
|
|
id_avg: id
|
|
author_id
|
|
author_id_avg: author_id
|
|
read_time
|
|
}
|
|
avg_fields: avg {
|
|
id
|
|
id_avg: id
|
|
author_id
|
|
author_id_avg: author_id
|
|
read_time
|
|
}
|
|
stddev {
|
|
id
|
|
id_stddev: id
|
|
author_id
|
|
author_id_stddev: author_id
|
|
read_time
|
|
}
|
|
stddev_fields: stddev {
|
|
id
|
|
id_stddev: id
|
|
author_id
|
|
author_id_stddev: author_id
|
|
read_time
|
|
}
|
|
stddev_samp {
|
|
id
|
|
id_stddev_samp: id
|
|
author_id
|
|
author_id_stddev_samp: author_id
|
|
read_time
|
|
}
|
|
stddev_samp_fields: stddev_samp {
|
|
id
|
|
id_stddev_samp: id
|
|
author_id
|
|
author_id_stddev_samp: author_id
|
|
read_time
|
|
}
|
|
stddev_pop {
|
|
id
|
|
id_stddev_pop: id
|
|
author_id
|
|
author_id_stddev_pop: author_id
|
|
read_time
|
|
}
|
|
stddev_pop_fields: stddev_pop {
|
|
id
|
|
id_stddev_pop: id
|
|
author_id
|
|
author_id_stddev_pop: author_id
|
|
read_time
|
|
}
|
|
variance {
|
|
id
|
|
id_variance: id
|
|
author_id
|
|
author_id_variance: author_id
|
|
read_time
|
|
}
|
|
variance_fields: variance {
|
|
id
|
|
id_variance: id
|
|
author_id
|
|
author_id_variance: author_id
|
|
read_time
|
|
}
|
|
var_samp {
|
|
id
|
|
id_var_samp: id
|
|
author_id
|
|
author_id_var_samp: author_id
|
|
read_time
|
|
}
|
|
var_samp_fields: var_pop {
|
|
id
|
|
id_var_pop: id
|
|
author_id
|
|
author_id_var_pop: author_id
|
|
read_time
|
|
}
|
|
var_pop {
|
|
id
|
|
id_var_pop: id
|
|
author_id
|
|
author_id_var_pop: author_id
|
|
read_time
|
|
}
|
|
var_pop_fields: var_pop {
|
|
id
|
|
id_var_pop: id
|
|
author_id
|
|
author_id_var_pop: author_id
|
|
read_time
|
|
}
|
|
max {
|
|
id
|
|
id_max: id
|
|
title
|
|
title_max: title
|
|
content
|
|
content_max: content
|
|
author_id
|
|
author_id_max: author_id
|
|
published_on
|
|
published_on_max: published_on
|
|
read_time
|
|
}
|
|
max_fields: max {
|
|
id
|
|
id_max: id
|
|
title
|
|
title_max: title
|
|
content
|
|
content_max: content
|
|
author_id
|
|
author_id_max: author_id
|
|
published_on
|
|
published_on_max: published_on
|
|
read_time
|
|
}
|
|
min {
|
|
id
|
|
id_min: id
|
|
title
|
|
title_min: title
|
|
content
|
|
content_min: content
|
|
author_id
|
|
author_id_min: author_id
|
|
published_on
|
|
published_on_min: published_on
|
|
read_time
|
|
}
|
|
min_fields: min {
|
|
id
|
|
id_min: id
|
|
title
|
|
title_min: title
|
|
content
|
|
content_min: content
|
|
author_id
|
|
author_id_min: author_id
|
|
published_on
|
|
published_on_min: published_on
|
|
read_time
|
|
}
|
|
}
|
|
nodes {
|
|
id
|
|
title
|
|
content
|
|
is_published
|
|
published_on
|
|
author {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
articles: nodes {
|
|
id
|
|
title
|
|
content
|
|
is_published
|
|
published_on
|
|
author {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
}
|
|
}
|