|
| 1 | +// Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +// or more contributor license agreements. See the NOTICE file |
| 3 | +// distributed with this work for additional information |
| 4 | +// regarding copyright ownership. The ASF licenses this file |
| 5 | +// to you under the Apache License, Version 2.0 (the |
| 6 | +// "License"); you may not use this file except in compliance |
| 7 | +// with the License. You may obtain a copy of the License at |
| 8 | +// |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +// |
| 11 | +// Unless required by applicable law or agreed to in writing, |
| 12 | +// software distributed under the License is distributed on an |
| 13 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +// KIND, either express or implied. See the License for the |
| 15 | +// specific language governing permissions and limitations |
| 16 | +// under the License. |
| 17 | + |
| 18 | +// The cases is copied from https://github.com/trinodb/trino/tree/master |
| 19 | +// /testing/trino-product-tests/src/main/resources/sql-tests/testcases |
| 20 | +// and modified by Doris. |
| 21 | + |
| 22 | +suite("test_single_replica_load", "p2") { |
| 23 | + |
| 24 | + def load_json_data = {table_name, file_name -> |
| 25 | + // load the json data |
| 26 | + streamLoad { |
| 27 | + table "${table_name}" |
| 28 | + |
| 29 | + // set http request header params |
| 30 | + set 'read_json_by_line', 'true' |
| 31 | + set 'format', 'json' |
| 32 | + set 'max_filter_ratio', '0.1' |
| 33 | + file file_name // import json file |
| 34 | + time 10000 // limit inflight 10s |
| 35 | + |
| 36 | + // if declared a check callback, the default check condition will ignore. |
| 37 | + // So you must check all condition |
| 38 | + |
| 39 | + check { result, exception, startTime, endTime -> |
| 40 | + if (exception != null) { |
| 41 | + throw exception |
| 42 | + } |
| 43 | + logger.info("Stream load ${file_name} result: ${result}".toString()) |
| 44 | + def json = parseJson(result) |
| 45 | + assertEquals("success", json.Status.toLowerCase()) |
| 46 | + assertTrue(json.NumberLoadedRows > 0 && json.LoadBytes > 0) |
| 47 | + } |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + def tableName = "test_single_replica_load" |
| 52 | + |
| 53 | + sql "DROP TABLE IF EXISTS ${tableName}" |
| 54 | + sql """ |
| 55 | + CREATE TABLE IF NOT EXISTS ${tableName} ( |
| 56 | + k bigint, |
| 57 | + v variant, |
| 58 | + INDEX idx(v) USING INVERTED PROPERTIES("parser"="standard") COMMENT '' |
| 59 | + ) |
| 60 | + DUPLICATE KEY(`k`) |
| 61 | + DISTRIBUTED BY HASH(k) BUCKETS 1 |
| 62 | + properties("replication_num" = "2", "disable_auto_compaction" = "true", "inverted_index_storage_format" = "V1"); |
| 63 | + """ |
| 64 | + load_json_data.call(tableName, """${getS3Url() + '/regression/gharchive.m/2015-01-01-0.json'}""") |
| 65 | + load_json_data.call(tableName, """${getS3Url() + '/regression/gharchive.m/2015-01-01-0.json'}""") |
| 66 | + load_json_data.call(tableName, """${getS3Url() + '/regression/gharchive.m/2015-01-01-0.json'}""") |
| 67 | +} |
0 commit comments