Skip to content

Commit be58d88

Browse files
authored
fix(query): table system.query_execution output data type does not match definition (#18554)
fix
1 parent e5fdd21 commit be58d88

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/query/storages/system/src/query_execution_table.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use databend_common_exception::Result;
2424
use databend_common_expression::types::NumberDataType;
2525
use databend_common_expression::types::StringType;
2626
use databend_common_expression::types::TimestampType;
27-
use databend_common_expression::types::UInt32Type;
27+
use databend_common_expression::types::UInt64Type;
2828
use databend_common_expression::ColumnBuilder;
2929
use databend_common_expression::DataBlock;
3030
use databend_common_expression::FromData;
@@ -183,17 +183,17 @@ impl QueryExecutionTable {
183183
nodes.push(local_id.clone());
184184
timestamps.push(timestamp as i64 * 1_000_000);
185185
query_ids.push(query_id.clone());
186-
process_rows.push(rows_for_timestamp.get(query_id).copied().unwrap_or(0));
187-
process_times.push(times_for_timestamp.get(query_id).copied().unwrap_or(0));
186+
process_rows.push(rows_for_timestamp.get(query_id).copied().unwrap_or(0) as u64);
187+
process_times.push(times_for_timestamp.get(query_id).copied().unwrap_or(0) as u64);
188188
}
189189
}
190190

191191
Ok(vec![
192192
StringType::from_data(nodes),
193193
TimestampType::from_data(timestamps),
194194
StringType::from_data(query_ids),
195-
UInt32Type::from_data(process_rows),
196-
UInt32Type::from_data(process_times),
195+
UInt64Type::from_data(process_rows),
196+
UInt64Type::from_data(process_times),
197197
])
198198
}
199199
}

src/query/storages/system/src/table.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,22 @@ impl<TTable: 'static + SyncSystemTable> SyncSource for SystemTableSyncSource<TTa
203203
}
204204

205205
self.finished = true;
206-
Ok(Some(self.inner.get_full_data(self.context.clone())?))
206+
let block = self.inner.get_full_data(self.context.clone())?;
207+
#[cfg(debug_assertions)]
208+
{
209+
let schema = self.inner.get_table_info().schema();
210+
for (field, column) in schema.fields.iter().zip(block.columns().iter()) {
211+
assert_eq!(
212+
column.data_type(),
213+
field.data_type().into(),
214+
"table_schema: {:?}, block_schema: {:?}",
215+
schema,
216+
block.infer_schema()
217+
);
218+
}
219+
}
220+
221+
Ok(Some(block))
207222
}
208223
}
209224

0 commit comments

Comments
 (0)