From 6127b9b7a5fb124ea23dd5d6cf340c9fa415b4ac Mon Sep 17 00:00:00 2001 From: discord9 Date: Thu, 19 Dec 2024 19:05:26 +0800 Subject: [PATCH] tests: with hint --- tests-integration/tests/grpc.rs | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests-integration/tests/grpc.rs b/tests-integration/tests/grpc.rs index 8b91ed55d520..74c8a6c0f73d 100644 --- a/tests-integration/tests/grpc.rs +++ b/tests-integration/tests/grpc.rs @@ -444,6 +444,40 @@ async fn insert_with_hints_and_assert(db: &Database) { +-------+-------------------------------------+\ "; assert_eq!(pretty, expected); + + // testing data with ttl=instant and auto_create_table = true can be handled correctly + let (expected_host_col, expected_cpu_col, expected_mem_col, expected_ts_col) = expect_data(); + + let request = InsertRequest { + table_name: "demo1".to_string(), + columns: vec![ + expected_host_col.clone(), + expected_cpu_col.clone(), + expected_mem_col.clone(), + expected_ts_col.clone(), + ], + row_count: 4, + }; + let result = db + .insert_with_hints( + InsertRequests { + inserts: vec![request], + }, + &[("auto_create_table", "true"), ("ttl", "instant")], + ) + .await; + assert_eq!(result.unwrap(), 0); + + // check table is empty + let output = db.sql("SELECT * FROM demo1").await.unwrap(); + + let record_batches = match output.data { + OutputData::RecordBatches(record_batches) => record_batches, + OutputData::Stream(stream) => RecordBatches::try_collect(stream).await.unwrap(), + OutputData::AffectedRows(_) => unreachable!(), + }; + + assert!(record_batches.iter().all(|r| r.num_rows() == 0)); } async fn insert_and_assert(db: &Database) {