68 lines
1.9 KiB
Groovy
68 lines
1.9 KiB
Groovy
// Licensed to the Apache Software Foundation (ASF) under one
|
|
// or more contributor license agreements. See the NOTICE file
|
|
// distributed with this work for additional information
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
// to you under the Apache License, Version 2.0 (the
|
|
// "License"); you may not use this file except in compliance
|
|
// with the License. You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing,
|
|
// software distributed under the License is distributed on an
|
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
// KIND, either express or implied. See the License for the
|
|
// specific language governing permissions and limitations
|
|
// under the License.
|
|
|
|
suite("load") {
|
|
String database = context.config.getDbNameByFile(context.file)
|
|
sql "drop database if exists ${database}"
|
|
sql "create database ${database}"
|
|
sql "use ${database}"
|
|
sql """
|
|
drop table if exists lineitem;
|
|
"""
|
|
sql '''
|
|
drop table if exists nation;
|
|
'''
|
|
|
|
sql '''
|
|
CREATE TABLE `nation` (
|
|
`n_nationkey` int(11) NOT NULL,
|
|
`n_name` varchar(25) NOT NULL,
|
|
`n_regionkey` int(11) NOT NULL
|
|
) ENGINE=OLAP
|
|
DUPLICATE KEY(`N_NATIONKEY`)
|
|
COMMENT "OLAP"
|
|
DISTRIBUTED BY HASH(`N_NATIONKEY`) BUCKETS 1
|
|
PROPERTIES (
|
|
"replication_num" = "1"
|
|
);
|
|
'''
|
|
|
|
sql '''
|
|
insert into nation values (1, "china", 2), (1, "china", 2);
|
|
'''
|
|
|
|
sql '''
|
|
drop table if exists region;
|
|
'''
|
|
|
|
sql '''
|
|
CREATE TABLE region (
|
|
r_regionkey int NOT NULL,
|
|
r_name VARCHAR(25) NOT NULL
|
|
)ENGINE=OLAP
|
|
DUPLICATE KEY(`r_regionkey`)
|
|
COMMENT "OLAP"
|
|
DISTRIBUTED BY HASH(`r_regionkey`) BUCKETS 1
|
|
PROPERTIES (
|
|
"replication_num" = "1"
|
|
);
|
|
'''
|
|
|
|
sql '''
|
|
insert into region values (2, "asia")
|
|
'''
|
|
} |