Skip to content

Conversation

@tustvold
Copy link
Contributor

Which issue does this PR close?

Part of #6842

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the physical-expr Changes to the physical-expr crates label Aug 22, 2023
@github-actions github-actions bot added the core Core DataFusion crate label Aug 22, 2023
"AggregateStream",
])
.with_memory_limit(20_000)
.with_memory_limit(2_000)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to lower this memory limit, as it is significantly more space-efficient now

async fn group_by_none() {
TestCase::new()
.with_query("select median(image) from t")
.with_query("select median(request_bytes) from t")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to request_bytes as median isn't well defined for string types, this would only "work" if there happened to be an odd number of values, or the query errored (as in this case)

❯ create table test(c varchar) as values ('foo'), ('world'), ('hello');
0 rows in set. Query took 0.005 seconds.

❯ select median(c) from test;
+----------------+
| MEDIAN(test.c) |
+----------------+
| hello          |
+----------------+
1 row in set. Query took 0.005 seconds.

❯ insert into test values ('bar');
+-------+
| count |
+-------+
| 1     |
+-------+
1 row in set. Query took 0.002 seconds.

❯ select median(c) from test;
Internal error: Operator + is not implemented for types Utf8("foo") and Utf8("hello"). This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker

data_type: DataType,
arrays: Vec<ArrayRef>,
all_values: Vec<ScalarValue>,
all_values: Vec<T::Native>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

None
} else if len % 2 == 0 {
let (low, high, _) = d.select_nth_unstable_by(len / 2, cmp);
let (_, low, _) = low.select_nth_unstable_by(low.len() - 1, cmp);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants