Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(query): create table need fail if storage format is invalid #16663

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::str::FromStr;
use std::sync::Arc;

use chrono::Utc;
Expand Down Expand Up @@ -40,6 +41,7 @@ use databend_common_pipeline_core::ExecutionInfo;
use databend_common_sql::field_default_value;
use databend_common_sql::plans::CreateTablePlan;
use databend_common_storages_fuse::io::MetaReaders;
use databend_common_storages_fuse::FuseStorageFormat;
use databend_common_users::RoleCacheManager;
use databend_common_users::UserApiProvider;
use databend_enterprise_attach_table::get_attach_table_handler;
Expand All @@ -48,6 +50,7 @@ use databend_storages_common_table_meta::meta::TableSnapshot;
use databend_storages_common_table_meta::meta::Versioned;
use databend_storages_common_table_meta::table::OPT_KEY_COMMENT;
use databend_storages_common_table_meta::table::OPT_KEY_SNAPSHOT_LOCATION;
use databend_storages_common_table_meta::table::OPT_KEY_STORAGE_FORMAT;
use databend_storages_common_table_meta::table::OPT_KEY_STORAGE_PREFIX;
use databend_storages_common_table_meta::table::OPT_KEY_TEMP_PREFIX;
use log::error;
Expand Down Expand Up @@ -367,6 +370,9 @@ impl CreateTableInterpreter {
};
let schema = TableSchemaRefExt::create(fields);
let mut options = self.plan.options.clone();
if let Some(storage_format) = options.get(OPT_KEY_STORAGE_FORMAT) {
FuseStorageFormat::from_str(storage_format)?;
}
let comment = options.remove(OPT_KEY_COMMENT);

let mut table_meta = TableMeta {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ CREATE TABLE IF NOT EXISTS t(c1 int) ENGINE = Null
statement error 2302
CREATE TABLE t(c1 int) ENGINE = Null

statement error 1074
CREATE TABLE IF NOT EXISTS members (name VARCHAR, age INT) STORAGE_FORMAT = 'abc'

statement error 1074
CREATE TABLE members (name VARCHAR, age INT) STORAGE_FORMAT = 'abc'

statement ok
create table t2(a int,b int) Engine = Fuse

Expand Down
Loading