use arrow::datatypes::{DataType, Field, Schema};
use std::sync::Arc;
pub fn create_intermediate_schema() -> Schema {
Schema::new(vec![
Field::new("event_type", DataType::Utf8, false),
Field::new("ts_ns", DataType::UInt64, false),
Field::new("pid", DataType::UInt32, false),
Field::new("tgid", DataType::UInt32, false),
Field::new("process_name", DataType::Utf8, true),
Field::new("stack_id", DataType::Int32, true),
Field::new("kernel_stack_id", DataType::Int32, true),
Field::new("stack_kind", DataType::Utf8, true),
Field::new("stack_frames", DataType::Utf8, true),
Field::new("stack_trace", DataType::Utf8, true),
Field::new("cpu", DataType::UInt8, false),
Field::new("prev_pid", DataType::UInt32, true),
Field::new("next_pid", DataType::UInt32, true),
Field::new("prev_state", DataType::Int64, true),
Field::new("parent_pid", DataType::UInt32, true),
Field::new("child_pid", DataType::UInt32, true),
Field::new("exit_code", DataType::Int32, true),
Field::new("address", DataType::UInt64, true),
Field::new("error_code", DataType::UInt64, true),
Field::new("fd", DataType::Int64, true),
Field::new("count", DataType::UInt64, true),
Field::new("ret", DataType::Int64, true),
Field::new("submit_ts_ns", DataType::UInt64, true),
Field::new("io_uring_opcode", DataType::UInt8, true),
Field::new("io_uring_res", DataType::Int32, true),
])
}
pub fn create_final_schema() -> Schema {
Schema::new(vec![
Field::new("event_type", DataType::Utf8, false),
Field::new("ts_ns", DataType::UInt64, false),
Field::new("pid", DataType::UInt32, false),
Field::new("tgid", DataType::UInt32, false),
Field::new("process_name", DataType::Utf8, true),
Field::new("stack_id", DataType::Int32, true),
Field::new("kernel_stack_id", DataType::Int32, true),
Field::new("stack_kind", DataType::Utf8, true),
Field::new(
"stack_trace",
DataType::List(Arc::new(Field::new("item", DataType::Utf8View, true))),
true,
),
Field::new("cpu", DataType::UInt8, false),
Field::new("prev_pid", DataType::UInt32, true),
Field::new("next_pid", DataType::UInt32, true),
Field::new("prev_state", DataType::Int64, true),
Field::new("parent_pid", DataType::UInt32, true),
Field::new("child_pid", DataType::UInt32, true),
Field::new("exit_code", DataType::Int32, true),
Field::new("address", DataType::UInt64, true),
Field::new("error_code", DataType::UInt64, true),
Field::new("fd", DataType::Int64, true),
Field::new("count", DataType::UInt64, true),
Field::new("ret", DataType::Int64, true),
Field::new("submit_ts_ns", DataType::UInt64, true),
Field::new("io_uring_opcode", DataType::UInt8, true),
Field::new("io_uring_res", DataType::Int32, true),
])
}