Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ConeyLiu committed Sep 20, 2023
1 parent f271173 commit 844cb8b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ public void testRewriteWithUntranslatedOrUnconvertedFilter() {
sql(
"CALL %s.system.rewrite_data_files(table => '%s', where => 'substr(c2, 2) = \"fo\"')",
catalogName, tableIdent))
.isInstanceOf(AssertionError.class)
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Cannot convert Spark filter");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public void testRewriteWithUntranslatedOrUnconvertedFilter() throws Exception {
sql(
"CALL %s.system.rewrite_position_delete_files(table => '%s', where => 'substr(data, 2) = \"fo\"')",
catalogName, tableIdent))
.isInstanceOf(AssertionError.class)
.isInstanceOf(IllegalArgumentException.class)
.hasMessageContaining("Cannot convert Spark filter");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ object SparkExpressionConverter {
DataSourceV2Strategy.translateFilterV2(sparkExpression) match {
case Some(filter) =>
val converted = SparkV2Filters.convert(filter)
assert(converted != null, s"Cannot convert Spark filter: $filter to Iceberg expression")
if (converted == null) {
throw new IllegalArgumentException(s"Cannot convert Spark filter: $filter to Iceberg expression")
}

converted
case _ =>
throw new IllegalArgumentException(s"Cannot translate Spark expression: $sparkExpression to data source filter")
Expand Down

0 comments on commit 844cb8b

Please sign in to comment.