mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-03 11:52:54 +00:00
fix: scan hint checks order asc (#4365)
* fix: order by asc check * feat: print selector in explain * test: move last_value opt test to standalone * test: sqlness remove space * test: update regex for datetime * test: fix partitioning * chore: update comment Co-authored-by: Ruihang Xia <waynestxia@gmail.com> --------- Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -817,8 +817,12 @@ impl StreamContext {
|
||||
}
|
||||
}
|
||||
|
||||
/// Format parts for explain.
|
||||
pub(crate) fn format_parts(&self, t: DisplayFormatType, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
/// Format the context for explain.
|
||||
pub(crate) fn format_for_explain(
|
||||
&self,
|
||||
t: DisplayFormatType,
|
||||
f: &mut fmt::Formatter,
|
||||
) -> fmt::Result {
|
||||
match self.parts.try_lock() {
|
||||
Ok(inner) => match t {
|
||||
DisplayFormatType::Default => write!(
|
||||
@@ -827,10 +831,14 @@ impl StreamContext {
|
||||
inner.len(),
|
||||
inner.num_mem_ranges(),
|
||||
inner.num_file_ranges()
|
||||
),
|
||||
DisplayFormatType::Verbose => write!(f, "{:?}", &*inner),
|
||||
)?,
|
||||
DisplayFormatType::Verbose => write!(f, "{:?}", &*inner)?,
|
||||
},
|
||||
Err(_) => write!(f, "<locked>"),
|
||||
Err(_) => write!(f, "<locked>")?,
|
||||
}
|
||||
if let Some(selector) = &self.input.series_row_selector {
|
||||
write!(f, ", selector={}", selector)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ impl RegionScanner for SeqScan {
|
||||
impl DisplayAs for SeqScan {
|
||||
fn fmt_as(&self, t: DisplayFormatType, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "SeqScan: ")?;
|
||||
self.stream_ctx.format_parts(t, f)
|
||||
self.stream_ctx.format_for_explain(t, f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ impl RegionScanner for UnorderedScan {
|
||||
impl DisplayAs for UnorderedScan {
|
||||
fn fmt_as(&self, t: DisplayFormatType, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "UnorderedScan: ")?;
|
||||
self.stream_ctx.format_parts(t, f)
|
||||
self.stream_ctx.format_for_explain(t, f)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,8 +212,9 @@ impl TreeNodeVisitor<'_> for ScanHintVisitor {
|
||||
break;
|
||||
}
|
||||
} else if let Expr::Sort(sort_expr) = first_order_by {
|
||||
// only allow `order by xxx [DESC]`, xxx is a bare column reference
|
||||
if sort_expr.asc || !matches!(&*sort_expr.expr, Expr::Column(_)) {
|
||||
// only allow `order by xxx [ASC]`, xxx is a bare column reference so `last_value()` is the max
|
||||
// value of the column.
|
||||
if !sort_expr.asc || !matches!(&*sort_expr.expr, Expr::Column(_)) {
|
||||
is_all_last_value = false;
|
||||
break;
|
||||
}
|
||||
@@ -335,7 +336,7 @@ mod test {
|
||||
filter: None,
|
||||
order_by: Some(vec![Expr::Sort(Sort {
|
||||
expr: Box::new(col("ts")),
|
||||
asc: false,
|
||||
asc: true,
|
||||
nulls_first: true,
|
||||
})]),
|
||||
null_treatment: None,
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
|
||||
use common_recordbatch::OrderOption;
|
||||
use datafusion_expr::expr::Expr;
|
||||
use strum::Display;
|
||||
|
||||
/// A hint on how to select rows from a time-series.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Display)]
|
||||
pub enum TimeSeriesRowSelector {
|
||||
/// Only keep the last row of each time-series.
|
||||
LastRow,
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
create table t (
|
||||
ts timestamp time index,
|
||||
host string primary key,
|
||||
not_pk string,
|
||||
val double,
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
insert into t values
|
||||
(0, 'a', '🌕', 1.0),
|
||||
(1, 'b', '🌖', 2.0),
|
||||
(2, 'a', '🌗', 3.0),
|
||||
(3, 'c', '🌘', 4.0),
|
||||
(4, 'a', '🌑', 5.0),
|
||||
(5, 'b', '🌒', 6.0),
|
||||
(6, 'a', '🌓', 7.0),
|
||||
(7, 'c', '🌔', 8.0),
|
||||
(8, 'd', '🌕', 9.0);
|
||||
|
||||
Affected Rows: 9
|
||||
|
||||
-- Wait for #4354
|
||||
-- explain analyze
|
||||
-- select
|
||||
-- last_value(host order by ts),
|
||||
-- last_value(not_pk order by ts),
|
||||
-- last_value(val order by ts)
|
||||
-- from t
|
||||
-- group by host;
|
||||
drop table t;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
@@ -104,70 +104,74 @@ SHOW FULL TABLES;
|
||||
| views | LOCAL TEMPORARY |
|
||||
+---------------------------------------+-----------------+
|
||||
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
SHOW TABLE STATUS;
|
||||
|
||||
+---------------------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
|
||||
+---------------------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
| build_info | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| character_sets | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| check_constraints | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| cluster_info | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| collation_character_set_applicability | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| collations | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| column_privileges | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| column_statistics | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| columns | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| engines | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| events | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| files | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| global_status | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| key_column_usage | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| optimizer_trace | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| parameters | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| partitions | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| profiling | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| referential_constraints | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| region_peers | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| routines | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| runtime_metrics | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| schema_privileges | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| schemata | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| session_status | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| table_constraints | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| table_privileges | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| tables | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| triggers | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
| views | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
+---------------------------------------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
+++++++++++++++++++
|
||||
|Name|Engine|Version|Row_format|Rows|Avg_row_length|Data_length|Max_data_length|Index_length|Data_free|Auto_increment|Create_time|Update_time|Check_time|Collation|Checksum|Create_options|Comment|
|
||||
+++++++++++++++++++
|
||||
|build_info||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|character_sets||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|check_constraints||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|cluster_info||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|collation_character_set_applicability||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|collations||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|column_privileges||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|column_statistics||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|columns||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|engines||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|events||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|files||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|global_status||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|key_column_usage||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|optimizer_trace||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|parameters||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|partitions||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|profiling||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|referential_constraints||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|region_peers||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|routines||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|runtime_metrics||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|schema_privileges||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|schemata||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|session_status||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|table_constraints||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|table_privileges||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|tables||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|triggers||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
|views||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
+++++++++++++++++++
|
||||
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
SHOW TABLE STATUS LIKE 'tables';
|
||||
|
||||
+--------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
|
||||
+--------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
| tables | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
+--------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
+++++++++++++++++++
|
||||
|Name|Engine|Version|Row_format|Rows|Avg_row_length|Data_length|Max_data_length|Index_length|Data_free|Auto_increment|Create_time|Update_time|Check_time|Collation|Checksum|Create_options|Comment|
|
||||
+++++++++++++++++++
|
||||
|tables||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
+++++++++++++++++++
|
||||
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
SHOW TABLE STATUS WHERE Name = 'tables';
|
||||
|
||||
+--------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
|
||||
+--------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
| tables | | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
+--------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
+++++++++++++++++++
|
||||
|Name|Engine|Version|Row_format|Rows|Avg_row_length|Data_length|Max_data_length|Index_length|Data_free|Auto_increment|Create_time|Update_time|Check_time|Collation|Checksum|Create_options|Comment|
|
||||
+++++++++++++++++++
|
||||
|tables||11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
+++++++++++++++++++
|
||||
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
SHOW TABLE STATUS from public;
|
||||
|
||||
+---------+-------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
|
||||
+---------+-------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
| numbers | test_engine | 11 | Fixed | 0 | 0 | 0 | 0 | 0 | 0 | 0 | DATETIME | | | | 0 | | |
|
||||
+---------+-------------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+-------------------------+-------------+------------+-----------+----------+----------------+---------+
|
||||
+++++++++++++++++++
|
||||
|Name|Engine|Version|Row_format|Rows|Avg_row_length|Data_length|Max_data_length|Index_length|Data_free|Auto_increment|Create_time|Update_time|Check_time|Collation|Checksum|Create_options|Comment|
|
||||
+++++++++++++++++++
|
||||
|numbers|test_engine|11|Fixed|0|0|0|0|0|0|0|DATETIME||||0|||
|
||||
+++++++++++++++++++
|
||||
|
||||
USE public;
|
||||
|
||||
|
||||
@@ -10,16 +10,20 @@ SHOW TABLES LIKE 'tables';
|
||||
|
||||
SHOW FULL TABLES;
|
||||
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
SHOW TABLE STATUS;
|
||||
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
SHOW TABLE STATUS LIKE 'tables';
|
||||
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
SHOW TABLE STATUS WHERE Name = 'tables';
|
||||
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
SHOW TABLE STATUS from public;
|
||||
|
||||
USE public;
|
||||
|
||||
@@ -4,47 +4,48 @@ create database information_schema;
|
||||
Error: 1004(InvalidArguments), Schema information_schema already exists
|
||||
|
||||
-- scripts table has different table ids in different modes
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
select *
|
||||
from information_schema.tables
|
||||
where table_name != 'scripts'
|
||||
order by table_schema, table_name;
|
||||
|
||||
+---------------+--------------------+---------------------------------------+-----------------+----------+-------------+-----------------+--------------+------------------+----------------+-------------+---------+------------+------------+-----------+----------------+-------------------------+-------------+------------+-----------------+----------+----------------+---------------+-----------+
|
||||
| table_catalog | table_schema | table_name | table_type | table_id | data_length | max_data_length | index_length | max_index_length | avg_row_length | engine | version | row_format | table_rows | data_free | auto_increment | create_time | update_time | check_time | table_collation | checksum | create_options | table_comment | temporary |
|
||||
+---------------+--------------------+---------------------------------------+-----------------+----------+-------------+-----------------+--------------+------------------+----------------+-------------+---------+------------+------------+-----------+----------------+-------------------------+-------------+------------+-----------------+----------+----------------+---------------+-----------+
|
||||
| greptime | information_schema | build_info | LOCAL TEMPORARY | 8 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | character_sets | LOCAL TEMPORARY | 9 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | check_constraints | LOCAL TEMPORARY | 12 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | cluster_info | LOCAL TEMPORARY | 31 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | collation_character_set_applicability | LOCAL TEMPORARY | 11 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | collations | LOCAL TEMPORARY | 10 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | column_privileges | LOCAL TEMPORARY | 6 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | column_statistics | LOCAL TEMPORARY | 7 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | columns | LOCAL TEMPORARY | 4 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | engines | LOCAL TEMPORARY | 5 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | events | LOCAL TEMPORARY | 13 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | files | LOCAL TEMPORARY | 14 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | global_status | LOCAL TEMPORARY | 25 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | key_column_usage | LOCAL TEMPORARY | 16 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | optimizer_trace | LOCAL TEMPORARY | 17 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | parameters | LOCAL TEMPORARY | 18 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | partitions | LOCAL TEMPORARY | 28 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | profiling | LOCAL TEMPORARY | 19 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | referential_constraints | LOCAL TEMPORARY | 20 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | region_peers | LOCAL TEMPORARY | 29 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | routines | LOCAL TEMPORARY | 21 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | runtime_metrics | LOCAL TEMPORARY | 27 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | schema_privileges | LOCAL TEMPORARY | 22 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | schemata | LOCAL TEMPORARY | 15 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | session_status | LOCAL TEMPORARY | 26 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | table_constraints | LOCAL TEMPORARY | 30 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | table_privileges | LOCAL TEMPORARY | 23 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | tables | LOCAL TEMPORARY | 3 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | triggers | LOCAL TEMPORARY | 24 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | information_schema | views | LOCAL TEMPORARY | 32 | 0 | 0 | 0 | 0 | 0 | | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
| greptime | public | numbers | LOCAL TEMPORARY | 2 | 0 | 0 | 0 | 0 | 0 | test_engine | 11 | Fixed | 0 | 0 | 0 | DATETIME | | | | 0 | | | Y |
|
||||
+---------------+--------------------+---------------------------------------+-----------------+----------+-------------+-----------------+--------------+------------------+----------------+-------------+---------+------------+------------+-----------+----------------+-------------------------+-------------+------------+-----------------+----------+----------------+---------------+-----------+
|
||||
+++++++++++++++++++++++++
|
||||
|table_catalog|table_schema|table_name|table_type|table_id|data_length|max_data_length|index_length|max_index_length|avg_row_length|engine|version|row_format|table_rows|data_free|auto_increment|create_time|update_time|check_time|table_collation|checksum|create_options|table_comment|temporary|
|
||||
+++++++++++++++++++++++++
|
||||
|greptime|information_schema|build_info|LOCALTEMPORARY|8|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|character_sets|LOCALTEMPORARY|9|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|check_constraints|LOCALTEMPORARY|12|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|cluster_info|LOCALTEMPORARY|31|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|collation_character_set_applicability|LOCALTEMPORARY|11|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|collations|LOCALTEMPORARY|10|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|column_privileges|LOCALTEMPORARY|6|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|column_statistics|LOCALTEMPORARY|7|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|columns|LOCALTEMPORARY|4|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|engines|LOCALTEMPORARY|5|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|events|LOCALTEMPORARY|13|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|files|LOCALTEMPORARY|14|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|global_status|LOCALTEMPORARY|25|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|key_column_usage|LOCALTEMPORARY|16|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|optimizer_trace|LOCALTEMPORARY|17|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|parameters|LOCALTEMPORARY|18|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|partitions|LOCALTEMPORARY|28|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|profiling|LOCALTEMPORARY|19|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|referential_constraints|LOCALTEMPORARY|20|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|region_peers|LOCALTEMPORARY|29|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|routines|LOCALTEMPORARY|21|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|runtime_metrics|LOCALTEMPORARY|27|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|schema_privileges|LOCALTEMPORARY|22|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|schemata|LOCALTEMPORARY|15|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|session_status|LOCALTEMPORARY|26|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|table_constraints|LOCALTEMPORARY|30|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|table_privileges|LOCALTEMPORARY|23|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|tables|LOCALTEMPORARY|3|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|triggers|LOCALTEMPORARY|24|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|information_schema|views|LOCALTEMPORARY|32|0|0|0|0|0||11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
|greptime|public|numbers|LOCALTEMPORARY|2|0|0|0|0|0|test_engine|11|Fixed|0|0|0|DATETIME||||0|||Y|
|
||||
+++++++++++++++++++++++++
|
||||
|
||||
select * from information_schema.columns order by table_schema, table_name, column_name;
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
create database information_schema;
|
||||
|
||||
-- scripts table has different table ids in different modes
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
select *
|
||||
from information_schema.tables
|
||||
where table_name != 'scripts'
|
||||
|
||||
@@ -64,46 +64,47 @@ SHOW FULL TABLES;
|
||||
+------------+-----------------+
|
||||
|
||||
-- SQLNESS REPLACE (\s\d+\s) ID
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
SELECT * FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_NAME, TABLE_TYPE;
|
||||
|
||||
+---------------+--------------------+---------------------------------------+-----------------+----------+-------------+-----------------+--------------+------------------+----------------+-------------+---------+------------+------------+-----------+----------------+-------------------------+-------------+------------+-----------------+----------+----------------+---------------+-----------+
|
||||
| table_catalog | table_schema | table_name | table_type | table_id | data_length | max_data_length | index_length | max_index_length | avg_row_length | engine | version | row_format | table_rows | data_free | auto_increment | create_time | update_time | check_time | table_collation | checksum | create_options | table_comment | temporary |
|
||||
+---------------+--------------------+---------------------------------------+-----------------+----------+-------------+-----------------+--------------+------------------+----------------+-------------+---------+------------+------------+-----------+----------------+-------------------------+-------------+------------+-----------------+----------+----------------+---------------+-----------+
|
||||
| greptime | information_schema | build_info | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | character_sets | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | check_constraints | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | cluster_info | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | collation_character_set_applicability | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | collations | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | column_privileges | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | column_statistics | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | columns | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | engines | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | events | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | files | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | global_status | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | key_column_usage | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | public | numbers | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | test_engine |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | optimizer_trace | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | parameters | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | partitions | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | profiling | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | referential_constraints | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | region_peers | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | routines | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | runtime_metrics | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | schema_privileges | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | schemata | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | session_status | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | table_constraints | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | table_privileges | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | tables | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | public | test_table | BASE TABLE |ID |ID |ID |ID |ID |ID | mito |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | N |
|
||||
| greptime | public | test_view | VIEW |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | 1970-01-01T00:00:00 | | | |ID | | | N |
|
||||
| greptime | information_schema | triggers | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
| greptime | information_schema | views | LOCAL TEMPORARY |ID |ID |ID |ID |ID |ID | |ID | Fixed |ID |ID |ID | DATETIME | | | |ID | | | Y |
|
||||
+---------------+--------------------+---------------------------------------+-----------------+----------+-------------+-----------------+--------------+------------------+----------------+-------------+---------+------------+------------+-----------+----------------+-------------------------+-------------+------------+-----------------+----------+----------------+---------------+-----------+
|
||||
+++++++++++++++++++++++++
|
||||
|table_catalog|table_schema|table_name|table_type|table_id|data_length|max_data_length|index_length|max_index_length|avg_row_length|engine|version|row_format|table_rows|data_free|auto_increment|create_time|update_time|check_time|table_collation|checksum|create_options|table_comment|temporary|
|
||||
+++++++++++++++++++++++++
|
||||
|greptime|information_schema|build_info|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|character_sets|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|check_constraints|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|cluster_info|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|collation_character_set_applicability|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|collations|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|column_privileges|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|column_statistics|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|columns|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|engines|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|events|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|files|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|global_status|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|key_column_usage|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|public|numbers|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID|test_engine|ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|optimizer_trace|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|parameters|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|partitions|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|profiling|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|referential_constraints|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|region_peers|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|routines|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|runtime_metrics|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|schema_privileges|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|schemata|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|session_status|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|table_constraints|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|table_privileges|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|tables|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|public|test_table|BASETABLE|ID|ID|ID|ID|ID|ID|mito|ID|Fixed|ID|ID|ID|DATETIME||||ID|||N|
|
||||
|greptime|public|test_view|VIEW|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||N|
|
||||
|greptime|information_schema|triggers|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
|greptime|information_schema|views|LOCALTEMPORARY|ID|ID|ID|ID|ID|ID||ID|Fixed|ID|ID|ID|DATETIME||||ID|||Y|
|
||||
+++++++++++++++++++++++++
|
||||
|
||||
-- SQLNESS REPLACE (\s\d+\s) ID
|
||||
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'VIEW';
|
||||
|
||||
@@ -28,7 +28,8 @@ SHOW TABLES;
|
||||
SHOW FULL TABLES;
|
||||
|
||||
-- SQLNESS REPLACE (\s\d+\s) ID
|
||||
-- SQLNESS REPLACE (\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}) DATETIME
|
||||
-- SQLNESS REPLACE (\s[\-0-9T:\.]{15,}) DATETIME
|
||||
-- SQLNESS REPLACE [\u0020\-]+
|
||||
SELECT * FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_NAME, TABLE_TYPE;
|
||||
|
||||
-- SQLNESS REPLACE (\s\d+\s) ID
|
||||
|
||||
53
tests/cases/standalone/optimizer/last_value.result
Normal file
53
tests/cases/standalone/optimizer/last_value.result
Normal file
@@ -0,0 +1,53 @@
|
||||
create table t (
|
||||
ts timestamp time index,
|
||||
host string primary key,
|
||||
not_pk string,
|
||||
val double,
|
||||
);
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
insert into t values
|
||||
(0, 'a', '🌕', 1.0),
|
||||
(1, 'b', '🌖', 2.0),
|
||||
(2, 'a', '🌗', 3.0),
|
||||
(3, 'c', '🌘', 4.0),
|
||||
(4, 'a', '🌑', 5.0),
|
||||
(5, 'b', '🌒', 6.0),
|
||||
(6, 'a', '🌓', 7.0),
|
||||
(7, 'c', '🌔', 8.0),
|
||||
(8, 'd', '🌕', 9.0);
|
||||
|
||||
Affected Rows: 9
|
||||
|
||||
-- SQLNESS REPLACE (metrics.*) REDACTED
|
||||
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
||||
explain analyze
|
||||
select
|
||||
last_value(host order by ts),
|
||||
last_value(not_pk order by ts),
|
||||
last_value(val order by ts)
|
||||
from t
|
||||
group by host;
|
||||
|
||||
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| stage | node | plan |
|
||||
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| 0 | 0 | MergeScanExec: peers=[5695126634496(1326, 0), ] REDACTED
|
||||
| | | |
|
||||
| 1 | 0 | ProjectionExec: expr=[last_value(t.host) ORDER BY [t.ts ASC NULLS LAST]@1 as last_value(t.host) ORDER BY [t.ts ASC NULLS LAST], last_value(t.not_pk) ORDER BY [t.ts ASC NULLS LAST]@2 as last_value(t.not_pk) ORDER BY [t.ts ASC NULLS LAST], last_value(t.val) ORDER BY [t.ts ASC NULLS LAST]@3 as last_value(t.val) ORDER BY [t.ts ASC NULLS LAST]] REDACTED
|
||||
| | | AggregateExec: mode=FinalPartitioned, gby=[host@0 as host], aggr=[last_value(t.host) ORDER BY [t.ts ASC NULLS LAST], last_value(t.not_pk) ORDER BY [t.ts ASC NULLS LAST], last_value(t.val) ORDER BY [t.ts ASC NULLS LAST]] REDACTED
|
||||
| | | CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
||||
| | | RepartitionExec: REDACTED
|
||||
| | | CoalesceBatchesExec: target_batch_size=8192 REDACTED
|
||||
| | | AggregateExec: mode=Partial, gby=[host@1 as host], aggr=[last_value(t.host) ORDER BY [t.ts ASC NULLS LAST], last_value(t.not_pk) ORDER BY [t.ts ASC NULLS LAST], last_value(t.val) ORDER BY [t.ts ASC NULLS LAST]] REDACTED
|
||||
| | | RepartitionExec: REDACTED
|
||||
| | | SeqScan: partition_count=1 (1 memtable ranges, 0 file ranges), selector=LastRow REDACTED
|
||||
| | | |
|
||||
| | | Total rows: 4 |
|
||||
+-------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
drop table t;
|
||||
|
||||
Affected Rows: 0
|
||||
|
||||
@@ -16,13 +16,14 @@ insert into t values
|
||||
(7, 'c', '🌔', 8.0),
|
||||
(8, 'd', '🌕', 9.0);
|
||||
|
||||
-- Wait for #4354
|
||||
-- explain analyze
|
||||
-- select
|
||||
-- last_value(host order by ts),
|
||||
-- last_value(not_pk order by ts),
|
||||
-- last_value(val order by ts)
|
||||
-- from t
|
||||
-- group by host;
|
||||
-- SQLNESS REPLACE (metrics.*) REDACTED
|
||||
-- SQLNESS REPLACE (partitioning.*) REDACTED
|
||||
explain analyze
|
||||
select
|
||||
last_value(host order by ts),
|
||||
last_value(not_pk order by ts),
|
||||
last_value(val order by ts)
|
||||
from t
|
||||
group by host;
|
||||
|
||||
drop table t;
|
||||
Reference in New Issue
Block a user