diff --git a/src/operator/src/lib.rs b/src/operator/src/lib.rs index e92265ece854..1d0162edf5c3 100644 --- a/src/operator/src/lib.rs +++ b/src/operator/src/lib.rs @@ -22,4 +22,3 @@ pub mod statement; pub mod table; #[cfg(test)] pub(crate) mod tests; -pub const MAX_VALUE: &str = "MAXVALUE"; diff --git a/src/operator/src/statement/ddl.rs b/src/operator/src/statement/ddl.rs index fa48679f7593..460f971df53f 100644 --- a/src/operator/src/statement/ddl.rs +++ b/src/operator/src/statement/ddl.rs @@ -38,6 +38,7 @@ use sql::ast::Value as SqlValue; use sql::statements::alter::AlterTable; use sql::statements::create::{CreateExternalTable, CreateTable, Partitions}; use sql::statements::sql_value_to_value; +use sql::MAXVALUE; use table::dist_table::DistTable; use table::metadata::{self, RawTableInfo, RawTableMeta, TableId, TableInfo, TableType}; use table::requests::{AlterTableRequest, TableOptions}; @@ -50,7 +51,7 @@ use crate::error::{ SchemaNotFoundSnafu, TableMetadataManagerSnafu, TableNotFoundSnafu, UnrecognizedTableOptionSnafu, }; -use crate::{expr_factory, MAX_VALUE}; +use crate::expr_factory; impl StatementExecutor { pub fn catalog_manager(&self) -> CatalogManagerRef { @@ -519,7 +520,7 @@ fn find_partition_entries( // indexing is safe here because we have checked that "value_list" and "column_list" are matched in size let (column_name, data_type) = &column_name_and_type[i]; let v = match v { - SqlValue::Number(n, _) if n == MAX_VALUE => PartitionBound::MaxValue, + SqlValue::Number(n, _) if n == MAXVALUE => PartitionBound::MaxValue, _ => PartitionBound::Value( sql_value_to_value(column_name, data_type, v).context(ParseSqlSnafu)?, ), diff --git a/src/operator/src/statement/show.rs b/src/operator/src/statement/show.rs index ff033a5fc195..0d6fa2288055 100644 --- a/src/operator/src/statement/show.rs +++ b/src/operator/src/statement/show.rs @@ -19,14 +19,13 @@ use partition::partition::PartitionBound; use session::context::QueryContextRef; use snafu::ResultExt; use sql::ast::{Ident, Value as SqlValue}; -use sql::statements; use sql::statements::create::{PartitionEntry, Partitions}; use sql::statements::show::{ShowDatabases, ShowTables}; +use sql::{statements, MAXVALUE}; use table::TableRef; use crate::error::{self, ExecuteStatementSnafu, Result}; use crate::statement::StatementExecutor; -use crate::MAX_VALUE; impl StatementExecutor { pub(super) async fn show_databases( @@ -93,7 +92,7 @@ fn create_partitions_stmt(partitions: Vec) -> Result statements::value_to_sql_value(v) .with_context(|_| error::ConvertSqlValueSnafu { value: v.clone() }), - PartitionBound::MaxValue => Ok(SqlValue::Number(MAX_VALUE.to_string(), false)), + PartitionBound::MaxValue => Ok(SqlValue::Number(MAXVALUE.to_string(), false)), }) .collect::>>()?; diff --git a/src/sql/src/lib.rs b/src/sql/src/lib.rs index 3fe8d2953227..f183170c1098 100644 --- a/src/sql/src/lib.rs +++ b/src/sql/src/lib.rs @@ -23,3 +23,7 @@ pub mod parser; pub mod parsers; pub mod statements; pub mod util; + +pub use parsers::create_parser::{ENGINE, MAXVALUE}; +pub use parsers::tql_parser::TQL; +pub use statements::create::TIME_INDEX; diff --git a/src/sql/src/parsers/create_parser.rs b/src/sql/src/parsers/create_parser.rs index 71b0c3786918..89b0676d77d0 100644 --- a/src/sql/src/parsers/create_parser.rs +++ b/src/sql/src/parsers/create_parser.rs @@ -40,8 +40,8 @@ use crate::statements::statement::Statement; use crate::statements::{sql_data_type_to_concrete_data_type, sql_value_to_value}; use crate::util::parse_option_string; -const ENGINE: &str = "ENGINE"; -const MAXVALUE: &str = "MAXVALUE"; +pub const ENGINE: &str = "ENGINE"; +pub const MAXVALUE: &str = "MAXVALUE"; static LESS: Lazy = Lazy::new(|| Token::make_keyword("LESS")); static THAN: Lazy = Lazy::new(|| Token::make_keyword("THAN"));