Skip to content

Commit ed41440

Browse files
committed
fix
1 parent 4d96013 commit ed41440

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

paimon-spark/paimon-spark-ut/src/test/scala/org/apache/paimon/spark/procedure/MigrateFileProcedureTest.scala

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,29 @@ class MigrateFileProcedureTest extends PaimonHiveTestBase {
2626
Seq("parquet", "orc", "avro").foreach(
2727
format => {
2828
test(s"Paimon migrate file procedure: migrate $format non-partitioned table") {
29-
withTable(s"hive_tbl$format", s"paimon_tbl$format") {
29+
withTable(s"hive_tbl1$format", s"paimon_tbl1$format") {
3030
// create hive table
3131
spark.sql(s"""
32-
|CREATE TABLE hive_tbl$format (id STRING, name STRING, pt STRING)
32+
|CREATE TABLE hive_tbl1$format (id STRING, name STRING, pt STRING)
3333
|USING $format
3434
|""".stripMargin)
3535

36-
spark.sql(s"INSERT INTO hive_tbl$format VALUES ('1', 'a', 'p1'), ('2', 'b', 'p2')")
36+
spark.sql(s"INSERT INTO hive_tbl1$format VALUES ('1', 'a', 'p1'), ('2', 'b', 'p2')")
3737

3838
// create paimon table
3939
spark.sql(s"""
40-
|CREATE TABLE paimon_tbl$format (id STRING, name STRING, pt STRING)
40+
|CREATE TABLE paimon_tbl1$format (id STRING, name STRING, pt STRING)
4141
|USING PAIMON
4242
|TBLPROPERTIES ('file.format'='$format', 'bucket'='-1')
4343
|""".stripMargin)
4444

45-
spark.sql(s"INSERT INTO paimon_tbl$format VALUES ('3', 'c', 'p1'), ('4', 'd', 'p2')")
45+
spark.sql(s"INSERT INTO paimon_tbl1$format VALUES ('3', 'c', 'p1'), ('4', 'd', 'p2')")
4646

4747
spark.sql(
48-
s"CALL sys.migrate_table(source_type => 'hive', table => '$hiveDbName.hive_tbl$format', target_table => '$hiveDbName.paimon_tbl$format')")
48+
s"CALL sys.migrate_table(source_type => 'hive', table => '$hiveDbName.hive_tbl1$format', target_table => '$hiveDbName.paimon_tbl1$format')")
4949

5050
checkAnswer(
51-
spark.sql(s"SELECT * FROM paimon_tbl$format ORDER BY id"),
51+
spark.sql(s"SELECT * FROM paimon_tbl1$format ORDER BY id"),
5252
Row("1", "a", "p1") :: Row("2", "b", "p2") :: Row("3", "c", "p1") :: Row(
5353
"4",
5454
"d",
@@ -96,31 +96,31 @@ class MigrateFileProcedureTest extends PaimonHiveTestBase {
9696
format => {
9797
test(
9898
s"Paimon migrate file procedure: migrate $format non-partitioned table with delete source table") {
99-
withTable(s"hive_tbl$format", s"paimon_tbl$format") {
99+
withTable(s"hive_tbl3$format", s"paimon_tbl3$format") {
100100
// create hive table
101101
spark.sql(s"""
102-
|CREATE TABLE hive_tbl$format (id STRING, name STRING, pt STRING)
102+
|CREATE TABLE hive_tbl3$format (id STRING, name STRING, pt STRING)
103103
|USING $format
104104
|""".stripMargin)
105105

106-
spark.sql(s"INSERT INTO hive_tbl$format VALUES ('1', 'a', 'p1'), ('2', 'b', 'p2')")
106+
spark.sql(s"INSERT INTO hive_tbl3$format VALUES ('1', 'a', 'p1'), ('2', 'b', 'p2')")
107107

108108
// create paimon table
109109
spark.sql(s"""
110-
|CREATE TABLE paimon_tbl$format (id STRING, name STRING, pt STRING)
110+
|CREATE TABLE paimon_tbl3$format (id STRING, name STRING, pt STRING)
111111
|USING PAIMON
112112
|TBLPROPERTIES ('file.format'='$format', 'bucket'='-1')
113113
|""".stripMargin)
114114

115-
spark.sql(s"INSERT INTO paimon_tbl$format VALUES ('3', 'c', 'p1'), ('4', 'd', 'p2')")
115+
spark.sql(s"INSERT INTO paimon_tbl3$format VALUES ('3', 'c', 'p1'), ('4', 'd', 'p2')")
116116

117117
spark.sql(
118-
s"CALL sys.migrate_table(source_type => 'hive', table => '$hiveDbName.hive_tbl$format', target_table => '$hiveDbName.paimon_tbl$format', delete_origin => false)")
118+
s"CALL sys.migrate_table(source_type => 'hive', table => '$hiveDbName.hive_tbl3$format', target_table => '$hiveDbName.paimon_tbl3$format', delete_origin => false)")
119119

120-
checkAnswer(spark.sql(s"SELECT * FROM hive_tbl$format ORDER BY id"), Nil)
120+
checkAnswer(spark.sql(s"SELECT * FROM hive_tbl3$format ORDER BY id"), Nil)
121121

122122
checkAnswer(
123-
spark.sql(s"SELECT * FROM paimon_tbl$format ORDER BY id"),
123+
spark.sql(s"SELECT * FROM paimon_tbl3$format ORDER BY id"),
124124
Row("1", "a", "p1") :: Row("2", "b", "p2") :: Row("3", "c", "p1") :: Row(
125125
"4",
126126
"d",
@@ -132,31 +132,31 @@ class MigrateFileProcedureTest extends PaimonHiveTestBase {
132132
Seq("parquet", "orc", "avro").foreach(
133133
format => {
134134
test(s"Paimon migrate file procedure: migrate $format partitioned table") {
135-
withTable(s"hive_tbl$format", s"paimon_tbl$format") {
135+
withTable(s"hive_tbl4$format", s"paimon_tbl4$format") {
136136
// create hive table
137137
spark.sql(s"""
138-
|CREATE TABLE hive_tbl$format (id STRING, name STRING, pt STRING)
138+
|CREATE TABLE hive_tbl4$format (id STRING, name STRING, pt STRING)
139139
|USING $format
140140
|PARTITIONED BY (pt)
141141
|""".stripMargin)
142142

143-
spark.sql(s"INSERT INTO hive_tbl$format VALUES ('1', 'a', 'p1'), ('2', 'b', 'p2')")
143+
spark.sql(s"INSERT INTO hive_tbl4$format VALUES ('1', 'a', 'p1'), ('2', 'b', 'p2')")
144144

145145
// create paimon table
146146
spark.sql(s"""
147-
|CREATE TABLE paimon_tbl$format (id STRING, name STRING, pt STRING)
147+
|CREATE TABLE paimon_tbl4$format (id STRING, name STRING, pt STRING)
148148
|USING PAIMON
149149
|TBLPROPERTIES ('file.format'='$format', 'bucket'='-1')
150150
|PARTITIONED BY (pt)
151151
|""".stripMargin)
152152

153-
spark.sql(s"INSERT INTO paimon_tbl$format VALUES ('3', 'c', 'p1'), ('4', 'd', 'p2')")
153+
spark.sql(s"INSERT INTO paimon_tbl4$format VALUES ('3', 'c', 'p1'), ('4', 'd', 'p2')")
154154

155155
spark.sql(
156-
s"CALL sys.migrate_table(source_type => 'hive', table => '$hiveDbName.hive_tbl$format', target_table => '$hiveDbName.paimon_tbl$format')")
156+
s"CALL sys.migrate_table(source_type => 'hive', table => '$hiveDbName.hive_tbl4$format', target_table => '$hiveDbName.paimon_tbl4$format')")
157157

158158
checkAnswer(
159-
spark.sql(s"SELECT * FROM paimon_tbl$format ORDER BY id"),
159+
spark.sql(s"SELECT * FROM paimon_tbl4$format ORDER BY id"),
160160
Row("1", "a", "p1") :: Row("2", "b", "p2") :: Row("3", "c", "p1") :: Row(
161161
"4",
162162
"d",
@@ -169,37 +169,37 @@ class MigrateFileProcedureTest extends PaimonHiveTestBase {
169169
format => {
170170
test(
171171
s"Paimon migrate file procedure: migrate $format partitioned table with delete source table") {
172-
withTable(s"hive_tbl$format", s"paimon_tbl$format") {
172+
withTable(s"hive_tbl5$format", s"paimon_tbl5$format") {
173173
// create hive table
174174
spark.sql(s"""
175-
|CREATE TABLE hive_tbl$format (id STRING, name STRING, pt STRING)
175+
|CREATE TABLE hive_tbl5$format (id STRING, name STRING, pt STRING)
176176
|USING $format
177177
|PARTITIONED BY (pt)
178178
|""".stripMargin)
179179

180-
spark.sql(s"INSERT INTO hive_tbl$format VALUES ('1', 'a', 'p1'), ('2', 'b', 'p2')")
180+
spark.sql(s"INSERT INTO hive_tbl5$format VALUES ('1', 'a', 'p1'), ('2', 'b', 'p2')")
181181

182182
// create paimon table
183183
spark.sql(s"""
184-
|CREATE TABLE paimon_tbl$format (id STRING, name STRING, pt STRING)
184+
|CREATE TABLE paimon_tbl5$format (id STRING, name STRING, pt STRING)
185185
|USING PAIMON
186186
|TBLPROPERTIES ('file.format'='$format', 'bucket'='-1')
187187
|PARTITIONED BY (pt)
188188
|""".stripMargin)
189189

190-
spark.sql(s"INSERT INTO paimon_tbl$format VALUES ('3', 'c', 'p1'), ('4', 'd', 'p2')")
190+
spark.sql(s"INSERT INTO paimon_tbl5$format VALUES ('3', 'c', 'p1'), ('4', 'd', 'p2')")
191191

192192
spark.sql(
193-
s"CALL sys.migrate_table(source_type => 'hive', table => '$hiveDbName.hive_tbl$format', target_table => '$hiveDbName.paimon_tbl$format', delete_origin => false)")
193+
s"CALL sys.migrate_table(source_type => 'hive', table => '$hiveDbName.hive_tbl5$format', target_table => '$hiveDbName.paimon_tbl5$format', delete_origin => false)")
194194

195195
checkAnswer(
196-
spark.sql(s"SELECT * FROM paimon_tbl$format ORDER BY id"),
196+
spark.sql(s"SELECT * FROM paimon_tbl5$format ORDER BY id"),
197197
Row("1", "a", "p1") :: Row("2", "b", "p2") :: Row("3", "c", "p1") :: Row(
198198
"4",
199199
"d",
200200
"p2") :: Nil)
201201

202-
checkAnswer(spark.sql(s"SELECT * FROM hive_tbl$format ORDER BY id"), Nil)
202+
checkAnswer(spark.sql(s"SELECT * FROM hive_tbl5$format ORDER BY id"), Nil)
203203
}
204204
}
205205
})

0 commit comments

Comments
 (0)