Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add ignored duplicate row test #456

Merged
merged 2 commits into from
Jul 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 38 additions & 9 deletions crates/sparrow-runtime/src/execute/operation/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,13 @@ mod tests {
use crate::execute::operation::testing::{batch_from_csv, run_operation};
use crate::Batch;

#[tokio::test]
async fn test_merge() {
let plan = OperationPlan {
// The (hypothetical) producing operations this merge receives from are:
//
// - A scan that outputs a single column at (0.0) containing an i64
// - A scan that outputs two columns from (1.0) and (1.2). The latter contains
// an i64 that is read by the merge and added to the 0.0.
fn default_plan() -> OperationPlan {
OperationPlan {
expressions: vec![
ExpressionPlan {
arguments: vec![],
Expand Down Expand Up @@ -679,13 +683,12 @@ mod tests {
operator: Some(operation_plan::Operator::Merge(
operation_plan::MergeOperation { left: 0, right: 1 },
)),
};
}
}

// The (hypothetical) producing operations this merge receives from are:
//
// - A scan that outputs a single column at (0.0) containing an i64
// - A scan that outputs two columns from (1.0) and (1.2). The latter contains
// an i64 that is read by the merge and added to the 0.0.
#[tokio::test]
async fn test_merge() {
let plan = default_plan();

let operation_0 = batch_from_csv(
"
Expand Down Expand Up @@ -717,6 +720,32 @@ mod tests {
"###)
}

#[tokio::test]
#[ignore = "https://github.com/kaskada-ai/kaskada/issues/524"]
async fn test_merge_drops_duplicate_rows() {
let plan = default_plan();
let operation_0 = batch_from_csv(
"
_time,_subsort,_key_hash,e0
1970-01-01T00:00:00.000002000,0,1,1
1970-01-01T00:00:00.000003000,1,1,2
1970-01-01T00:00:00.000004000,0,2,3",
None,
)
.unwrap();
let operation_1 = batch_from_csv(
"
_time,_subsort,_key_hash,e0
1970-01-01T00:00:00.000002000,0,1,1",
None,
)
.unwrap();

insta::assert_snapshot!(run_operation(vec![operation_0, operation_1], plan).await.unwrap(), @r###"
_time,_subsort,_key_hash,e2
"###)
}

#[test]
fn test_split_at() {
let times = vec![0, 1, 2, 3, 4, 5, 10];
Expand Down
Loading