Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
924060929 committed Jul 30, 2024
1 parent c32d296 commit efcfa9d
Showing 1 changed file with 66 additions and 66 deletions.
132 changes: 66 additions & 66 deletions regression-test/suites/insert_p0/insert.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,68 +20,68 @@
// /testing/trino-product-tests/src/main/resources/sql-tests/testcases
// and modified by Doris.
suite("insert") {
def tables=["datatype", "mutable_datatype"]

for (String table in tables) {
sql """ DROP TABLE IF EXISTS $table """
}

for (String table in tables) {
sql new File("""${context.file.parent}/ddl/${table}.sql""").text
}

streamLoad {
// you can skip declare db, because a default db already specify in ${DORIS_HOME}/conf/regression-conf.groovy
// db 'regression_test'
table 'datatype'

// default label is UUID:
// set 'label' UUID.randomUUID().toString()

// default column_separator is specify in doris fe config, usually is '\t'.
// this line change to ','
set 'column_separator', '|'

// relate to ${DORIS_HOME}/regression-test/data/demo/streamload_input.csv.
// also, you can stream load a http stream, e.g. http://xxx/some.csv
file 'datetype.csv'

time 10000 // limit inflight 10s

// stream load action will check result, include Success status, and NumberTotalRows == NumberLoadedRows

// if declared a check callback, the default check condition will ignore.
// So you must check all condition
check { result, exception, startTime, endTime ->
if (exception != null) {
throw exception
}
log.info("Stream load result: ${result}".toString())
def json = parseJson(result)
assertEquals("success", json.Status.toLowerCase())
assertEquals(json.NumberTotalRows, json.NumberLoadedRows)
assertTrue(json.NumberLoadedRows > 0 && json.LoadBytes > 0)
}
}

sql """ insert into mutable_datatype select c_bigint, c_double, c_string, c_date, c_timestamp, c_boolean, c_short_decimal, c_long_decimal from datatype where c_double < 20 """
sql """ insert into mutable_datatype select 1, c_double, 'abc', cast('2014-01-01' as date), c_timestamp, FALSE, '123.22', '123456789012345678.012345678' from datatype """
sql """ insert into mutable_datatype select 1, cast(2.2 as double), 'abc', cast('2014-01-01' as date), cast('2015-01-01 03:15:16' as datetime), false, '123.22', '123456789012345678.012345678' from datatype """
sql """ insert into mutable_datatype select 1, cast(2.1 as double), 'abc', cast('2014-01-01' as date), cast('2015-01-01 03:15:16' as datetime), FALSE, '123.22', '123456789012345678.012345678' """
sql """ insert into mutable_datatype values (null, null, null, null, null, null, null, null) """
sql """ insert into mutable_datatype select count(*), cast(1.1 as double), 'a', cast('2016-01-01' as date), cast('2015-01-01 03:15:16' as datetime), FALSE, '-123.22', '-123456789012345678.012345678' from datatype group by c_bigint """
sql """ insert into mutable_datatype select 5 * c_bigint, c_double + 15, c_string, c_date, c_timestamp, c_boolean, cast((c_short_decimal / '2.00') as decimal(5,2)), cast((c_long_decimal % '10') as decimal(27,9)) from datatype """
sql """ insert into mutable_datatype select * from datatype """
sql """ insert into mutable_datatype select * from mutable_datatype """
sql """ insert into mutable_datatype select * from datatype union all select * from datatype """
sql """ insert into mutable_datatype select * from datatype order by 1 limit 2 """
sql """ insert into mutable_datatype select * from datatype where c_bigint < 0 """
sql """ insert into mutable_datatype values(1,cast(2.34567 as double),'a',cast('2014-01-01' as date), cast ('2015-01-01 03:15:16' as datetime), TRUE, '123.22', '123456789012345678.012345678') """
sql """ insert into mutable_datatype values(1, cast(2.1 as double), 'abc', cast('2014-01-01' as date), cast('2015-01-01 03:15:16' as datetime), FALSE, '-123.22', '-123456789012345678.012345678') """
sql """ insert into mutable_datatype values(5 * 10, cast(4.1 + 5 as double), 'abc', cast('2014-01-01' as date), cast('2015-01-01 03:15:16' as datetime), TRUE, '123.22', '123456789012345678.012345678') """

sql "sync"
qt_insert """ select * from mutable_datatype order by c_bigint, c_double, c_string, c_date, c_timestamp, c_boolean, c_short_decimal"""
// def tables=["datatype", "mutable_datatype"]
//
// for (String table in tables) {
// sql """ DROP TABLE IF EXISTS $table """
// }
//
// for (String table in tables) {
// sql new File("""${context.file.parent}/ddl/${table}.sql""").text
// }
//
// streamLoad {
// // you can skip declare db, because a default db already specify in ${DORIS_HOME}/conf/regression-conf.groovy
// // db 'regression_test'
// table 'datatype'
//
// // default label is UUID:
// // set 'label' UUID.randomUUID().toString()
//
// // default column_separator is specify in doris fe config, usually is '\t'.
// // this line change to ','
// set 'column_separator', '|'
//
// // relate to ${DORIS_HOME}/regression-test/data/demo/streamload_input.csv.
// // also, you can stream load a http stream, e.g. http://xxx/some.csv
// file 'datetype.csv'
//
// time 10000 // limit inflight 10s
//
// // stream load action will check result, include Success status, and NumberTotalRows == NumberLoadedRows
//
// // if declared a check callback, the default check condition will ignore.
// // So you must check all condition
// check { result, exception, startTime, endTime ->
// if (exception != null) {
// throw exception
// }
// log.info("Stream load result: ${result}".toString())
// def json = parseJson(result)
// assertEquals("success", json.Status.toLowerCase())
// assertEquals(json.NumberTotalRows, json.NumberLoadedRows)
// assertTrue(json.NumberLoadedRows > 0 && json.LoadBytes > 0)
// }
// }
//
// sql """ insert into mutable_datatype select c_bigint, c_double, c_string, c_date, c_timestamp, c_boolean, c_short_decimal, c_long_decimal from datatype where c_double < 20 """
// sql """ insert into mutable_datatype select 1, c_double, 'abc', cast('2014-01-01' as date), c_timestamp, FALSE, '123.22', '123456789012345678.012345678' from datatype """
// sql """ insert into mutable_datatype select 1, cast(2.2 as double), 'abc', cast('2014-01-01' as date), cast('2015-01-01 03:15:16' as datetime), false, '123.22', '123456789012345678.012345678' from datatype """
// sql """ insert into mutable_datatype select 1, cast(2.1 as double), 'abc', cast('2014-01-01' as date), cast('2015-01-01 03:15:16' as datetime), FALSE, '123.22', '123456789012345678.012345678' """
// sql """ insert into mutable_datatype values (null, null, null, null, null, null, null, null) """
// sql """ insert into mutable_datatype select count(*), cast(1.1 as double), 'a', cast('2016-01-01' as date), cast('2015-01-01 03:15:16' as datetime), FALSE, '-123.22', '-123456789012345678.012345678' from datatype group by c_bigint """
// sql """ insert into mutable_datatype select 5 * c_bigint, c_double + 15, c_string, c_date, c_timestamp, c_boolean, cast((c_short_decimal / '2.00') as decimal(5,2)), cast((c_long_decimal % '10') as decimal(27,9)) from datatype """
// sql """ insert into mutable_datatype select * from datatype """
// sql """ insert into mutable_datatype select * from mutable_datatype """
// sql """ insert into mutable_datatype select * from datatype union all select * from datatype """
// sql """ insert into mutable_datatype select * from datatype order by 1 limit 2 """
// sql """ insert into mutable_datatype select * from datatype where c_bigint < 0 """
// sql """ insert into mutable_datatype values(1,cast(2.34567 as double),'a',cast('2014-01-01' as date), cast ('2015-01-01 03:15:16' as datetime), TRUE, '123.22', '123456789012345678.012345678') """
// sql """ insert into mutable_datatype values(1, cast(2.1 as double), 'abc', cast('2014-01-01' as date), cast('2015-01-01 03:15:16' as datetime), FALSE, '-123.22', '-123456789012345678.012345678') """
// sql """ insert into mutable_datatype values(5 * 10, cast(4.1 + 5 as double), 'abc', cast('2014-01-01' as date), cast('2015-01-01 03:15:16' as datetime), TRUE, '123.22', '123456789012345678.012345678') """
//
// sql "sync"
// qt_insert """ select * from mutable_datatype order by c_bigint, c_double, c_string, c_date, c_timestamp, c_boolean, c_short_decimal"""


multi_sql """
Expand All @@ -104,12 +104,12 @@ suite("insert") {
distributed by hash(id) buckets 100
properties('replication_num'='1')
insert into table_test_insert1 values(1), (10);
insert into table_test_insert1 values(1), (50);
insert into table_test_insert1
with
a as (select * from table_select_test1 where id > 10),
b as (select * from a union all select * from a)
select id from b;
a as (select * from table_select_test1),
b as (select * from a)
select id from a;
"""
}

0 comments on commit efcfa9d

Please sign in to comment.