Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ 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].
*/
private List<String> deviceIdList = new ArrayList<>();

private List<Field> fields = null;

/** The index of QueryDataSet that is currently processed */
private int currentIndex = 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
29 changes: 29 additions & 0 deletions examples/iotdb-spring-boot-start/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
@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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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;
Expand All @@ -35,38 +35,37 @@
@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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,18 @@
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;

}
// @Test
void contextLoads() throws IoTDBConnectionException, StatementExecutionException {
iotdbService.querySessionPool();
iotdbService.queryTableSessionPool();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public PulsarConsumerThread(Consumer<?> consumer) throws ClassNotFoundException
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(",");
Expand Down
31 changes: 9 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 -->
Expand Down Expand Up @@ -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>
<!--
Expand Down Expand Up @@ -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-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</argLine>
</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>
Expand Down