Skip to content

Commit f2a45ef

Browse files
g-talbotclaude
andcommitted
fix: compilation errors and rustfmt in base branch test code
- Fix test assertions using .load(Ordering::Relaxed) on plain u64 counter fields (ParquetDocProcessorCounters, ParquetIndexerCounters) - Remove duplicate http-body = "0.4" in quickwit-serve/Cargo.toml (workspace already provides http-body 1.0) - Add missing `use std::sync::Arc` in parquet_indexer tests - Run rustfmt on all changed files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 358c852 commit f2a45ef

24 files changed

Lines changed: 1185 additions & 905 deletions

File tree

quickwit/Cargo.lock

Lines changed: 983 additions & 792 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quickwit/quickwit-indexing/src/actors/parquet_doc_processor.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,7 @@ impl ParquetDocProcessor {
143143
indexer_mailbox: Mailbox<ParquetIndexer>,
144144
) -> Self {
145145
let processor = ParquetIngestProcessor::new();
146-
let counters = ParquetDocProcessorCounters::new(
147-
index_id.clone(),
148-
source_id.clone(),
149-
);
146+
let counters = ParquetDocProcessorCounters::new(index_id.clone(), source_id.clone());
150147

151148
info!(
152149
index_id = %index_id,
@@ -306,9 +303,8 @@ impl Handler<RawDocBatch> for ParquetDocProcessor {
306303
// Without this, a batch of consistently malformed data blocks offset progress
307304
// forever.
308305
if !checkpoint_forwarded && !checkpoint_delta.is_empty() {
309-
let empty_batch = RecordBatch::new_empty(std::sync::Arc::new(
310-
arrow::datatypes::Schema::empty(),
311-
));
306+
let empty_batch =
307+
RecordBatch::new_empty(std::sync::Arc::new(arrow::datatypes::Schema::empty()));
312308
let processed_batch =
313309
ProcessedParquetBatch::new(empty_batch, checkpoint_delta, force_commit);
314310
ctx.send_message(&self.indexer_mailbox, processed_batch)
@@ -445,8 +441,7 @@ mod tests {
445441
StdArc::new(DictionaryArray::<Int32Type>::try_new(keys, StdArc::new(vals)).unwrap())
446442
};
447443
let metric_type: ArrayRef = StdArc::new(UInt8Array::from(vec![0u8; num_rows]));
448-
let timestamp_secs: ArrayRef =
449-
StdArc::new(UInt64Array::from(vec![100u64, 101u64, 102u64]));
444+
let timestamp_secs: ArrayRef = StdArc::new(UInt64Array::from(vec![100u64, 101u64, 102u64]));
450445
let value: ArrayRef = StdArc::new(Float64Array::from(vec![42.0, 43.0, 44.0]));
451446
let service: ArrayRef = {
452447
let keys = Int32Array::from(vec![0i32; num_rows]);
@@ -699,7 +694,12 @@ mod tests {
699694

700695
// Verify packager produced a split
701696
let packager_counters = packager_handle.process_pending_and_observe().await.state;
702-
assert_eq!(packager_counters.splits_produced.load(Ordering::Relaxed), 1);
697+
assert_eq!(
698+
packager_counters
699+
.splits_produced
700+
.load(std::sync::atomic::Ordering::Relaxed),
701+
1
702+
);
703703

704704
universe.assert_quit().await;
705705
}

quickwit/quickwit-indexing/src/actors/parquet_indexer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,9 @@ mod tests {
537537
use quickwit_storage::RamStorage;
538538

539539
use super::*;
540+
use crate::actors::parquet_test_helpers::create_test_batch;
540541
use crate::actors::{
541542
ParquetPackager, ParquetPublisher, ParquetUploader, SplitsUpdateMailbox, UploaderType,
542-
parquet_test_helpers::create_test_batch,
543543
};
544544

545545
/// Create a test ParquetUploader and return its mailbox.
@@ -617,7 +617,6 @@ mod tests {
617617
.map_err(|_| anyhow::anyhow!("Timeout waiting for {} staged splits", expected_splits))
618618
}
619619

620-
621620
#[tokio::test]
622621
async fn test_metrics_indexer_receives_batch() {
623622
let universe = Universe::with_accelerated_time();

quickwit/quickwit-indexing/src/actors/parquet_packager.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,8 @@ mod tests {
243243
use quickwit_storage::RamStorage;
244244

245245
use super::*;
246-
use crate::actors::{
247-
ParquetPublisher, SplitsUpdateMailbox, UploaderType,
248-
parquet_test_helpers::create_test_batch,
249-
};
246+
use crate::actors::parquet_test_helpers::create_test_batch;
247+
use crate::actors::{ParquetPublisher, SplitsUpdateMailbox, UploaderType};
250248

251249
fn create_test_uploader(
252250
universe: &Universe,

quickwit/quickwit-indexing/src/actors/parquet_test_helpers.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
1717
use std::sync::Arc;
1818

19-
use arrow::array::{ArrayRef, DictionaryArray, Float64Array, Int32Array, StringArray, UInt8Array, UInt64Array};
19+
use arrow::array::{
20+
ArrayRef, DictionaryArray, Float64Array, Int32Array, StringArray, UInt8Array, UInt64Array,
21+
};
2022
use arrow::datatypes::{DataType, Field, Int32Type, Schema as ArrowSchema};
2123
use arrow::record_batch::RecordBatch;
2224

@@ -57,8 +59,7 @@ pub fn create_test_batch_with_tags(num_rows: usize, tags: &[&str]) -> RecordBatc
5759
for tag in tags {
5860
let keys = Int32Array::from(vec![0i32; num_rows]);
5961
let vals = StringArray::from(vec![*tag]);
60-
let col =
61-
Arc::new(DictionaryArray::<Int32Type>::try_new(keys, Arc::new(vals)).unwrap());
62+
let col = Arc::new(DictionaryArray::<Int32Type>::try_new(keys, Arc::new(vals)).unwrap());
6263
columns.push(col);
6364
}
6465

quickwit/quickwit-indexing/src/models/processed_parquet_batch.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ impl fmt::Debug for ProcessedParquetBatch {
9696

9797
#[cfg(test)]
9898
mod tests {
99-
use crate::actors::parquet_test_helpers::create_test_batch;
100-
10199
use super::*;
100+
use crate::actors::parquet_test_helpers::create_test_batch;
102101

103102
#[test]
104103
fn test_processed_parquet_batch_new() {

quickwit/quickwit-opentelemetry/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ anyhow = { workspace = true }
1515
arrow = { workspace = true }
1616
async-trait = { workspace = true }
1717
once_cell = { workspace = true }
18-
parquet = { workspace = true }
1918
prost = { workspace = true }
2019
serde = { workspace = true }
2120
serde_json = { workspace = true }

quickwit/quickwit-opentelemetry/src/otlp/arrow_metrics.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use std::io::Cursor;
2424
use std::sync::Arc;
2525

2626
use arrow::array::{
27-
ArrayRef, Float64Builder, RecordBatch, StringDictionaryBuilder, UInt64Builder, UInt8Builder,
27+
ArrayRef, Float64Builder, RecordBatch, StringDictionaryBuilder, UInt8Builder, UInt64Builder,
2828
};
2929
use arrow::datatypes::{DataType, Field, Int32Type, Schema as ArrowSchema};
3030
use arrow::ipc::reader::StreamReader;
@@ -131,8 +131,7 @@ impl ArrowMetricsBatchBuilder {
131131
arrays.push(Arc::new(tag_builder.finish()));
132132
}
133133

134-
RecordBatch::try_new(schema, arrays)
135-
.expect("record batch should match Arrow schema")
134+
RecordBatch::try_new(schema, arrays).expect("record batch should match Arrow schema")
136135
}
137136

138137
/// Returns the number of rows appended so far.

quickwit/quickwit-opentelemetry/src/otlp/otel_metrics.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,7 @@ impl OtlpGrpcMetricsService {
246246
let num_data_points = data_points.len() as u64 + num_rejected;
247247

248248
// Build Arrow RecordBatch from valid data points
249-
let mut arrow_builder =
250-
ArrowMetricsBatchBuilder::with_capacity(data_points.len());
249+
let mut arrow_builder = ArrowMetricsBatchBuilder::with_capacity(data_points.len());
251250
let mut doc_uid_generator = DocUidGenerator::default();
252251
let mut doc_uids = Vec::with_capacity(data_points.len());
253252

@@ -746,10 +745,7 @@ mod tests {
746745
assert_eq!(dp.tags.get("metric_unit").map(|s| s.as_str()), Some("1"));
747746
assert_eq!(dp.timestamp_secs, 2);
748747
assert_eq!(dp.value, 100.0); // int converted to f64
749-
assert_eq!(
750-
dp.tags.get("host").map(|s| s.as_str()),
751-
Some("server-1")
752-
);
748+
assert_eq!(dp.tags.get("host").map(|s| s.as_str()), Some("server-1"));
753749
assert_eq!(
754750
dp.tags.get("service").map(|s| s.as_str()),
755751
Some("counter-service")
@@ -844,10 +840,7 @@ mod tests {
844840
assert_eq!(dp.tags.get("service").map(|s| s.as_str()), Some("test"));
845841

846842
// Verify data point attributes are in tags as strings
847-
assert_eq!(
848-
dp.tags.get("string_tag").map(|s| s.as_str()),
849-
Some("value")
850-
);
843+
assert_eq!(dp.tags.get("string_tag").map(|s| s.as_str()), Some("value"));
851844
}
852845

853846
/// Test metrics with empty and missing values
@@ -893,9 +886,9 @@ mod tests {
893886
Some("unknown_service")
894887
);
895888
// No metric_unit tag when unit is empty
896-
assert!(dp.tags.get("metric_unit").is_none());
889+
assert!(!dp.tags.contains_key("metric_unit"));
897890
// No start_timestamp_secs tag when start time is 0
898-
assert!(dp.tags.get("start_timestamp_secs").is_none());
891+
assert!(!dp.tags.contains_key("start_timestamp_secs"));
899892
// Only "service" should be in tags (no attributes, no unit, no start time)
900893
assert_eq!(dp.tags.len(), 1);
901894
}

quickwit/quickwit-parquet-engine/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ license.workspace = true
1414
arrow = { workspace = true }
1515
chrono = { workspace = true }
1616
parquet = { workspace = true }
17-
prost = { workspace = true }
1817
quickwit-common = { workspace = true }
1918
quickwit-proto = { workspace = true }
2019
sea-query = { workspace = true, optional = true }

0 commit comments

Comments
 (0)