Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,21 @@ suite("test_outfile_native", "p0") {
DISTRIBUTED BY HASH(id) PROPERTIES("replication_num" = "1");
"""

// Insert 10 rows of test data (the last row is all NULL)
StringBuilder sb = new StringBuilder()
// Avoid a single huge VALUES statement: Cloud P0 can spend over 120s
// preparing the plan fragment when all 10k rows are inserted at once.
List<String> rows = []
int i = 1
for (; i < 10000; i ++) {
sb.append("""
(${i}, '2024-01-01', '2024-01-01 00:00:00', 's${i}', ${i}, ${i % 128}, true, ${i}.${i}),
rows.add("""
(${i}, '2024-01-01', '2024-01-01 00:00:00', 's${i}', ${i}, ${i % 128}, true, ${i}.${i})
""")
}
sb.append("""
rows.add("""
(${i}, '2024-01-01', '2024-01-01 00:00:00', NULL, NULL, NULL, NULL, NULL)
""")
sql """ INSERT INTO ${tableName} VALUES ${sb.toString()} """
rows.collate(500).each { batch ->
sql """ INSERT INTO ${tableName} VALUES ${batch.join(",")} """
}

// baseline: local table query result
qt_select_default """ SELECT * FROM ${tableName} t ORDER BY id limit 10; """
Expand All @@ -97,4 +100,4 @@ suite("test_outfile_native", "p0") {
} finally {
try_sql("DROP TABLE IF EXISTS ${tableName}")
}
}
}
14 changes: 7 additions & 7 deletions regression-test/suites/export_p0/test_outfile.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ suite("test_outfile") {
)
DISTRIBUTED BY HASH(user_id) PROPERTIES("replication_num" = "1");
"""
StringBuilder sb = new StringBuilder()
List<String> rows = []
int i = 1
for (; i < 1000; i ++) {
sb.append("""
(${i}, '2017-10-01', '2017-10-01 00:00:00', '2017-10-01', '2017-10-01 00:00:00.111111', '2017-10-01 00:00:00.111111', '2017-10-01 00:00:00.111111', 'Beijing', ${i}, ${i % 128}, true, ${i}, ${i}, ${i}, ${i}.${i}, ${i}.${i}, 'char${i}', ${i}),
rows.add("""
(${i}, '2017-10-01', '2017-10-01 00:00:00', '2017-10-01', '2017-10-01 00:00:00.111111', '2017-10-01 00:00:00.111111', '2017-10-01 00:00:00.111111', 'Beijing', ${i}, ${i % 128}, true, ${i}, ${i}, ${i}, ${i}.${i}, ${i}.${i}, 'char${i}', ${i})
""")
}
sb.append("""
rows.add("""
(${i}, '2017-10-01', '2017-10-01 00:00:00', '2017-10-01', '2017-10-01 00:00:00.111111', '2017-10-01 00:00:00.111111', '2017-10-01 00:00:00.111111', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
""")
sql """ INSERT INTO ${tableName} VALUES
${sb.toString()}
"""
rows.collate(500).each { batch ->
sql """ INSERT INTO ${tableName} VALUES ${batch.join(",")} """
}
qt_select_default """ SELECT * FROM ${tableName} t ORDER BY user_id; """

// check outfile
Expand Down
14 changes: 7 additions & 7 deletions regression-test/suites/export_p0/test_outfile_expr.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ suite("test_outfile_expr") {
)
DISTRIBUTED BY HASH(user_id) PROPERTIES("replication_num" = "1");
"""
StringBuilder sb = new StringBuilder()
List<String> rows = []
int i = 1
for (; i < 1000; i ++) {
sb.append("""
(${i}, '2017-10-01', '2017-10-01 00:00:00', 'Beijing', ${i}, ${i % 128}, true, ${i}, ${i}, ${i}, ${i}.${i}, ${i}.${i}, 'char${i}', ${i}),
rows.add("""
(${i}, '2017-10-01', '2017-10-01 00:00:00', 'Beijing', ${i}, ${i % 128}, true, ${i}, ${i}, ${i}, ${i}.${i}, ${i}.${i}, 'char${i}', ${i})
""")
}
sb.append("""
rows.add("""
(${i}, '2017-10-01', '2017-10-01 00:00:00', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
""")
sql """ INSERT INTO ${tableName} VALUES
${sb.toString()}
"""
rows.collate(500).each { batch ->
sql """ INSERT INTO ${tableName} VALUES ${batch.join(",")} """
}
qt_select_default """ SELECT user_id+1, age+sex, repeat(char_col, 10) FROM ${tableName} t ORDER BY user_id; """

// check outfile
Expand Down
Loading