feat: migrate file engine from table to reigon (#2365)

* feat: migrate file engine from table to reigon

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* Update src/file-engine/src/engine.rs

Co-authored-by: Ruihang Xia <waynestxia@gmail.com>

* feat: specify ts index for file engine

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* feat: handle time index for external table

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* fix: some integration testsg

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* feat: add file schema and table schema compatibility

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* feat: compatible file schema to region schema

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* feat: add error msg

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* fix: simplify close

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* fix: implement set_writable

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* fix: tests-integration compilation

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

* fix: address comments

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>

---------

Signed-off-by: Zhenchi <zhongzc_arch@outlook.com>
Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: zhongzc <zhongzc@zhongzcs-MacBook-Pro.local>
This commit is contained in:
Zhenchi
2023-09-18 16:02:43 +08:00
committed by GitHub
parent e7e254cd11
commit 3a39215f11
56 changed files with 1598 additions and 4717 deletions

View File

@@ -80,7 +80,7 @@ impl<'a> ParserContext<'a> {
actual: self.peek_token_as_string(),
})?;
let (columns, constraints) = self.parse_columns()?;
let engine = self.parse_table_engine(common_catalog::consts::IMMUTABLE_FILE_ENGINE)?;
let engine = self.parse_table_engine(common_catalog::consts::FILE_ENGINE)?;
let options = self
.parser
.parse_options(Keyword::WITH)
@@ -817,7 +817,7 @@ mod tests {
use std::assert_matches::assert_matches;
use std::collections::HashMap;
use common_catalog::consts::IMMUTABLE_FILE_ENGINE;
use common_catalog::consts::FILE_ENGINE;
use sqlparser::ast::ColumnOption::NotNull;
use super::*;
@@ -859,7 +859,7 @@ mod tests {
("location".to_string(), "/var/data/city.csv".to_string()),
("format".to_string(), "csv".to_string()),
]),
expected_engine: IMMUTABLE_FILE_ENGINE,
expected_engine: FILE_ENGINE,
expected_if_not_exist: false,
},
Test {

View File

@@ -15,7 +15,7 @@
use std::collections::HashMap;
use std::fmt::{Display, Formatter};
use common_catalog::consts::IMMUTABLE_FILE_ENGINE;
use common_catalog::consts::FILE_ENGINE;
use itertools::Itertools;
use crate::ast::{ColumnDef, Ident, ObjectName, SqlOption, TableConstraint, Value as SqlValue};
@@ -180,7 +180,7 @@ impl Display for CreateTable {
let partitions = self.format_partitions();
let engine = &self.engine;
let options = self.format_options();
let maybe_external = if self.engine == IMMUTABLE_FILE_ENGINE {
let maybe_external = if self.engine == FILE_ENGINE {
"EXTERNAL "
} else {
""