Skip to content

Commit

Permalink
more test
Browse files Browse the repository at this point in the history
  • Loading branch information
Zouxxyy committed Jan 1, 2024
1 parent 1e021c9 commit f90a98b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ case class WriteIntoPaimonTable(
withBucketCol.mapPartitions(commonBucketProcessor.processPartition)(
withBucketDataEncoder))
case _ =>
throw new UnsupportedOperationException(s"Unsupported bucket mode $bucketMode")
throw new UnsupportedOperationException(
s"Write with bucket mode $bucketMode is not supported")
}

val commitMessages = df
Expand Down Expand Up @@ -208,7 +209,7 @@ case class WriteIntoPaimonTable(
} catch {
case e: Throwable => throw new RuntimeException(e);
} finally {
tableCommit.close();
tableCommit.close()
}

Seq.empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,23 @@ class DynamicBucketTableTest extends PaimonSparkTestBase {
spark.sql("SELECT DISTINCT bucket FROM `T$FILES`"),
Row(0) :: Row(1) :: Row(2) :: Nil)
}

test(s"Paimon dynamic bucket table: write with global dynamic bucket") {
spark.sql(s"""
|CREATE TABLE T (
| pk STRING,
| v STRING,
| pt STRING)
|TBLPROPERTIES (
| 'primary-key' = 'pk',
| 'bucket' = '-1'
|)
|PARTITIONED BY (pt)
|""".stripMargin)

val error = intercept[UnsupportedOperationException] {
spark.sql("INSERT INTO T VALUES ('1', 'a', 'p')")
}.getMessage
assert(error.contains("Write with bucket mode GLOBAL_DYNAMIC is not supported"))
}
}

0 comments on commit f90a98b

Please sign in to comment.