Skip to content

Commit

Permalink
add 1 test
Browse files Browse the repository at this point in the history
  • Loading branch information
eldenmoon committed Jun 29, 2023
1 parent 212f440 commit d9c02e8
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions regression-test/suites/variant_p0/load.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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("regression_test_variant", "variant_type"){
// prepare test table
def table_name = "simple_variant_type"
sql "DROP TABLE IF EXISTS ${table_name}"
sql """
CREATE TABLE IF NOT EXISTS ${table_name} (
k bigint,
v variant
)
DUPLICATE KEY(`k`)
DISTRIBUTED BY RANDOM BUCKETS 5
properties("replication_num" = "1", "disable_auto_compaction" = "true");
"""
sql """insert into ${table_name} values (1, '[1]'),(1, '{"a" : 1}');"""
sql """insert into ${table_name} values (1, '[2]'),(1, '{"a" : [[[1]]]}');"""
sql """insert into ${table_name} values (1, '3'),(1, '{"a" : 1}'), (1, '{"a" : [1]}');"""
sql """insert into ${table_name} values (1, '"4"'),(1, '{"a" : "1223"}');"""
sql """insert into ${table_name} values (1, '5.0'),(1, '{"a" : [1]}');"""
sql """insert into ${table_name} values (1, '"[6]"'),(1, '{"a" : ["1", 2, 1.1]}');"""
sql """insert into ${table_name} values (1, '7'),(1, '{"a" : 1, "b" : {"c" : 1}}');"""
sql """insert into ${table_name} values (1, '8.11111'),(1, '{"a" : 1, "b" : {"c" : [{"a" : 1}]}}');"""
sql """insert into ${table_name} values (1, '"9999"'),(1, '{"a" : 1, "b" : {"c" : [{"a" : 1}]}}');"""
sql """insert into ${table_name} values (1, '1000000'),(1, '{"a" : 1, "b" : {"c" : [{"a" : 1}]}}');"""
sql """insert into ${table_name} values (1, '[123.0]'),(1, '{"a" : 1, "b" : {"c" : 1}}'),(1, '{"a" : 1, "b" : 10}');"""
sql """insert into ${table_name} values (1, '[123.2]'),(1, '{"a" : 1, "b" : 10}'),(1, '{"a" : 1, "b" : {"c" : 1}}');"""
qt_sql "select count() from ${table_name}"
}

0 comments on commit d9c02e8

Please sign in to comment.