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

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


The following commit(s) were added to refs/heads/master by this push:
     new 13e5ef068ee HIVE-28514: Iceberg: Fix checkstyle file to adapt new 
checkstyle version (#5437)(Butao Zhang, reviewed by Raghav Aggarwal, Ayush 
Saxena)
13e5ef068ee is described below

commit 13e5ef068ee6245a9f452e94bb1c34c489311f03
Author: Butao Zhang <[email protected]>
AuthorDate: Fri Sep 13 23:22:07 2024 +0800

    HIVE-28514: Iceberg: Fix checkstyle file to adapt new checkstyle version 
(#5437)(Butao Zhang, reviewed by Raghav Aggarwal, Ayush Saxena)
---
 iceberg/checkstyle/checkstyle.xml                  |  2 +-
 .../org/apache/iceberg/hive/HiveClientPool.java    |  4 +--
 .../iceberg/mr/hive/HiveIcebergMetaHook.java       |  4 +--
 .../iceberg/mr/hive/HiveIcebergStorageHandler.java | 32 +++++++++++-----------
 .../apache/iceberg/mr/hive/IcebergTableUtil.java   | 12 ++++----
 .../iceberg/mr/hive/TestHiveIcebergSelects.java    |  4 +--
 iceberg/pom.xml                                    |  5 ++--
 7 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/iceberg/checkstyle/checkstyle.xml 
b/iceberg/checkstyle/checkstyle.xml
index 8f2cb2f9a1b..1da57070f86 100644
--- a/iceberg/checkstyle/checkstyle.xml
+++ b/iceberg/checkstyle/checkstyle.xml
@@ -448,7 +448,7 @@
           <property name="max" value="12"/>
         </module>
         <module name="JavadocMethod"> <!-- Java Style Guide: Where Javadoc is 
used -->
-            <property name="scope" value="public"/>
+            <property name="accessModifiers" value="public"/>
             <property name="allowMissingParamTags" value="true"/>
             <property name="allowMissingReturnTag" value="true"/>
             <property name="allowedAnnotations" value="Override, Test"/>
diff --git 
a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveClientPool.java
 
b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveClientPool.java
index 604a99d8dfa..08f16e6d122 100644
--- 
a/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveClientPool.java
+++ 
b/iceberg/iceberg-catalog/src/main/java/org/apache/iceberg/hive/HiveClientPool.java
@@ -88,8 +88,8 @@ public class HiveClientPool extends 
ClientPoolImpl<IMetaStoreClient, TException>
 
   @Override
   protected boolean isConnectionException(Exception e) {
-    return super.isConnectionException(e) || (e != null && e instanceof 
MetaException &&
-        e.getMessage().contains("Got exception: 
org.apache.thrift.transport.TTransportException"));
+    return super.isConnectionException(e) || e != null && e instanceof 
MetaException &&
+        e.getMessage().contains("Got exception: 
org.apache.thrift.transport.TTransportException");
   }
 
   @Override
diff --git 
a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
 
b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
index 36905ffb94f..bb44b86734c 100644
--- 
a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
+++ 
b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
@@ -1019,8 +1019,8 @@ public class HiveIcebergMetaHook implements HiveMetaHook {
 
   private boolean isOrcOnlyFiles(org.apache.hadoop.hive.metastore.api.Table 
hmsTable) {
     return 
!"FALSE".equalsIgnoreCase(hmsTable.getParameters().get(ORC_FILES_ONLY)) &&
-        ((hmsTable.getSd().getInputFormat() != null &&
-            
hmsTable.getSd().getInputFormat().toUpperCase().contains(org.apache.iceberg.FileFormat.ORC.name()))
 ||
+        (hmsTable.getSd().getInputFormat() != null &&
+            
hmsTable.getSd().getInputFormat().toUpperCase().contains(org.apache.iceberg.FileFormat.ORC.name())
 ||
             org.apache.iceberg.FileFormat.ORC.name()
                 
.equalsIgnoreCase(hmsTable.getSd().getSerdeInfo().getParameters().get("write.format.default"))
 ||
             org.apache.iceberg.FileFormat.ORC.name()
diff --git 
a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java
 
b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java
index edb3a7a9e16..c572a9991e8 100644
--- 
a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java
+++ 
b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java
@@ -542,15 +542,15 @@ public class HiveIcebergStorageHandler implements 
HiveStoragePredicateHandler, H
         puffinWriter.finish();
 
         statisticsFile =
-          new GenericStatisticsFile(
-            snapshotId,
-            statsPath,
-            puffinWriter.fileSize(),
-            puffinWriter.footerSize(),
-            puffinWriter.writtenBlobsMetadata().stream()
-              .map(GenericBlobMetadata::from)
-              .collect(ImmutableList.toImmutableList())
-          );
+            new GenericStatisticsFile(
+                snapshotId,
+                statsPath,
+                puffinWriter.fileSize(),
+                puffinWriter.footerSize(),
+                puffinWriter.writtenBlobsMetadata().stream()
+                    .map(GenericBlobMetadata::from)
+                    .collect(ImmutableList.toImmutableList())
+            );
       } catch (IOException e) {
         LOG.warn("Unable to write stats to puffin file {}", e.getMessage());
         return false;
@@ -1543,7 +1543,7 @@ public class HiveIcebergStorageHandler implements 
HiveStoragePredicateHandler, H
    * for example in Parquet (in Parquet files Time type is an int64 with 
'time' logical annotation).
    * @param tableProps iceberg table properties
    * @param tableSchema iceberg table schema
-   * @return
+   * @return true if having time type column
    */
   private static boolean hasOrcTimeInSchema(Properties tableProps, Schema 
tableSchema) {
     if 
(!FileFormat.ORC.name().equalsIgnoreCase(tableProps.getProperty(TableProperties.DEFAULT_FILE_FORMAT)))
 {
@@ -1558,7 +1558,7 @@ public class HiveIcebergStorageHandler implements 
HiveStoragePredicateHandler, H
    * check {@link VectorizedParquetRecordReader#checkListColumnSupport} for 
details on nested types under lists
    * @param tableProps iceberg table properties
    * @param tableSchema iceberg table schema
-   * @return
+   * @return true if having nested types
    */
   private static boolean hasParquetNestedTypeWithinListOrMap(Properties 
tableProps, Schema tableSchema) {
     if 
(!FileFormat.PARQUET.name().equalsIgnoreCase(tableProps.getProperty(TableProperties.DEFAULT_FILE_FORMAT)))
 {
@@ -1740,16 +1740,16 @@ public class HiveIcebergStorageHandler implements 
HiveStoragePredicateHandler, H
 
   /**
    * Check the operation type of all snapshots which are newer than the 
specified. The specified snapshot is excluded.
-   * @deprecated
-   * <br>Use {@link HiveStorageHandler#getSnapshotContexts(
-   * org.apache.hadoop.hive.ql.metadata.Table hmsTable, SnapshotContext since)}
-   * and check {@link SnapshotContext.WriteOperationType#APPEND}.equals({@link 
SnapshotContext#getOperation()}).
-   *
    * @param hmsTable table metadata stored in Hive Metastore
    * @param since the snapshot preceding the oldest snapshot which should be 
checked.
    *              The value null means all should be checked.
    * @return null if table is empty, true if all snapshots are {@link 
SnapshotContext.WriteOperationType#APPEND}s,
    * false otherwise.
+   *
+   * @deprecated
+   * <br>Use {@link HiveStorageHandler#getSnapshotContexts(
+   * org.apache.hadoop.hive.ql.metadata.Table hmsTable, SnapshotContext since)}
+   * and check {@link SnapshotContext.WriteOperationType#APPEND}.equals({@link 
SnapshotContext#getOperation()}).
    */
   @Deprecated
   @Override
diff --git 
a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java
 
b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java
index 792265eb184..cd5d5da3b8a 100644
--- 
a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java
+++ 
b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTableUtil.java
@@ -409,9 +409,9 @@ public class IcebergTableUtil {
         CloseableIterable.filter(fileScanTasks, t -> {
           DataFile file = t.asFileScanTask().file();
           return !table.spec().isPartitioned() ||
-              (partitionPath == null && file.specId() != 
table.spec().specId()) ||
-              (partitionPath != null &&
-                  
table.specs().get(file.specId()).partitionToPath(file.partition()).equals(partitionPath));
+              partitionPath == null && file.specId() != table.spec().specId() 
||
+              partitionPath != null &&
+                  
table.specs().get(file.specId()).partitionToPath(file.partition()).equals(partitionPath);
         });
     return 
Lists.newArrayList(CloseableIterable.transform(filteredFileScanTasks, t -> 
t.file()));
   }
@@ -432,9 +432,9 @@ public class IcebergTableUtil {
         CloseableIterable.filter(deletesScanTasks, t -> {
           DeleteFile file = ((PositionDeletesScanTask) t).file();
           return !table.spec().isPartitioned() ||
-              (partitionPath == null && file.specId() != 
table.spec().specId()) ||
-              (partitionPath != null &&
-                  
table.specs().get(file.specId()).partitionToPath(file.partition()).equals(partitionPath));
+              partitionPath == null && file.specId() != table.spec().specId() 
||
+              partitionPath != null &&
+                  
table.specs().get(file.specId()).partitionToPath(file.partition()).equals(partitionPath);
         });
     return 
Lists.newArrayList(CloseableIterable.transform(filteredDeletesScanTasks,
         t -> ((PositionDeletesScanTask) t).file()));
diff --git 
a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSelects.java
 
b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSelects.java
index d46b02d1b2c..8a1cf740067 100644
--- 
a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSelects.java
+++ 
b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSelects.java
@@ -118,7 +118,7 @@ public class TestHiveIcebergSelects extends 
HiveIcebergStorageHandlerWithEngineB
   public void testJoinTablesSupportedTypes() throws IOException {
     for (int i = 0; i < SUPPORTED_TYPES.size(); i++) {
       Type type = SUPPORTED_TYPES.get(i);
-      if ((type == Types.TimestampType.withZone()) && isVectorized && 
fileFormat == FileFormat.ORC) {
+      if (type == Types.TimestampType.withZone() && isVectorized && fileFormat 
== FileFormat.ORC) {
         // ORC/TIMESTAMP_INSTANT is not supported vectorized types for Hive
         continue;
       }
@@ -145,7 +145,7 @@ public class TestHiveIcebergSelects extends 
HiveIcebergStorageHandlerWithEngineB
   public void testSelectDistinctFromTable() throws IOException {
     for (int i = 0; i < SUPPORTED_TYPES.size(); i++) {
       Type type = SUPPORTED_TYPES.get(i);
-      if ((type == Types.TimestampType.withZone()) &&
+      if (type == Types.TimestampType.withZone() &&
           isVectorized && fileFormat == FileFormat.ORC) {
         // ORC/TIMESTAMP_INSTANT is not supported vectorized types for Hive
         continue;
diff --git a/iceberg/pom.xml b/iceberg/pom.xml
index ec002613d78..8ae72ac4186 100644
--- a/iceberg/pom.xml
+++ b/iceberg/pom.xml
@@ -30,7 +30,7 @@
     <iceberg.mockito-core.version>3.4.4</iceberg.mockito-core.version>
     <iceberg.avro.version>1.11.3</iceberg.avro.version>
     <iceberg.kryo.version>5.5.0</iceberg.kryo.version>
-    
<iceberg.checkstyle.plugin.version>3.1.2</iceberg.checkstyle.plugin.version>
+    
<iceberg.checkstyle.plugin.version>3.5.0</iceberg.checkstyle.plugin.version>
     <spotless.maven.plugin.version>2.5.0</spotless.maven.plugin.version>
     
<google.errorprone.javac.version>9+181-r4173-1</google.errorprone.javac.version>
     <google.errorprone.version>2.5.1</google.errorprone.version>
@@ -277,7 +277,8 @@
           
<configLocation>${basedir}/${path.to.iceberg.root}/checkstyle/checkstyle.xml</configLocation>
           
<suppressionsLocation>${basedir}/${path.to.iceberg.root}/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
           <includeTestSourceDirectory>true</includeTestSourceDirectory>
-          <encoding>UTF-8</encoding>
+          <inputEncoding>UTF-8</inputEncoding>
+          <outputEncoding>UTF-8</outputEncoding>
           <consoleOutput>true</consoleOutput>
           <failsOnError>true</failsOnError>
         </configuration>

Reply via email to