{"record":{"id":"b85de612114fa6cd","repo":"quickwit-oss/quickwit","slug":"expected-stringarray-for-service-col-page","errorCode":null,"errorMessage":"expected StringArray for service col page","messagePattern":"expected StringArray for service col page","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-parquet-engine/src/merge/streaming/body_assembler.rs","lineNumber":115,"sourceCode":"    out: &mut HashSet<String>,\n) -> Result<()> {\n    use arrow::array::AsArray;\n    use arrow::datatypes::{Int8Type, Int16Type, Int32Type, Int64Type};\n\n    fn extend_from_strings(strings: &arrow::array::StringArray, out: &mut HashSet<String>) {\n        for i in 0..strings.len() {\n            if strings.is_valid(i) {\n                out.insert(strings.value(i).to_string());\n            }\n        }\n    }\n\n    match arr.data_type() {\n        DataType::Utf8 => {\n            let strings = arr\n                .as_any()\n                .downcast_ref::<arrow::array::StringArray>()\n                .ok_or_else(|| anyhow!(\"expected StringArray for service col page\"))?;\n            extend_from_strings(strings, out);\n        }\n        DataType::LargeUtf8 => {\n            let strings = arr\n                .as_any()\n                .downcast_ref::<arrow::array::LargeStringArray>()\n                .ok_or_else(|| anyhow!(\"expected LargeStringArray for service col page\"))?;\n            for i in 0..strings.len() {\n                if strings.is_valid(i) {\n                    out.insert(strings.value(i).to_string());\n                }\n            }\n        }\n        DataType::Dictionary(key_type, value_type)\n            if matches!(value_type.as_ref(), DataType::Utf8) =>\n        {\n            // Extract the dictionary's values that are referenced by\n            // valid (non-null) keys.","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-parquet-engine/src/merge/streaming/body_assembler.rs#L97-L133","documentation":"collect_service_names_from_page inspects the runtime DataType of the service column: for Utf8 it downcasts to arrow StringArray, for LargeUtf8 to LargeStringArray. A failure of the downcast after a matching data_type() check would violate Arrow's invariants, so it is defended with this error — indicating an internal inconsistency rather than user error.","triggerScenarios":"Iterating a page of the service column whose DataType reports Utf8 but whose underlying buffer is not a StringArray — essentially only reachable through an internal bug, corrupted column data, or a custom arrow implementation.","commonSituations":"Bugs in column assembly code that mislabels the data type; corrupted or manually crafted arrow arrays passed into the streaming merge iterator.","solutions":["Report/investigate as a bug: the data type tag disagrees with the concrete array type.","Verify the input parquet file's service column is a valid Utf8/LargeUtf8 array and not corrupted (re-read the file with arrow readers).","Check the arrow version for known downcast bugs and align all crates on one arrow version."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// before consuming the service column\ndebug_assert_eq!(arr.data_type(), &DataType::Utf8);\ndebug_assert!(arr.as_any().downcast_ref::<arrow::array::StringArray>().is_some());","typeGuard":"fn as_string_array(arr: &dyn arrow::array::Array) -> Option<&arrow::array::StringArray> {\n    if arr.data_type() == &DataType::Utf8 {\n        arr.as_any().downcast_ref::<arrow::array::StringArray>()\n    } else {\n        None\n    }\n}","tryCatchPattern":"// error indicates an internal invariant violation; log with context and abort\nif let Err(e) = iterator.next() {\n    tracing::error!(error = %e, \"arrow array type tag mismatch in service column\");\n    return Err(e);\n}","preventionTips":["Keep a single arrow crate version across the workspace.","Validate input parquet files read back with correct types before merging.","Treat occurrences as bugs — file an issue with the offending file path."],"tags":["arrow","parquet","type-mismatch","internal-invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}