Skip to content

Commit

Permalink
Merge pull request #4701 from sundy-li/null-take
Browse files Browse the repository at this point in the history
query(values): support take for null column && update streaming load docs
  • Loading branch information
BohuTANG authored Apr 6, 2022
2 parents 8fabe4b + 2dbff2c commit e3e16b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion common/datavalues/src/columns/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::prelude::*;

impl Series {
pub fn take<I: Index>(column: &ColumnRef, indices: &[I]) -> Result<ColumnRef> {
if column.is_const() {
if column.is_const() || column.is_null() {
Ok(column.slice(0, indices.len()))
} else if column.is_nullable() {
let nullable_c: &NullableColumn = unsafe { Series::static_cast(column) };
Expand Down
2 changes: 2 additions & 0 deletions docs/doc/21-load-data/00-local.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ description:
Using HTTP API `v1/streaming_load` to load data from local file into Databend.
Currently, we only support CSV and Parquet file format.

> Note: CSV file should be UTF-8 character encoded if you have extra character set
### Before You Begin

* **Databend :** Make sure Databend is running and accessible, see [How to deploy Databend](/doc/deploy).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@
1
2.5
2
2 NULL
1 NULL
0 NULL
24 changes: 14 additions & 10 deletions tests/suites/0_stateless/01_system/01_0000_system_numbers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ SELECT argMax(a, b) from (select number + 5 as a, number - 5 as b from numbers_m
SELECT argMax(b, a) from (select number + 5 as a, number - 5 as b from numbers_mt(10000));

-- test argMax, argMin fro String
SELECT argMax(a, b) from (select number + 5 as a, cast(number as varchar(255)) as b from numbers_mt(10000)) ;
SELECT argMax(b, a) from (select number + 5 as a, cast(number as varchar(255)) as b from numbers_mt(10000)) ;
SELECT argMax(a, b) from (select number + 5 as a, cast(number as varchar(255)) as b from numbers_mt(10000)) ;
SELECT argMax(b, a) from (select number + 5 as a, cast(number as varchar(255)) as b from numbers_mt(10000)) ;


select count(distinct number, number + 1 , number + 3 ) from ( select number % 100 as number from numbers(100000));
select count(distinct 3) from numbers(10000);
select uniq(number, number + 1 , number + 3 ) = count(distinct number, number + 1 , number + 3 ) from ( select number % 100 as number from numbers(100000));
SELECT std(number) between 2886.751 and 2886.752 from numbers_mt(10000);
SELECT stddev(number) between 2886.751 and 2886.752 from numbers_mt(10000);
SELECT stddev_pop(number) between 2886.751 and 2886.752 from numbers_mt(10000);
SELECT covar_samp(number, number) from (select * from numbers_mt(5) order by number asc);
SELECT covar_pop(number, number) from (select * from numbers_mt(5) order by number asc);
select count(distinct number, number + 1 , number + 3 ) from ( select number % 100 as number from numbers(100000));
select count(distinct 3) from numbers(10000);
select uniq(number, number + 1 , number + 3 ) = count(distinct number, number + 1 , number + 3 ) from ( select number % 100 as number from numbers(100000));
SELECT std(number) between 2886.751 and 2886.752 from numbers_mt(10000);
SELECT stddev(number) between 2886.751 and 2886.752 from numbers_mt(10000);
SELECT stddev_pop(number) between 2886.751 and 2886.752 from numbers_mt(10000);
SELECT covar_samp(number, number) from (select * from numbers_mt(5) order by number asc);
SELECT covar_pop(number, number) from (select * from numbers_mt(5) order by number asc);


-- sort with null
SELECT number, null from numbers(3) order by number desc;

1 comment on commit e3e16b8

@vercel
Copy link

@vercel vercel bot commented on e3e16b8 Apr 6, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.