|
1 | 1 | use crate::interpreter::Query; |
2 | | -use crate::interpreter::clickhouse::{MetricLogRow, QueryMetricRow}; |
| 2 | +use crate::interpreter::clickhouse::{MetricLogRow, QueryMetricRow, column_as_string}; |
3 | 3 | use anyhow::Result; |
4 | 4 | use chrono::{DateTime, Local}; |
5 | 5 | use chrono_tz::Tz; |
@@ -614,7 +614,7 @@ impl PerfettoTraceBuilder { |
614 | 614 | let process_uuid = self.process_track_uuid("Part Log"); |
615 | 615 |
|
616 | 616 | for i in 0..columns.row_count() { |
617 | | - let event_type: String = columns.get(i, "event_type").unwrap_or_default(); |
| 617 | + let event_type: String = column_as_string(columns, i, "event_type").unwrap_or_default(); |
618 | 618 | let event_time: DateTime<Tz> = match columns.get(i, "event_time_microseconds") { |
619 | 619 | Ok(v) => v, |
620 | 620 | Err(e) => { |
@@ -740,7 +740,7 @@ impl PerfettoTraceBuilder { |
740 | 740 | }; |
741 | 741 |
|
742 | 742 | for i in 0..columns.row_count() { |
743 | | - let level: String = columns.get(i, "level").unwrap_or_default(); |
| 743 | + let level: String = column_as_string(columns, i, "level").unwrap_or_default(); |
744 | 744 | let logger_name: String = columns.get(i, "logger_name").unwrap_or_default(); |
745 | 745 | let message: String = columns.get(i, "message").unwrap_or_default(); |
746 | 746 | let query_id: String = columns.get(i, "query_id").unwrap_or_default(); |
@@ -854,7 +854,7 @@ impl PerfettoTraceBuilder { |
854 | 854 | let database: String = columns.get(i, "database").unwrap_or_default(); |
855 | 855 | let table: String = columns.get(i, "table").unwrap_or_default(); |
856 | 856 | let format: String = columns.get(i, "format").unwrap_or_default(); |
857 | | - let status: String = columns.get(i, "status").unwrap_or_default(); |
| 857 | + let status: String = column_as_string(columns, i, "status").unwrap_or_default(); |
858 | 858 | let bytes: u64 = columns.get(i, "bytes").unwrap_or(0); |
859 | 859 | let exception: String = columns.get(i, "exception").unwrap_or_default(); |
860 | 860 | let query_id: String = columns.get(i, "query_id").unwrap_or_default(); |
@@ -945,7 +945,7 @@ impl PerfettoTraceBuilder { |
945 | 945 | for i in 0..columns.row_count() { |
946 | 946 | let file_name: String = columns.get(i, "file_name").unwrap_or_default(); |
947 | 947 | let rows_processed: u64 = columns.get(i, "rows_processed").unwrap_or(0); |
948 | | - let status: String = columns.get(i, "status").unwrap_or_default(); |
| 948 | + let status: String = column_as_string(columns, i, "status").unwrap_or_default(); |
949 | 949 | let exception: String = columns.get(i, "exception").unwrap_or_default(); |
950 | 950 |
|
951 | 951 | let start_ns: u64 = match columns.get::<DateTime<Tz>, _>(i, "processing_start_time") { |
@@ -983,7 +983,7 @@ impl PerfettoTraceBuilder { |
983 | 983 | let table: String = columns.get(i, "table").unwrap_or_default(); |
984 | 984 | let file_name: String = columns.get(i, "file_name").unwrap_or_default(); |
985 | 985 | let rows_processed: u64 = columns.get(i, "rows_processed").unwrap_or(0); |
986 | | - let status: String = columns.get(i, "status").unwrap_or_default(); |
| 986 | + let status: String = column_as_string(columns, i, "status").unwrap_or_default(); |
987 | 987 | let exception: String = columns.get(i, "exception").unwrap_or_default(); |
988 | 988 |
|
989 | 989 | let start_ns: u64 = match columns.get::<DateTime<Tz>, _>(i, "processing_start_time") { |
@@ -1020,7 +1020,7 @@ impl PerfettoTraceBuilder { |
1020 | 1020 | let process_uuid = self.process_track_uuid("Blob Storage"); |
1021 | 1021 |
|
1022 | 1022 | for i in 0..columns.row_count() { |
1023 | | - let event_type: String = columns.get(i, "event_type").unwrap_or_default(); |
| 1023 | + let event_type: String = column_as_string(columns, i, "event_type").unwrap_or_default(); |
1024 | 1024 | let query_id: String = columns.get(i, "query_id").unwrap_or_default(); |
1025 | 1025 | let disk_name: String = columns.get(i, "disk_name").unwrap_or_default(); |
1026 | 1026 | let bucket: String = columns.get(i, "bucket").unwrap_or_default(); |
@@ -1113,10 +1113,10 @@ impl PerfettoTraceBuilder { |
1113 | 1113 | let process_uuid = self.process_track_uuid("Sessions"); |
1114 | 1114 |
|
1115 | 1115 | for i in 0..columns.row_count() { |
1116 | | - let session_type: String = columns.get(i, "type").unwrap_or_default(); |
| 1116 | + let session_type: String = column_as_string(columns, i, "type").unwrap_or_default(); |
1117 | 1117 | let user: String = columns.get(i, "user").unwrap_or_default(); |
1118 | 1118 | let auth_type: String = columns.get(i, "auth_type").unwrap_or_default(); |
1119 | | - let interface: String = columns.get(i, "interface").unwrap_or_default(); |
| 1119 | + let interface: String = column_as_string(columns, i, "interface").unwrap_or_default(); |
1120 | 1120 | let client_address: String = columns.get(i, "client_address").unwrap_or_default(); |
1121 | 1121 | let client_name: String = columns.get(i, "client_name").unwrap_or_default(); |
1122 | 1122 | let failure_reason: String = columns.get(i, "failure_reason").unwrap_or_default(); |
@@ -1159,7 +1159,7 @@ impl PerfettoTraceBuilder { |
1159 | 1159 | let process_uuid = self.process_track_uuid("ZooKeeper"); |
1160 | 1160 |
|
1161 | 1161 | for i in 0..columns.row_count() { |
1162 | | - let operation: String = columns.get(i, "operation").unwrap_or_default(); |
| 1162 | + let operation: String = column_as_string(columns, i, "operation").unwrap_or_default(); |
1163 | 1163 | let count: u64 = columns.get(i, "count").unwrap_or(0); |
1164 | 1164 | let average_latency: f64 = columns.get(i, "average_latency").unwrap_or(0.0); |
1165 | 1165 | let parent_path: String = columns.get(i, "parent_path").unwrap_or_default(); |
@@ -1310,7 +1310,7 @@ impl PerfettoTraceBuilder { |
1310 | 1310 | /// emitted by finalize_stack_traces() from build(). |
1311 | 1311 | pub fn add_stack_samples<K: ColumnType>(&mut self, samples: &Block<K>) { |
1312 | 1312 | for i in 0..samples.row_count() { |
1313 | | - let trace_type: String = samples.get(i, "trace_type").unwrap_or_default(); |
| 1313 | + let trace_type: String = column_as_string(samples, i, "trace_type").unwrap_or_default(); |
1314 | 1314 | let stack_hash: u64 = samples.get(i, "stack_hash").unwrap_or_default(); |
1315 | 1315 | let host_name: String = samples.get(i, "host_name").unwrap_or_default(); |
1316 | 1316 |
|
|
0 commit comments