Skip to content

Commit

Permalink
4
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukang-Lian committed Jan 31, 2024
1 parent 2e9b0e7 commit ccf08aa
Show file tree
Hide file tree
Showing 8 changed files with 843 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !count_max_min --
10001 20000 10000

-- !count_max_min --
10001 20000 10000

-- !count_max_min --
10001 20000 10000

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !auto_inc_ids --
10000 "Bob" 100
10001 "Alice" 200
10002 "Tom" 300
10003 "Test" 400
10004 "Carter" 500
10005 "Smith" 600
10006 "Beata" 700
10007 "Doris" 800
10008 "Nereids" 900

-- !auto_inc_ids --
"Bob" 100 10000
"Alice" 200 10001
"Tom" 300 10002
"Test" 400 10003
"Carter" 500 10004
"Smith" 600 10005
"Beata" 700 10006
"Doris" 800 10007
"Nereids" 900 10008

-- !auto_inc_ids --
0 "Bob" 100
1 "Alice" 200
2 "Tom" 300
3 "Test" 400
4 "Carter" 500
5 "Smith" 600
6 "Beata" 700
7 "Doris" 800
8 "Nereids" 900

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !desc --
id BIGINT No true \N AUTO_INCREMENT
value INT No false \N NONE

-- !desc --
id INT No true \N
value BIGINT No false \N NONE,AUTO_INCREMENT

-- !sql --
1
1
5
5
9
9
13
13
13
13
17
17

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !auto_inc_ids --
4 "Carter" 500
5 "Smith" 600
6 "Beata" 700
7 "Doris" 800
8 "Nereids" 900
10000 "Bob" 100
10001 "Alice" 200
10002 "Tom" 300
10003 "Test" 400

-- !auto_inc_ids --
10 "Bob" 100
20 "Tom" 300
30 "Carter" 500
40 "Beata" 700
50 "Nereids" 900
10000 "Alice" 200
10001 "Test" 400
10002 "Smith" 600
10003 "Doris" 800

-- !auto_inc_ids --
"Carter" 500 4
"Smith" 600 5
"Beata" 700 6
"Doris" 800 7
"Nereids" 900 8
"Bob" 100 10000
"Alice" 200 10001
"Tom" 300 10002
"Test" 400 10003

-- !auto_inc_ids --
"Bob" 100 10
"Tom" 300 20
"Carter" 500 30
"Beata" 700 40
"Nereids" 900 50
"Alice" 200 10000
"Test" 400 10001
"Smith" 600 10002
"Doris" 800 10003

-- !sql --
10000 Bob 100
10001 Alice 200
10002 Tom 300
10003 Test 400
10004 Carter 500
10005 Smith 600
10006 Beata 700
10007 Doris 800
10008 Nereids 900

-- !sql --
10000 0
10001 1
10002 2
10003 3
10004 4
10005 5

-- !sql --
0 10000
1 10001
2 10002
3 10003
4 10004
5 10005

Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
// 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("test_dup_table_auto_inc_start_value_10000") {

// auto-increment column is key
def table1 = "test_dup_tab_auto_inc_start_value_10000_key"
sql "drop table if exists ${table1}"
sql """
CREATE TABLE IF NOT EXISTS `${table1}` (
`id` BIGINT NOT NULL AUTO_INCREMENT(10000) COMMENT "用户 ID",
`x` int(11) NOT NULL COMMENT "",
`y` int(11) NOT NULL COMMENT ""
) ENGINE=OLAP
DUPLICATE KEY(`id`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`id`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2"
)
"""
streamLoad {
table "${table1}"

set 'column_separator', ','
set 'format', 'csv'
set 'columns', 'x, y'

file 'auto_inc_10000.csv'
time 10000 // limit inflight 10s
}
sql "sync"
qt_count_max_min "select count(distinct id), max(id), min(id) from ${table1};"
sql "drop table if exists ${table1};"

// auto-increment column is value
def table2 = "test_dup_tab_auto_inc_10000_value"
sql "drop table if exists ${table2}"
sql """
CREATE TABLE IF NOT EXISTS `${table2}` (
`x` int(11) NOT NULL COMMENT "",
`y` int(11) NOT NULL COMMENT "",
`id` BIGINT NOT NULL AUTO_INCREMENT(10000) COMMENT "用户 ID"
) ENGINE=OLAP
DUPLICATE KEY(`x`, `y`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`x`, `y`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2"
)
"""
streamLoad {
table "${table2}"

set 'column_separator', ','
set 'format', 'csv'
set 'columns', 'x, y'

file 'auto_inc_10000.csv'
time 10000 // limit inflight 10s
}
sql "sync"
qt_count_max_min "select count(distinct id), max(id), min(id) from ${table2};"
sql "drop table if exists ${table2};"

sql "set batch_size = 4096;"
def table3 = "test_dup_tab_auto_inc_10000_key_2"
sql "drop table if exists ${table3}"
sql """
CREATE TABLE IF NOT EXISTS `${table3}` (
`id` BIGINT NOT NULL AUTO_INCREMENT(10000) COMMENT "用户 ID",
`x` int(11) NOT NULL COMMENT "",
`y` int(11) NOT NULL COMMENT ""
) ENGINE=OLAP
DUPLICATE KEY(`id`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`id`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2"
)
"""
streamLoad {
table "${table3}"

set 'column_separator', ','
set 'format', 'csv'
set 'columns', 'x, y'

file 'auto_inc_10000.csv'
time 10000 // limit inflight 10s
}
sql "sync"
qt_count_max_min "select count(distinct id), max(id), min(id) from ${table3};"
sql "drop table if exists ${table3};"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// 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("test_dup_table_auto_inc_start_value_basic") {

// auto-increment column is key
def table1 = "test_dup_tab_auto_inc_col_start_value_basic_key"
sql "drop table if exists ${table1}"
sql """
CREATE TABLE IF NOT EXISTS `${table1}` (
`id` BIGINT NOT NULL AUTO_INCREMENT(10000) COMMENT "用户 ID",
`name` varchar(65533) NOT NULL COMMENT "用户姓名",
`value` int(11) NOT NULL COMMENT "用户得分"
) ENGINE=OLAP
DUPLICATE KEY(`id`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`id`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2"
)
"""
streamLoad {
table "${table1}"

set 'column_separator', ','
set 'format', 'csv'
set 'columns', 'name, value'

file 'auto_inc_basic.csv'
time 10000 // limit inflight 10s
}
qt_auto_inc_ids "select * from ${table1};"
sql "drop table if exists ${table1};"


// auto-increment column is value
def table2 = "test_dup_tab_auto_inc_col_start_value_basic_value"
sql "drop table if exists ${table2}"
sql """
CREATE TABLE IF NOT EXISTS `${table2}` (
`name` varchar(65533) NOT NULL COMMENT "用户姓名",
`value` int(11) NOT NULL COMMENT "用户得分",
`id` BIGINT NOT NULL AUTO_INCREMENT(10000) COMMENT "用户 ID"
) ENGINE=OLAP
DUPLICATE KEY(`name`, `value`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`name`, `value`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2"
)
"""
streamLoad {
table "${table2}"

set 'column_separator', ','
set 'format', 'csv'
set 'columns', 'name, value'

file 'auto_inc_basic.csv'
time 10000 // limit inflight 10s
}
qt_auto_inc_ids "select * from ${table2} order by id;"
sql "drop table if exists ${table2};"

// auto-increment start value can be 0
def table3 = "test_dup_tab_auto_inc_col_start_value_0_basic_key"
sql "drop table if exists ${table3}"
sql """
CREATE TABLE IF NOT EXISTS `${table3}` (
`id` BIGINT NOT NULL AUTO_INCREMENT(0) COMMENT "用户 ID",
`name` varchar(65533) NOT NULL COMMENT "用户姓名",
`value` int(11) NOT NULL COMMENT "用户得分"
) ENGINE=OLAP
DUPLICATE KEY(`id`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`id`) BUCKETS 1
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2"
)
"""
streamLoad {
table "${table3}"

set 'column_separator', ','
set 'format', 'csv'
set 'columns', 'name, value'

file 'auto_inc_basic.csv'
time 10000 // limit inflight 10s
}
qt_auto_inc_ids "select * from ${table3};"
sql "drop table if exists ${table3};"

}
Loading

0 comments on commit ccf08aa

Please sign in to comment.