Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
loneylee committed Aug 30, 2024
1 parent c74937a commit 3924228
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ trait ClickHouseTableV2Base {
Some(orderByKeys)
} else {
val orderByKeys = getCommaSeparatedColumns("orderByKey")
if (orderByKeys.nonEmpty) {
if (orderByKeys.isDefined) {
val invalidKeys = orderByKeys.get.intersect(partitionColumns)
if (invalidKeys.nonEmpty) {
throw new IllegalStateException(
Expand All @@ -127,7 +127,11 @@ trait ClickHouseTableV2Base {
lazy val primaryKeyOption: Option[Seq[String]] = {
if (orderByKeyOption.isDefined) {
val primaryKeys = getCommaSeparatedColumns("primaryKey")
if (!orderByKeyOption.get.mkString(",").startsWith(primaryKeys.get.mkString(","))) {
if (
primaryKeys.isDefined && !orderByKeyOption.get
.mkString(",")
.startsWith(primaryKeys.get.mkString(","))
) {
throw new IllegalStateException(
s"Primary key $primaryKeys must be a prefix of the sorting key")
}
Expand Down

0 comments on commit 3924228

Please sign in to comment.