Skip to content

Commit

Permalink
[regression](insert)add hive DDL and CTAS regression case (#32924)
Browse files Browse the repository at this point in the history
Issue Number: #31442

dependent on #32824

add ddl(create and drop) test
add ctas test
add complex type test
TODO:
bucketed table test
truncate test
add/drop partition test
  • Loading branch information
wsjz authored Mar 29, 2024
1 parent cb6287e commit 5c934e7
Show file tree
Hide file tree
Showing 5 changed files with 571 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2212,11 +2212,6 @@ public class Config extends ConfigBase {
"Sample size for hive row count estimation."})
public static int hive_stats_partition_sample_size = 3000;

@ConfField(mutable = true, masterOnly = true, description = {
"启用外表DDL",
"Enable external table DDL"})
public static boolean enable_external_ddl = false;

@ConfField(mutable = true, masterOnly = true, description = {
"启用Hive分桶表",
"Enable external hive bucket table"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.apache.doris.catalog.Resource;
import org.apache.doris.catalog.TableIf;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import org.apache.doris.common.UserException;
import org.apache.doris.common.Version;
Expand Down Expand Up @@ -615,9 +614,6 @@ public void addDatabaseForTest(ExternalDatabase<? extends ExternalTable> db) {

@Override
public void createDb(CreateDbStmt stmt) throws DdlException {
if (!Config.enable_external_ddl) {
throw new DdlException("Experimental. The config enable_external_ddl needs to be set to true.");
}
makeSureInitialized();
if (metadataOps == null) {
LOG.warn("createDb not implemented");
Expand All @@ -633,9 +629,6 @@ public void createDb(CreateDbStmt stmt) throws DdlException {

@Override
public void dropDb(DropDbStmt stmt) throws DdlException {
if (!Config.enable_external_ddl) {
throw new DdlException("Experimental. The config enable_external_ddl needs to be set to true.");
}
makeSureInitialized();
if (metadataOps == null) {
LOG.warn("dropDb not implemented");
Expand All @@ -651,9 +644,6 @@ public void dropDb(DropDbStmt stmt) throws DdlException {

@Override
public void createTable(CreateTableStmt stmt) throws UserException {
if (!Config.enable_external_ddl) {
throw new DdlException("Experimental. The config enable_external_ddl needs to be set to true.");
}
makeSureInitialized();
if (metadataOps == null) {
LOG.warn("createTable not implemented");
Expand All @@ -669,9 +659,6 @@ public void createTable(CreateTableStmt stmt) throws UserException {

@Override
public void dropTable(DropTableStmt stmt) throws DdlException {
if (!Config.enable_external_ddl) {
throw new DdlException("Experimental. The config enable_external_ddl needs to be set to true.");
}
makeSureInitialized();
if (metadataOps == null) {
LOG.warn("dropTable not implemented");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ protected void runBeforeAll() throws Exception {
connectContext.getSessionVariable().enableNereidsTimeout = false;
connectContext.getSessionVariable().enableNereidsDML = true;
Config.enable_query_hive_views = false;
Config.enable_external_ddl = true;
// create test internal table
createDatabase(mockedDbName);
useDatabase(mockedDbName);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !insert01 --
true 123 9876543210 abcdefghij 3.14 6.28 123.4567 varcharval stringval

-- !insert02 --
\N 123 \N \N 8.98
true 123 9876543210 \N stringval
true 123 9876543210 123.4567 stringval

-- !insert03 --
\N 123 \N \N \N \N \N varcharval 8.98
false 1 9876543210 abcdefghij 2.3 6.28 0.0000 2223 stringval
true \N 9876543210 abcdefghij 2.3 6.28 \N varcharval stringval
true 123 9876543210 \N \N \N \N varcharval stringval
true 123 9876543210 abcdefghij 3.14 6.28 123.4567 varcharval stringval

-- !insert04 --
true 1 1000 2.3 value_for_pt1 value_for_pt2

-- !insert05 --
true 1 1000 2.3
true 1 1000 2.3
true 1 1000 2.3

-- !insert06 --
\N 1 1000 1.3
false 1 1000 \N
true 1 1000 2.3
true 1 1000 2.3
true 1 1000 2.3

-- !ctas_01 --
1
2
2
3
3

-- !ctas_02 --
11 value_for_pt1 value_for_pt2
22 value_for_pt11 value_for_pt22
22 value_for_pt11 value_for_pt22

-- !ctas_03 --
1 string value for col2
1 string value for col2
2 another string value for col2
2 another string value for col2
3 yet another string value for col2
3 yet another string value for col2

-- !ctas_04 --
11 value_for_pt1 value_for_pt2
11 value_for_pt1 value_for_pt2
22 value_for_pt11 value_for_pt22
22 value_for_pt11 value_for_pt22

-- !ctas_05 --
1 string value for col2
2 another string value for col2
3 yet another string value for col2

-- !ctas_06 --
11 value_for_pt1 value_for_pt2
22 value_for_pt11 value_for_pt22

-- !complex_type01 --
a \N \N \N \N \N \N \N \N \N ["char1", "char2"] ["c", "d"] ["string1", "string2"] [{1:"a"}, {2:"b"}] {1234567890123456789:"a"} {1234567890123456789:0.12345678} {"key":["char1", "char2"]} {"id": 1, "gender": 1, "name": "John Doe"} {"scale": 123.4567, "metric": ["metric1", "metric2"]} \N
a b c d e 1.1 12345 0.12345678 string \N \N \N \N \N \N \N \N \N \N \N
a b c d e 1.1 12345 0.12345678 string [0.001, 0.002] ["char1", "char2"] ["c", "d"] ["string1", "string2"] [{1:"a"}, {2:"b"}] {1234567890123456789:"a"} {1234567890123456789:0.12345678} {"key":["char1", "char2"]} {"id": 1, "gender": 1, "name": "John Doe"} {"scale": 123.4567, "metric": ["metric1", "metric2"]} {"codes": [123, 456], "props": {"key1":["char1", "char2"]}}

-- !complex_type02 --
a b c d e 1.1 12345 0.12345678 string \N \N \N \N \N \N \N \N \N \N \N
a b c d e 1.1 12345 0.12345678 string [0.001, 0.002] ["char1", "char2"] ["c", "d"] ["string1", "string2"] [{1:"a"}, {2:"b"}] {1234567890123456789:"a"} {1234567890123456789:0.12345678} {"key":["char1", "char2"]} {"id": 1, "gender": 1, "name": "John Doe"} {"scale": 123.4567, "metric": ["metric1", "metric2"]} {"codes": [123, 456], "props": {"key1":["char1", "char2"]}}

-- !insert01 --
true 123 9876543210 abcdefghij 3.14 6.28 123.4567 varcharval stringval

-- !insert02 --
\N 123 \N \N 8.98
true 123 9876543210 \N stringval
true 123 9876543210 123.4567 stringval

-- !insert03 --
\N 123 \N \N \N \N \N varcharval 8.98
false 1 9876543210 abcdefghij 2.3 6.28 0.0000 2223 stringval
true \N 9876543210 abcdefghij 2.3 6.28 \N varcharval stringval
true 123 9876543210 \N \N \N \N varcharval stringval
true 123 9876543210 abcdefghij 3.14 6.28 123.4567 varcharval stringval

-- !insert04 --
true 1 1000 2.3 value_for_pt1 value_for_pt2

-- !insert05 --
true 1 1000 2.3
true 1 1000 2.3
true 1 1000 2.3

-- !insert06 --
\N 1 1000 1.3
false 1 1000 \N
true 1 1000 2.3
true 1 1000 2.3
true 1 1000 2.3

-- !ctas_01 --
1
2
2
3
3

-- !ctas_02 --
11 value_for_pt1 value_for_pt2
22 value_for_pt11 value_for_pt22
22 value_for_pt11 value_for_pt22

-- !ctas_03 --
1 string value for col2
1 string value for col2
2 another string value for col2
2 another string value for col2
3 yet another string value for col2
3 yet another string value for col2

-- !ctas_04 --
11 value_for_pt1 value_for_pt2
11 value_for_pt1 value_for_pt2
22 value_for_pt11 value_for_pt22
22 value_for_pt11 value_for_pt22

-- !ctas_05 --
1 string value for col2
2 another string value for col2
3 yet another string value for col2

-- !ctas_06 --
11 value_for_pt1 value_for_pt2
22 value_for_pt11 value_for_pt22

-- !complex_type01 --
a \N \N \N \N \N \N \N \N \N ["char1", "char2"] ["c", "d"] ["string1", "string2"] [{1:"a"}, {2:"b"}] {1234567890123456789:"a"} {1234567890123456789:0.12345678} {"key":["char1", "char2"]} {"id": 1, "gender": 1, "name": "John Doe"} {"scale": 123.4567, "metric": ["metric1", "metric2"]} \N
a b c d e 1.1 12345 0.12345678 string \N \N \N \N \N \N \N \N \N \N \N
a b c d e 1.1 12345 0.12345678 string [0.001, 0.002] ["char1", "char2"] ["c", "d"] ["string1", "string2"] [{1:"a"}, {2:"b"}] {1234567890123456789:"a"} {1234567890123456789:0.12345678} {"key":["char1", "char2"]} {"id": 1, "gender": 1, "name": "John Doe"} {"scale": 123.4567, "metric": ["metric1", "metric2"]} {"codes": [123, 456], "props": {"key1":["char1", "char2"]}}

-- !complex_type02 --
a b c d e 1.1 12345 0.12345678 string \N \N \N \N \N \N \N \N \N \N \N
a b c d e 1.1 12345 0.12345678 string [0.001, 0.002] ["char1", "char2"] ["c", "d"] ["string1", "string2"] [{1:"a"}, {2:"b"}] {1234567890123456789:"a"} {1234567890123456789:0.12345678} {"key":["char1", "char2"]} {"id": 1, "gender": 1, "name": "John Doe"} {"scale": 123.4567, "metric": ["metric1", "metric2"]} {"codes": [123, 456], "props": {"key1":["char1", "char2"]}}
Loading

0 comments on commit 5c934e7

Please sign in to comment.