This is an automated email from the ASF dual-hosted git repository.

szehon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 4956ec68f Checkstyle: Add rule for %d in Preconditions.checkArgument 
(#5057)
4956ec68f is described below

commit 4956ec68fefcee79bc713b011d8229552c04b450
Author: xrl1 <[email protected]>
AuthorDate: Mon Jun 27 22:12:19 2022 +0300

    Checkstyle: Add rule for %d in Preconditions.checkArgument (#5057)
---
 .baseline/checkstyle/checkstyle.xml                                 | 6 ++++++
 .../src/main/java/org/apache/iceberg/BaseIncrementalAppendScan.java | 4 ++--
 .../java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java | 4 ++--
 .../java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java | 4 ++--
 .../java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java | 4 ++--
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/.baseline/checkstyle/checkstyle.xml 
b/.baseline/checkstyle/checkstyle.xml
index 6513ed298..be92588c4 100644
--- a/.baseline/checkstyle/checkstyle.xml
+++ b/.baseline/checkstyle/checkstyle.xml
@@ -71,6 +71,12 @@
         <property name="format" value="new LinkedHashSet&lt;&gt;\(.*\)"/>
         <property name="message" value="Prefer using Sets.newLinkedHashSet() 
instead."/>
     </module>
+    <module name="RegexpMultiline">
+        <property name="fileExtensions" value="java"/>
+        <property name="matchAcrossLines" value="true"/>
+        <property name="format" 
value="Preconditions\.checkArgument\([^;]+%d[^;]+\);"/>
+        <property name="message" value="Preconditions.checkArgument does not 
support %d. use %s instead"/>
+    </module>
     <module name="SuppressionFilter"> <!-- baseline-gradle: README.md -->
         <property name="file" 
value="${config_loc}/checkstyle-suppressions.xml"/>
     </module>
diff --git 
a/core/src/main/java/org/apache/iceberg/BaseIncrementalAppendScan.java 
b/core/src/main/java/org/apache/iceberg/BaseIncrementalAppendScan.java
index c86682e86..aa6a6412f 100644
--- a/core/src/main/java/org/apache/iceberg/BaseIncrementalAppendScan.java
+++ b/core/src/main/java/org/apache/iceberg/BaseIncrementalAppendScan.java
@@ -51,7 +51,7 @@ class BaseIncrementalAppendScan extends 
BaseScan<IncrementalAppendScan> implemen
   @Override
   public IncrementalAppendScan fromSnapshotInclusive(long fromSnapshotId) {
     Preconditions.checkArgument(table().snapshot(fromSnapshotId) != null,
-        "Cannot find the starting snapshot: %d", fromSnapshotId);
+        "Cannot find the starting snapshot: %s", fromSnapshotId);
     return newRefinedScan(tableOps(), table(), schema(), 
context().fromSnapshotIdInclusive(fromSnapshotId));
   }
 
@@ -65,7 +65,7 @@ class BaseIncrementalAppendScan extends 
BaseScan<IncrementalAppendScan> implemen
   @Override
   public IncrementalAppendScan toSnapshot(long toSnapshotId) {
     Preconditions.checkArgument(table().snapshot(toSnapshotId) != null,
-        "Cannot find end snapshot: %d", toSnapshotId);
+        "Cannot find end snapshot: %s", toSnapshotId);
     return newRefinedScan(tableOps(), table(), schema(),  
context().toSnapshotId(toSnapshotId));
   }
 
diff --git 
a/spark/v3.0/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
 
b/spark/v3.0/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
index 328578674..6cb74aebf 100644
--- 
a/spark/v3.0/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
+++ 
b/spark/v3.0/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
@@ -225,8 +225,8 @@ class AddFilesProcedure extends BaseProcedure {
       // Check to see there are sufficient partition columns to satisfy the 
filter
       Preconditions.checkArgument(partitionFields.size() >= 
partitionFilter.size(),
           "Cannot add data files to target table %s because that table is 
partitioned, " +
-              "but the number of columns in the provided partition filter (%d) 
" +
-              "is greater than the number of partitioned columns in table 
(%d)",
+              "but the number of columns in the provided partition filter (%s) 
" +
+              "is greater than the number of partitioned columns in table 
(%s)",
           table.name(), partitionFilter.size(), partitionFields.size());
 
       // Check for any filters of non existent columns
diff --git 
a/spark/v3.1/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
 
b/spark/v3.1/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
index 328578674..6cb74aebf 100644
--- 
a/spark/v3.1/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
+++ 
b/spark/v3.1/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
@@ -225,8 +225,8 @@ class AddFilesProcedure extends BaseProcedure {
       // Check to see there are sufficient partition columns to satisfy the 
filter
       Preconditions.checkArgument(partitionFields.size() >= 
partitionFilter.size(),
           "Cannot add data files to target table %s because that table is 
partitioned, " +
-              "but the number of columns in the provided partition filter (%d) 
" +
-              "is greater than the number of partitioned columns in table 
(%d)",
+              "but the number of columns in the provided partition filter (%s) 
" +
+              "is greater than the number of partitioned columns in table 
(%s)",
           table.name(), partitionFilter.size(), partitionFields.size());
 
       // Check for any filters of non existent columns
diff --git 
a/spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
 
b/spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
index 7e2253004..a902887f2 100644
--- 
a/spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
+++ 
b/spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/procedures/AddFilesProcedure.java
@@ -222,8 +222,8 @@ class AddFilesProcedure extends BaseProcedure {
       // Check to see there are sufficient partition columns to satisfy the 
filter
       Preconditions.checkArgument(partitionFields.size() >= 
partitionFilter.size(),
           "Cannot add data files to target table %s because that table is 
partitioned, " +
-              "but the number of columns in the provided partition filter (%d) 
" +
-              "is greater than the number of partitioned columns in table 
(%d)",
+              "but the number of columns in the provided partition filter (%s) 
" +
+              "is greater than the number of partitioned columns in table 
(%s)",
           table.name(), partitionFilter.size(), partitionFields.size());
 
       // Check for any filters of non existent columns

Reply via email to