Skip to content

Commit

Permalink
copr: aggr null for first (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
BusyJay committed Nov 22, 2016
1 parent 7d1f0c6 commit 25e3666
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/server/coprocessor/aggregate.rs
Expand Up @@ -61,9 +61,6 @@ impl AggrFunc for First {
if args.len() != 1 {
return Err(box_err!("Wrong number of args for AggFuncFirstRow: {}", args.len()));
}
if args[0] == Datum::Null {
return Ok(());
}
*self = args.pop();
Ok(())
}
Expand Down
5 changes: 3 additions & 2 deletions tests/coprocessor/test_select.rs
Expand Up @@ -656,6 +656,7 @@ fn test_aggr_first() {
let data = vec![
(1, Some("name:0"), 2),
(2, Some("name:3"), 3),
(3, Some("name:5"), 3),
(4, Some("name:0"), 1),
(5, Some("name:5"), 4),
(6, Some("name:5"), 4),
Expand All @@ -671,7 +672,7 @@ fn test_aggr_first() {
let exp = vec![
(Datum::Bytes(b"name:0".to_vec()), 1),
(Datum::Bytes(b"name:3".to_vec()), 2),
(Datum::Bytes(b"name:5".to_vec()), 5),
(Datum::Bytes(b"name:5".to_vec()), 3),
(Datum::Null, 7),
];
let req = Select::from(&product.table).first(product.id).group_by(&[product.name]).build();
Expand All @@ -690,7 +691,7 @@ fn test_aggr_first() {
(3, Datum::Bytes(b"name:3".to_vec())),
(1, Datum::Bytes(b"name:0".to_vec())),
(4, Datum::Bytes(b"name:5".to_vec())),
(5, Datum::Bytes(b"name:5".to_vec())),
(5, Datum::Null),
(6, Datum::Null),
];
let req = Select::from(&product.table).first(product.name).group_by(&[product.count]).build();
Expand Down

0 comments on commit 25e3666

Please sign in to comment.