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

haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb-extras.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e48d26  style: change spotless like iotdb (#70)
3e48d26 is described below

commit 3e48d26f65883c1d147010f11228310bdfa1e512
Author: CritasWang <[email protected]>
AuthorDate: Fri May 9 10:59:55 2025 +0800

    style: change spotless like iotdb (#70)
---
 .../apache/iotdb/hadoop/tsfile/TSFInputFormat.java |  6 +++
 .../iotdb/hadoop/tsfile/TSFRecordReader.java       |  2 +
 .../iotdb/hadoop/tsfile/record/HDFSTSRecord.java   |  2 +
 .../org/apache/iotdb/hive/TSFHiveRecordReader.java |  2 +
 examples/iotdb-spring-boot-start/pom.xml           | 29 +++++++++++
 .../IoTDBSpringBootStartApplication.java           |  7 ++-
 .../service/IoTDBService.java                      | 59 +++++++++++-----------
 .../SpringBootIoTDBApplicationTests.java           | 18 +++----
 .../apache/iotdb/pulsar/PulsarConsumerThread.java  |  1 +
 pom.xml                                            | 31 ++++--------
 10 files changed, 91 insertions(+), 66 deletions(-)

diff --git 
a/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/TSFInputFormat.java
 
b/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/TSFInputFormat.java
index f38cc08..a943db9 100644
--- 
a/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/TSFInputFormat.java
+++ 
b/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/TSFInputFormat.java
@@ -47,16 +47,22 @@ public class TSFInputFormat extends 
FileInputFormat<NullWritable, MapWritable> {
 
   /** key to configure whether reading time enable */
   public static final String READ_TIME_ENABLE = "tsfile.read.time.enable";
+
   /** key to configure whether reading deltaObjectId enable */
   public static final String READ_DELTAOBJECT_ENABLE = 
"tsfile.read.deltaObjectId.enable";
+
   /** key to configure the type of filter */
   @Deprecated public static final String FILTER_TYPE = "tsfile.filter.type";
+
   /** key to configure the filter */
   @Deprecated public static final String FILTER_EXPRESSION = 
"tsfile.filter.expression";
+
   /** key to configure whether filtering is enable */
   public static final String FILTER_EXIST = "tsfile.filter.exist";
+
   /** key to configure the reading deltaObjectIds */
   public static final String READ_DELTAOBJECTS = "tsfile.read.deltaobject";
+
   /** key to configure the reading measurementIds */
   public static final String READ_MEASUREMENTID = "tsfile.read.measurement";
 
diff --git 
a/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/TSFRecordReader.java
 
b/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/TSFRecordReader.java
index 49bcf86..ab21d06 100644
--- 
a/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/TSFRecordReader.java
+++ 
b/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/TSFRecordReader.java
@@ -55,6 +55,7 @@ public class TSFRecordReader extends 
RecordReader<NullWritable, MapWritable> imp
 
   /** all */
   private List<QueryDataSet> dataSetList = new ArrayList<>();
+
   /**
    * List for name of devices. The order corresponds to the order of 
dataSetList. Means that
    * deviceIdList[i] is the name of device for dataSetList[i].
@@ -62,6 +63,7 @@ public class TSFRecordReader extends 
RecordReader<NullWritable, MapWritable> imp
   private List<String> deviceIdList = new ArrayList<>();
 
   private List<Field> fields = null;
+
   /** The index of QueryDataSet that is currently processed */
   private int currentIndex = 0;
 
diff --git 
a/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/record/HDFSTSRecord.java
 
b/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/record/HDFSTSRecord.java
index cdf9796..ffa49c4 100644
--- 
a/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/record/HDFSTSRecord.java
+++ 
b/connectors/hadoop/src/main/java/org/apache/iotdb/hadoop/tsfile/record/HDFSTSRecord.java
@@ -43,8 +43,10 @@ public class HDFSTSRecord implements Writable {
 
   /** timestamp of this TSRecord. */
   private long time;
+
   /** deviceId of this TSRecord. */
   private String deviceId;
+
   /** all value of this TSRecord. */
   private List<DataPoint> dataPointList = new ArrayList<>();
 
diff --git 
a/connectors/hive-connector/src/main/java/org/apache/iotdb/hive/TSFHiveRecordReader.java
 
b/connectors/hive-connector/src/main/java/org/apache/iotdb/hive/TSFHiveRecordReader.java
index b99869b..9603318 100644
--- 
a/connectors/hive-connector/src/main/java/org/apache/iotdb/hive/TSFHiveRecordReader.java
+++ 
b/connectors/hive-connector/src/main/java/org/apache/iotdb/hive/TSFHiveRecordReader.java
@@ -47,11 +47,13 @@ public class TSFHiveRecordReader implements 
RecordReader<NullWritable, MapWritab
 
   /** all datasets corresponding to one specific split */
   private List<QueryDataSet> dataSetList = new ArrayList<>();
+
   /**
    * List for name of devices. The order corresponds to the order of 
dataSetList. Means that
    * deviceIdList[i] is the name of device for dataSetList[i].
    */
   private List<String> deviceIdList = new ArrayList<>();
+
   /** The index of QueryDataSet that is currently processed */
   private int currentIndex = 0;
 
diff --git a/examples/iotdb-spring-boot-start/pom.xml 
b/examples/iotdb-spring-boot-start/pom.xml
index 8090af8..71efaf0 100644
--- a/examples/iotdb-spring-boot-start/pom.xml
+++ b/examples/iotdb-spring-boot-start/pom.xml
@@ -37,6 +37,8 @@
         <java.version>17</java.version>
         <spring-boot.version>3.4.5</spring-boot.version>
         <spring.version>6.2.6</spring.version>
+        <google.java.format.version>1.22.0</google.java.format.version>
+        <spotless.version>2.43.0</spotless.version>
     </properties>
     <dependencies>
         <dependency>
@@ -60,6 +62,33 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>com.diffplug.spotless</groupId>
+                <artifactId>spotless-maven-plugin</artifactId>
+                <version>${spotless.version}</version>
+                <configuration>
+                    <java>
+                        <googleJavaFormat>
+                            <version>${google.java.format.version}</version>
+                            <style>GOOGLE</style>
+                        </googleJavaFormat>
+                        <importOrder>
+                            <order>org.apache.iotdb,,javax,java,\#</order>
+                        </importOrder>
+                        <removeUnusedImports/>
+                    </java>
+                    <lineEndings>UNIX</lineEndings>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>spotless-check</id>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                        <phase>validate</phase>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 </project>
diff --git 
a/examples/iotdb-spring-boot-start/src/main/java/org/apache/iotdb/iotdbspringbootstartexample/IoTDBSpringBootStartApplication.java
 
b/examples/iotdb-spring-boot-start/src/main/java/org/apache/iotdb/iotdbspringbootstartexample/IoTDBSpringBootStartApplication.java
index 367fe3a..1df0b0b 100644
--- 
a/examples/iotdb-spring-boot-start/src/main/java/org/apache/iotdb/iotdbspringbootstartexample/IoTDBSpringBootStartApplication.java
+++ 
b/examples/iotdb-spring-boot-start/src/main/java/org/apache/iotdb/iotdbspringbootstartexample/IoTDBSpringBootStartApplication.java
@@ -23,8 +23,7 @@ import 
org.springframework.boot.autoconfigure.SpringBootApplication;
 @SpringBootApplication
 public class IoTDBSpringBootStartApplication {
 
-    public static void main(String[] args) {
-        SpringApplication.run(IoTDBSpringBootStartApplication.class, args);
-    }
-
+  public static void main(String[] args) {
+    SpringApplication.run(IoTDBSpringBootStartApplication.class, args);
+  }
 }
diff --git 
a/examples/iotdb-spring-boot-start/src/main/java/org/apache/iotdb/iotdbspringbootstartexample/service/IoTDBService.java
 
b/examples/iotdb-spring-boot-start/src/main/java/org/apache/iotdb/iotdbspringbootstartexample/service/IoTDBService.java
index 1fe51ab..f749e88 100644
--- 
a/examples/iotdb-spring-boot-start/src/main/java/org/apache/iotdb/iotdbspringbootstartexample/service/IoTDBService.java
+++ 
b/examples/iotdb-spring-boot-start/src/main/java/org/apache/iotdb/iotdbspringbootstartexample/service/IoTDBService.java
@@ -24,7 +24,7 @@ import org.apache.iotdb.isession.pool.ITableSessionPool;
 import org.apache.iotdb.isession.pool.SessionDataSetWrapper;
 import org.apache.iotdb.rpc.IoTDBConnectionException;
 import org.apache.iotdb.rpc.StatementExecutionException;
-import org.apache.iotdb.session.pool.SessionPool;
+
 import org.apache.tsfile.read.common.Field;
 import org.apache.tsfile.read.common.RowRecord;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,38 +35,37 @@ import java.util.List;
 @Service
 public class IoTDBService {
 
-    @Autowired
-    private ITableSessionPool ioTDBSessionPool;
-
-    @Autowired
-    private ISessionPool sessionPool;
+  @Autowired private ITableSessionPool ioTDBSessionPool;
 
+  @Autowired private ISessionPool sessionPool;
 
-    public void queryTableSessionPool() throws IoTDBConnectionException, 
StatementExecutionException {
-        ITableSession tableSession = ioTDBSessionPool.getSession();
-        final SessionDataSet sessionDataSet = 
tableSession.executeQueryStatement("select * from power_data_set limit 10");
-        while (sessionDataSet.hasNext()) {
-            final RowRecord rowRecord = sessionDataSet.next();
-            final List<Field> fields = rowRecord.getFields();
-            for (Field field : fields) {
-                System.out.print(field.getStringValue());
-            }
-            System.out.println();
-        }
-        sessionDataSet.close();
-        tableSession.close();
+  public void queryTableSessionPool() throws IoTDBConnectionException, 
StatementExecutionException {
+    ITableSession tableSession = ioTDBSessionPool.getSession();
+    final SessionDataSet sessionDataSet =
+        tableSession.executeQueryStatement("select * from power_data_set limit 
10");
+    while (sessionDataSet.hasNext()) {
+      final RowRecord rowRecord = sessionDataSet.next();
+      final List<Field> fields = rowRecord.getFields();
+      for (Field field : fields) {
+        System.out.print(field.getStringValue());
+      }
+      System.out.println();
     }
+    sessionDataSet.close();
+    tableSession.close();
+  }
 
-    public void querySessionPool() throws IoTDBConnectionException, 
StatementExecutionException {
-        final SessionDataSetWrapper sessionDataSetWrapper = 
sessionPool.executeQueryStatement("show databases");
-        while (sessionDataSetWrapper.hasNext()) {
-            final RowRecord rowRecord = sessionDataSetWrapper.next();
-            final List<Field> fields = rowRecord.getFields();
-            for (Field field : fields) {
-                System.out.print(field.getStringValue());
-            }
-            System.out.println();
-        }
-        sessionDataSetWrapper.close();
+  public void querySessionPool() throws IoTDBConnectionException, 
StatementExecutionException {
+    final SessionDataSetWrapper sessionDataSetWrapper =
+        sessionPool.executeQueryStatement("show databases");
+    while (sessionDataSetWrapper.hasNext()) {
+      final RowRecord rowRecord = sessionDataSetWrapper.next();
+      final List<Field> fields = rowRecord.getFields();
+      for (Field field : fields) {
+        System.out.print(field.getStringValue());
+      }
+      System.out.println();
     }
+    sessionDataSetWrapper.close();
+  }
 }
diff --git 
a/examples/iotdb-spring-boot-start/src/test/java/org/apache/iotdb/iotdbspringbootstartexample/SpringBootIoTDBApplicationTests.java
 
b/examples/iotdb-spring-boot-start/src/test/java/org/apache/iotdb/iotdbspringbootstartexample/SpringBootIoTDBApplicationTests.java
index d5ec0d9..d004854 100644
--- 
a/examples/iotdb-spring-boot-start/src/test/java/org/apache/iotdb/iotdbspringbootstartexample/SpringBootIoTDBApplicationTests.java
+++ 
b/examples/iotdb-spring-boot-start/src/test/java/org/apache/iotdb/iotdbspringbootstartexample/SpringBootIoTDBApplicationTests.java
@@ -20,20 +20,18 @@ package org.apache.iotdb.iotdbspringbootstartexample;
 import org.apache.iotdb.iotdbspringbootstartexample.service.IoTDBService;
 import org.apache.iotdb.rpc.IoTDBConnectionException;
 import org.apache.iotdb.rpc.StatementExecutionException;
-import org.junit.jupiter.api.Test;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
 @SpringBootTest
 public class SpringBootIoTDBApplicationTests {
 
-    @Autowired
-    private IoTDBService iotdbService;
-
-    // @Test
-    void contextLoads() throws IoTDBConnectionException, 
StatementExecutionException {
-        iotdbService.querySessionPool();
-        iotdbService.queryTableSessionPool();
-    }
+  @Autowired private IoTDBService iotdbService;
 
-}
\ No newline at end of file
+  // @Test
+  void contextLoads() throws IoTDBConnectionException, 
StatementExecutionException {
+    iotdbService.querySessionPool();
+    iotdbService.queryTableSessionPool();
+  }
+}
diff --git 
a/examples/pulsar/src/main/java/org/apache/iotdb/pulsar/PulsarConsumerThread.java
 
b/examples/pulsar/src/main/java/org/apache/iotdb/pulsar/PulsarConsumerThread.java
index fce2baa..a504654 100644
--- 
a/examples/pulsar/src/main/java/org/apache/iotdb/pulsar/PulsarConsumerThread.java
+++ 
b/examples/pulsar/src/main/java/org/apache/iotdb/pulsar/PulsarConsumerThread.java
@@ -47,6 +47,7 @@ public class PulsarConsumerThread implements Runnable {
     this.consumer = consumer;
     Class.forName("org.apache.iotdb.jdbc.IoTDBDriver");
   }
+
   /** insert data to IoTDB */
   private void insert(String data) throws IoTDBConnectionException, 
StatementExecutionException {
     String[] dataArray = data.split(",");
diff --git a/pom.xml b/pom.xml
index 60c940a..06acb41 100644
--- a/pom.xml
+++ b/pom.xml
@@ -78,8 +78,7 @@
         
<flink-shaded-zookeeper-3.version>3.8.1-17.0</flink-shaded-zookeeper-3.version>
         <flink.version>1.17.1</flink.version>
         <fusesource-mqtt-client.version>1.16</fusesource-mqtt-client.version>
-        <!-- JDK1.8 only support google java format 1.7-->
-        <google.java.format.version>1.7</google.java.format.version>
+        <google.java.format.version>1.22.0</google.java.format.version>
         <gson.version>2.10.1</gson.version>
         <guava.version>32.1.2-jre</guava.version>
         <hadoop.version>3.3.6</hadoop.version>
@@ -165,8 +164,7 @@
         <spark-scala.2.12.version>3.5.0</spark-scala.2.12.version>
         <!-- Override this to `true`, if you want to disable spotless -->
         <spotless.skip>false</spotless.skip>
-        <!-- This was the last version to support Java 8 -->
-        <spotless.version>2.27.1</spotless.version>
+        <spotless.version>2.43.0</spotless.version>
         <!-- This is the matching version of spring-boot for spring 5.3.30 -->
         <spring-boot.version>2.7.18</spring-boot.version>
         <!-- This is the last version to support the javax namespace -->
@@ -2025,18 +2023,17 @@
                 <maven.compiler.release>8</maven.compiler.release>
             </properties>
         </profile>
-        <!-- Some APIs were removed in Java 11, so we need to add replacements 
-->
+        <!-- Current version of spotless cannot support JDK11 below -->
         <profile>
-            <id>.java-11-and-above</id>
+            <id>.java-11-below</id>
             <activation>
-                <jdk>[11,)</jdk>
+                <jdk>(,11]</jdk>
             </activation>
             <properties>
-                <!--
-          Change to 1.15.0 will modify many codes (all are javadocs), we 
change it to 1.15.0
-          until: iotdb decides to do not support jdk8.
-        -->
-                <google.java.format.version>1.7</google.java.format.version>
+                <!-- This was the last version to support Java 8, Just for run 
-->
+                <spotless.version>2.27.1</spotless.version>
+                <!-- To avoid format conflicts -->
+                <spotless.skip>true</spotless.skip>
             </properties>
         </profile>
         <!--
@@ -2065,16 +2062,6 @@
                 
<argLine>--add-opens=java.base/java.util.concurrent=ALL-UNNAMED 
--add-opens=java.base/java.lang=ALL-UNNAMED 
--add-opens=java.base/java.util=ALL-UNNAMED 
--add-opens=java.base/java.nio=ALL-UNNAMED 
--add-opens=java.base/java.io=ALL-UNNAMED 
--add-opens=java.base/java.net=ALL-UNNAMED 
--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED 
--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED 
--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add [...]
             </properties>
         </profile>
-        <!-- Current version of spotless cannot support JDK21 -->
-        <profile>
-            <id>.java-21-and-above</id>
-            <activation>
-                <jdk>[21,)</jdk>
-            </activation>
-            <properties>
-                <spotless.skip>true</spotless.skip>
-            </properties>
-        </profile>
         <profile>
             <id>with-springboot</id>
             <modules>

Reply via email to