Package org.apache.iotdb.session
Class Session
- java.lang.Object
-
- org.apache.iotdb.session.Session
-
public class Session extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected intconnectionTimeoutInMsprotected org.apache.iotdb.service.rpc.thrift.EndPointdefaultEndPointprotected SessionConnectiondefaultSessionConnectionprotected java.util.Map<java.lang.String,org.apache.iotdb.service.rpc.thrift.EndPoint>deviceIdToEndpointprotected booleanenableCacheLeaderprotected booleanenableQueryRedirectionprotected booleanenableRPCCompressionprotected java.util.Map<org.apache.iotdb.service.rpc.thrift.EndPoint,SessionConnection>endPointToSessionConnectionprotected intfetchSizeprotected SessionConnectionmetaSessionConnectionstatic java.lang.StringMSG_DONOT_ENABLE_REDIRECTstatic java.lang.StringMSG_UNSUPPORTED_DATA_TYPEprotected java.util.List<java.lang.String>nodeUrlsprotected java.lang.Stringpasswordprotected static org.apache.iotdb.service.rpc.thrift.TSProtocolVersionprotocolVersionprotected intthriftDefaultBufferSizeprotected intthriftMaxFrameSizeprotected java.lang.Stringusernameprotected java.time.ZoneIdzoneId
-
Constructor Summary
Constructors Constructor Description Session(java.lang.String host, int rpcPort)Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password)Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, boolean enableCacheLeader)Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, int fetchSize)Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, int fetchSize, long timeoutInMs)Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, int fetchSize, java.time.ZoneId zoneId, boolean enableCacheLeader)Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, int fetchSize, java.time.ZoneId zoneId, int thriftDefaultBufferSize, int thriftMaxFrameSize, boolean enableCacheLeader)Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, java.time.ZoneId zoneId)Session(java.lang.String host, java.lang.String rpcPort, java.lang.String username, java.lang.String password)Session(java.util.List<java.lang.String> nodeUrls, java.lang.String username, java.lang.String password)Session(java.util.List<java.lang.String> nodeUrls, java.lang.String username, java.lang.String password, int fetchSize)Multiple nodeUrl,If one node down, connect to the next oneSession(java.util.List<java.lang.String> nodeUrls, java.lang.String username, java.lang.String password, int fetchSize, java.time.ZoneId zoneId, int thriftDefaultBufferSize, int thriftMaxFrameSize, boolean enableCacheLeader)Session(java.util.List<java.lang.String> nodeUrls, java.lang.String username, java.lang.String password, java.time.ZoneId zoneId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckTimeseriesExists(java.lang.String path)voidclose()SessionConnectionconstructSessionConnection(Session session, org.apache.iotdb.service.rpc.thrift.EndPoint endpoint, java.time.ZoneId zoneId)voidcreateMultiTimeseries(java.util.List<java.lang.String> paths, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType> dataTypes, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding> encodings, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.CompressionType> compressors, java.util.List<java.util.Map<java.lang.String,java.lang.String>> propsList, java.util.List<java.util.Map<java.lang.String,java.lang.String>> tagsList, java.util.List<java.util.Map<java.lang.String,java.lang.String>> attributesList, java.util.List<java.lang.String> measurementAliasList)voidcreateSchemaTemplate(java.lang.String name, java.util.List<java.lang.String> schemaNames, java.util.List<java.util.List<java.lang.String>> measurements, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType>> dataTypes, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding>> encodings, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.CompressionType> compressors)voidcreateTimeseries(java.lang.String path, org.apache.iotdb.tsfile.file.metadata.enums.TSDataType dataType, org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding encoding, org.apache.iotdb.tsfile.file.metadata.enums.CompressionType compressor)voidcreateTimeseries(java.lang.String path, org.apache.iotdb.tsfile.file.metadata.enums.TSDataType dataType, org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding encoding, org.apache.iotdb.tsfile.file.metadata.enums.CompressionType compressor, java.util.Map<java.lang.String,java.lang.String> props, java.util.Map<java.lang.String,java.lang.String> tags, java.util.Map<java.lang.String,java.lang.String> attributes, java.lang.String measurementAlias)voiddeleteData(java.lang.String path, long endTime)delete data <= time in one timeseriesvoiddeleteData(java.util.List<java.lang.String> paths, long endTime)delete data <= time in multiple timeseriesvoiddeleteData(java.util.List<java.lang.String> paths, long startTime, long endTime)delete data >= startTime and data <= endTime in multiple timeseriesvoiddeleteStorageGroup(java.lang.String storageGroup)voiddeleteStorageGroups(java.util.List<java.lang.String> storageGroups)voiddeleteTimeseries(java.lang.String path)delete a timeseries, including data and schemavoiddeleteTimeseries(java.util.List<java.lang.String> paths)delete some timeseries, including data and schemavoidexecuteNonQueryStatement(java.lang.String sql)execute non query statementSessionDataSetexecuteQueryStatement(java.lang.String sql)execute query sqlSessionDataSetexecuteQueryStatement(java.lang.String sql, long timeoutInMs)execute query sql with explicit timeoutSessionDataSetexecuteRawDataQuery(java.util.List<java.lang.String> paths, long startTime, long endTime)query eg.intgetFetchSize()longgetQueryTimeout()java.lang.StringgetTimeZone()voidinsertRecord(java.lang.String deviceId, long time, java.util.List<java.lang.String> measurements, java.util.List<java.lang.String> values)insert data in one row, if you want improve your performance, please use insertInBatch method or insertBatch methodvoidinsertRecord(java.lang.String deviceId, long time, java.util.List<java.lang.String> measurements, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType> types, java.lang.Object... values)insert data in one row, if you want to improve your performance, please use insertRecords method or insertTablet methodvoidinsertRecord(java.lang.String deviceId, long time, java.util.List<java.lang.String> measurements, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType> types, java.util.List<java.lang.Object> values)insert data in one row, if you want improve your performance, please use insertInBatch method or insertBatch methodvoidinsertRecords(java.util.List<java.lang.String> deviceIds, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<java.lang.String>> valuesList)Insert multiple rows, which can reduce the overhead of network.voidinsertRecords(java.util.List<java.lang.String> deviceIds, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType>> typesList, java.util.List<java.util.List<java.lang.Object>> valuesList)Insert multiple rows, which can reduce the overhead of network.voidinsertRecordsOfOneDevice(java.lang.String deviceId, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType>> typesList, java.util.List<java.util.List<java.lang.Object>> valuesList)Insert multiple rows, which can reduce the overhead of network.voidinsertRecordsOfOneDevice(java.lang.String deviceId, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType>> typesList, java.util.List<java.util.List<java.lang.Object>> valuesList, boolean haveSorted)Insert multiple rows, which can reduce the overhead of network.voidinsertTablet(org.apache.iotdb.tsfile.write.record.Tablet tablet)insert the data of a device.voidinsertTablet(org.apache.iotdb.tsfile.write.record.Tablet tablet, boolean sorted)insert a TabletvoidinsertTablets(java.util.Map<java.lang.String,org.apache.iotdb.tsfile.write.record.Tablet> tablets)insert the data of several deivces.voidinsertTablets(java.util.Map<java.lang.String,org.apache.iotdb.tsfile.write.record.Tablet> tablets, boolean sorted)insert the data of several devices.booleanisEnableQueryRedirection()voidopen()voidopen(boolean enableRPCCompression)voidopen(boolean enableRPCCompression, int connectionTimeoutInMs)voidsetEnableQueryRedirection(boolean enableQueryRedirection)voidsetFetchSize(int fetchSize)voidsetQueryTimeout(long timeoutInMs)voidsetSchemaTemplate(java.lang.String templateName, java.lang.String prefixPath)voidsetStorageGroup(java.lang.String storageGroup)voidsetTimeZone(java.lang.String zoneId)protected voidsortTablet(org.apache.iotdb.tsfile.write.record.Tablet tablet)voidtestInsertRecord(java.lang.String deviceId, long time, java.util.List<java.lang.String> measurements, java.util.List<java.lang.String> values)This method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in clientvoidtestInsertRecord(java.lang.String deviceId, long time, java.util.List<java.lang.String> measurements, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType> types, java.util.List<java.lang.Object> values)This method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in clientvoidtestInsertRecords(java.util.List<java.lang.String> deviceIds, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<java.lang.String>> valuesList)This method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in clientvoidtestInsertRecords(java.util.List<java.lang.String> deviceIds, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType>> typesList, java.util.List<java.util.List<java.lang.Object>> valuesList)This method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in clientvoidtestInsertTablet(org.apache.iotdb.tsfile.write.record.Tablet tablet)This method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in clientvoidtestInsertTablet(org.apache.iotdb.tsfile.write.record.Tablet tablet, boolean sorted)This method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in clientvoidtestInsertTablets(java.util.Map<java.lang.String,org.apache.iotdb.tsfile.write.record.Tablet> tablets)This method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in clientvoidtestInsertTablets(java.util.Map<java.lang.String,org.apache.iotdb.tsfile.write.record.Tablet> tablets, boolean sorted)This method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in client
-
-
-
Field Detail
-
protocolVersion
protected static final org.apache.iotdb.service.rpc.thrift.TSProtocolVersion protocolVersion
-
MSG_UNSUPPORTED_DATA_TYPE
public static final java.lang.String MSG_UNSUPPORTED_DATA_TYPE
- See Also:
- Constant Field Values
-
MSG_DONOT_ENABLE_REDIRECT
public static final java.lang.String MSG_DONOT_ENABLE_REDIRECT
- See Also:
- Constant Field Values
-
nodeUrls
protected java.util.List<java.lang.String> nodeUrls
-
username
protected java.lang.String username
-
password
protected java.lang.String password
-
fetchSize
protected int fetchSize
-
enableRPCCompression
protected boolean enableRPCCompression
-
connectionTimeoutInMs
protected int connectionTimeoutInMs
-
zoneId
protected java.time.ZoneId zoneId
-
thriftDefaultBufferSize
protected int thriftDefaultBufferSize
-
thriftMaxFrameSize
protected int thriftMaxFrameSize
-
defaultEndPoint
protected org.apache.iotdb.service.rpc.thrift.EndPoint defaultEndPoint
-
defaultSessionConnection
protected SessionConnection defaultSessionConnection
-
enableCacheLeader
protected boolean enableCacheLeader
-
metaSessionConnection
protected SessionConnection metaSessionConnection
-
deviceIdToEndpoint
protected volatile java.util.Map<java.lang.String,org.apache.iotdb.service.rpc.thrift.EndPoint> deviceIdToEndpoint
-
endPointToSessionConnection
protected volatile java.util.Map<org.apache.iotdb.service.rpc.thrift.EndPoint,SessionConnection> endPointToSessionConnection
-
enableQueryRedirection
protected boolean enableQueryRedirection
-
-
Constructor Detail
-
Session
public Session(java.lang.String host, int rpcPort)
-
Session
public Session(java.lang.String host, java.lang.String rpcPort, java.lang.String username, java.lang.String password)
-
Session
public Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password)
-
Session
public Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, int fetchSize)
-
Session
public Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, int fetchSize, long timeoutInMs)
-
Session
public Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, java.time.ZoneId zoneId)
-
Session
public Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, boolean enableCacheLeader)
-
Session
public Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, int fetchSize, java.time.ZoneId zoneId, boolean enableCacheLeader)
-
Session
public Session(java.lang.String host, int rpcPort, java.lang.String username, java.lang.String password, int fetchSize, java.time.ZoneId zoneId, int thriftDefaultBufferSize, int thriftMaxFrameSize, boolean enableCacheLeader)
-
Session
public Session(java.util.List<java.lang.String> nodeUrls, java.lang.String username, java.lang.String password)
-
Session
public Session(java.util.List<java.lang.String> nodeUrls, java.lang.String username, java.lang.String password, int fetchSize)Multiple nodeUrl,If one node down, connect to the next one- Parameters:
nodeUrls- ListMultiple ip:rpcPort eg.127.0.0.1:9001
-
Session
public Session(java.util.List<java.lang.String> nodeUrls, java.lang.String username, java.lang.String password, java.time.ZoneId zoneId)
-
Session
public Session(java.util.List<java.lang.String> nodeUrls, java.lang.String username, java.lang.String password, int fetchSize, java.time.ZoneId zoneId, int thriftDefaultBufferSize, int thriftMaxFrameSize, boolean enableCacheLeader)
-
-
Method Detail
-
setFetchSize
public void setFetchSize(int fetchSize)
-
getFetchSize
public int getFetchSize()
-
open
public void open() throws org.apache.iotdb.rpc.IoTDBConnectionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionException
-
open
public void open(boolean enableRPCCompression) throws org.apache.iotdb.rpc.IoTDBConnectionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionException
-
open
public void open(boolean enableRPCCompression, int connectionTimeoutInMs) throws org.apache.iotdb.rpc.IoTDBConnectionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionException
-
close
public void close() throws org.apache.iotdb.rpc.IoTDBConnectionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionException
-
constructSessionConnection
public SessionConnection constructSessionConnection(Session session, org.apache.iotdb.service.rpc.thrift.EndPoint endpoint, java.time.ZoneId zoneId) throws org.apache.iotdb.rpc.IoTDBConnectionException
- Throws:
org.apache.iotdb.rpc.IoTDBConnectionException
-
getTimeZone
public java.lang.String getTimeZone()
-
setTimeZone
public void setTimeZone(java.lang.String zoneId) throws org.apache.iotdb.rpc.StatementExecutionException, org.apache.iotdb.rpc.IoTDBConnectionException- Throws:
org.apache.iotdb.rpc.StatementExecutionExceptionorg.apache.iotdb.rpc.IoTDBConnectionException
-
setStorageGroup
public void setStorageGroup(java.lang.String storageGroup) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
deleteStorageGroup
public void deleteStorageGroup(java.lang.String storageGroup) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
deleteStorageGroups
public void deleteStorageGroups(java.util.List<java.lang.String> storageGroups) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
setSchemaTemplate
public void setSchemaTemplate(java.lang.String templateName, java.lang.String prefixPath) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
createSchemaTemplate
public void createSchemaTemplate(java.lang.String name, java.util.List<java.lang.String> schemaNames, java.util.List<java.util.List<java.lang.String>> measurements, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType>> dataTypes, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding>> encodings, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.CompressionType> compressors) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionException- Parameters:
name- template nameschemaNames- list of schema names, if this measurement is vector, name it. if this measurement is not vector, keep this name as same as measurement's namemeasurements- List of measurements, if it is a single measurement, just put it's name into a list and add to measurements if it is a vector measurement, put all measurements of the vector into a list and add to measurementsdataTypes- List of datatypes, if it is a single measurement, just put it's type into a list and add to dataTypes if it is a vector measurement, put all types of the vector into a list and add to dataTypesencodings- List of encodings, if it is a single measurement, just put it's encoding into a list and add to encodings if it is a vector measurement, put all encodings of the vector into a list and add to encodingscompressors- List of compressors- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
createTimeseries
public void createTimeseries(java.lang.String path, org.apache.iotdb.tsfile.file.metadata.enums.TSDataType dataType, org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding encoding, org.apache.iotdb.tsfile.file.metadata.enums.CompressionType compressor) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
createTimeseries
public void createTimeseries(java.lang.String path, org.apache.iotdb.tsfile.file.metadata.enums.TSDataType dataType, org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding encoding, org.apache.iotdb.tsfile.file.metadata.enums.CompressionType compressor, java.util.Map<java.lang.String,java.lang.String> props, java.util.Map<java.lang.String,java.lang.String> tags, java.util.Map<java.lang.String,java.lang.String> attributes, java.lang.String measurementAlias) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
createMultiTimeseries
public void createMultiTimeseries(java.util.List<java.lang.String> paths, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType> dataTypes, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding> encodings, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.CompressionType> compressors, java.util.List<java.util.Map<java.lang.String,java.lang.String>> propsList, java.util.List<java.util.Map<java.lang.String,java.lang.String>> tagsList, java.util.List<java.util.Map<java.lang.String,java.lang.String>> attributesList, java.util.List<java.lang.String> measurementAliasList) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
checkTimeseriesExists
public boolean checkTimeseriesExists(java.lang.String path) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionException- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
setQueryTimeout
public void setQueryTimeout(long timeoutInMs) throws org.apache.iotdb.rpc.StatementExecutionException- Throws:
org.apache.iotdb.rpc.StatementExecutionException
-
getQueryTimeout
public long getQueryTimeout()
-
executeQueryStatement
public SessionDataSet executeQueryStatement(java.lang.String sql) throws org.apache.iotdb.rpc.StatementExecutionException, org.apache.iotdb.rpc.IoTDBConnectionException
execute query sql- Parameters:
sql- query statement- Returns:
- result set
- Throws:
org.apache.iotdb.rpc.StatementExecutionExceptionorg.apache.iotdb.rpc.IoTDBConnectionException
-
executeQueryStatement
public SessionDataSet executeQueryStatement(java.lang.String sql, long timeoutInMs) throws org.apache.iotdb.rpc.StatementExecutionException, org.apache.iotdb.rpc.IoTDBConnectionException
execute query sql with explicit timeout- Parameters:
sql- query statementtimeoutInMs- the timeout of this query, in milliseconds- Returns:
- result set
- Throws:
org.apache.iotdb.rpc.StatementExecutionExceptionorg.apache.iotdb.rpc.IoTDBConnectionException
-
executeNonQueryStatement
public void executeNonQueryStatement(java.lang.String sql) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionexecute non query statement- Parameters:
sql- non query statement- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
executeRawDataQuery
public SessionDataSet executeRawDataQuery(java.util.List<java.lang.String> paths, long startTime, long endTime) throws org.apache.iotdb.rpc.StatementExecutionException, org.apache.iotdb.rpc.IoTDBConnectionException
query eg. select * from paths where time >= startTime and time < endTime time interval include startTime and exclude endTime- Parameters:
paths- series pathstartTime- includedendTime- excluded- Returns:
- data set
- Throws:
org.apache.iotdb.rpc.StatementExecutionException- statement is not rightorg.apache.iotdb.rpc.IoTDBConnectionException- the network is not good
-
insertRecord
public void insertRecord(java.lang.String deviceId, long time, java.util.List<java.lang.String> measurements, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType> types, java.lang.Object... values) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptioninsert data in one row, if you want to improve your performance, please use insertRecords method or insertTablet method- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException- See Also:
insertRecords(List, List, List, List, List),insertTablet(Tablet)
-
insertRecord
public void insertRecord(java.lang.String deviceId, long time, java.util.List<java.lang.String> measurements, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType> types, java.util.List<java.lang.Object> values) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptioninsert data in one row, if you want improve your performance, please use insertInBatch method or insertBatch method- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException- See Also:
insertRecords(List, List, List, List, List),insertTablet(Tablet)
-
insertRecord
public void insertRecord(java.lang.String deviceId, long time, java.util.List<java.lang.String> measurements, java.util.List<java.lang.String> values) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptioninsert data in one row, if you want improve your performance, please use insertInBatch method or insertBatch method- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException- See Also:
insertRecords(List, List, List, List, List),insertTablet(Tablet)
-
insertRecords
public void insertRecords(java.util.List<java.lang.String> deviceIds, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<java.lang.String>> valuesList) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionInsert multiple rows, which can reduce the overhead of network. This method is just like jdbc executeBatch, we pack some insert request in batch and send them to server. If you want improve your performance, please see insertTablet methodEach row is independent, which could have different deviceId, time, number of measurements
- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException- See Also:
insertTablet(Tablet)
-
insertRecords
public void insertRecords(java.util.List<java.lang.String> deviceIds, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType>> typesList, java.util.List<java.util.List<java.lang.Object>> valuesList) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionInsert multiple rows, which can reduce the overhead of network. This method is just like jdbc executeBatch, we pack some insert request in batch and send them to server. If you want improve your performance, please see insertTablet methodEach row is independent, which could have different deviceId, time, number of measurements
- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException- See Also:
insertTablet(Tablet)
-
insertRecordsOfOneDevice
public void insertRecordsOfOneDevice(java.lang.String deviceId, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType>> typesList, java.util.List<java.util.List<java.lang.Object>> valuesList) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionInsert multiple rows, which can reduce the overhead of network. This method is just like jdbc executeBatch, we pack some insert request in batch and send them to server. If you want improve your performance, please see insertTablet methodEach row is independent, which could have different deviceId, time, number of measurements
- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException- See Also:
insertTablet(Tablet)
-
insertRecordsOfOneDevice
public void insertRecordsOfOneDevice(java.lang.String deviceId, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType>> typesList, java.util.List<java.util.List<java.lang.Object>> valuesList, boolean haveSorted) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionInsert multiple rows, which can reduce the overhead of network. This method is just like jdbc executeBatch, we pack some insert request in batch and send them to server. If you want improve your performance, please see insertTablet methodEach row is independent, which could have different deviceId, time, number of measurements
- Parameters:
haveSorted- whether the times have been sorted- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException- See Also:
insertTablet(Tablet)
-
insertTablet
public void insertTablet(org.apache.iotdb.tsfile.write.record.Tablet tablet) throws org.apache.iotdb.rpc.StatementExecutionException, org.apache.iotdb.rpc.IoTDBConnectionExceptioninsert the data of a device. For each timestamp, the number of measurements is the same.a Tablet example: device1 time s1, s2, s3 1, 1, 1, 1 2, 2, 2, 2 3, 3, 3, 3
times in Tablet may be not in ascending order
- Parameters:
tablet- data batch- Throws:
org.apache.iotdb.rpc.StatementExecutionExceptionorg.apache.iotdb.rpc.IoTDBConnectionException
-
insertTablet
public void insertTablet(org.apache.iotdb.tsfile.write.record.Tablet tablet, boolean sorted) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptioninsert a Tablet- Parameters:
tablet- data batchsorted- whether times in Tablet are in ascending order- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
insertTablets
public void insertTablets(java.util.Map<java.lang.String,org.apache.iotdb.tsfile.write.record.Tablet> tablets) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptioninsert the data of several deivces. Given a deivce, for each timestamp, the number of measurements is the same.Times in each Tablet may not be in ascending order
- Parameters:
tablets- data batch in multiple device- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
insertTablets
public void insertTablets(java.util.Map<java.lang.String,org.apache.iotdb.tsfile.write.record.Tablet> tablets, boolean sorted) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptioninsert the data of several devices. Given a device, for each timestamp, the number of measurements is the same.- Parameters:
tablets- data batch in multiple devicesorted- whether times in each Tablet are in ascending order- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
testInsertTablet
public void testInsertTablet(org.apache.iotdb.tsfile.write.record.Tablet tablet) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionThis method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in client- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
testInsertTablet
public void testInsertTablet(org.apache.iotdb.tsfile.write.record.Tablet tablet, boolean sorted) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionThis method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in client- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
testInsertTablets
public void testInsertTablets(java.util.Map<java.lang.String,org.apache.iotdb.tsfile.write.record.Tablet> tablets) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionThis method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in client- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
testInsertTablets
public void testInsertTablets(java.util.Map<java.lang.String,org.apache.iotdb.tsfile.write.record.Tablet> tablets, boolean sorted) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionThis method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in client- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
testInsertRecords
public void testInsertRecords(java.util.List<java.lang.String> deviceIds, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<java.lang.String>> valuesList) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionThis method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in client- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
testInsertRecords
public void testInsertRecords(java.util.List<java.lang.String> deviceIds, java.util.List<java.lang.Long> times, java.util.List<java.util.List<java.lang.String>> measurementsList, java.util.List<java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType>> typesList, java.util.List<java.util.List<java.lang.Object>> valuesList) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionThis method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in client- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
testInsertRecord
public void testInsertRecord(java.lang.String deviceId, long time, java.util.List<java.lang.String> measurements, java.util.List<java.lang.String> values) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionThis method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in client- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
testInsertRecord
public void testInsertRecord(java.lang.String deviceId, long time, java.util.List<java.lang.String> measurements, java.util.List<org.apache.iotdb.tsfile.file.metadata.enums.TSDataType> types, java.util.List<java.lang.Object> values) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptionThis method NOT insert data into database and the server just return after accept the request, this method should be used to test other time cost in client- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
deleteTimeseries
public void deleteTimeseries(java.lang.String path) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptiondelete a timeseries, including data and schema- Parameters:
path- timeseries to delete, should be a whole path- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
deleteTimeseries
public void deleteTimeseries(java.util.List<java.lang.String> paths) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptiondelete some timeseries, including data and schema- Parameters:
paths- timeseries to delete, should be a whole path- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
deleteData
public void deleteData(java.lang.String path, long endTime) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptiondelete data <= time in one timeseries- Parameters:
path- data in which time series to deleteendTime- data with time stamp less than or equal to time will be deleted- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
deleteData
public void deleteData(java.util.List<java.lang.String> paths, long endTime) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptiondelete data <= time in multiple timeseries- Parameters:
paths- data in which time series to deleteendTime- data with time stamp less than or equal to time will be deleted- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
deleteData
public void deleteData(java.util.List<java.lang.String> paths, long startTime, long endTime) throws org.apache.iotdb.rpc.IoTDBConnectionException, org.apache.iotdb.rpc.StatementExecutionExceptiondelete data >= startTime and data <= endTime in multiple timeseries- Parameters:
paths- data in which time series to deletestartTime- delete range start timeendTime- delete range end time- Throws:
org.apache.iotdb.rpc.IoTDBConnectionExceptionorg.apache.iotdb.rpc.StatementExecutionException
-
sortTablet
protected void sortTablet(org.apache.iotdb.tsfile.write.record.Tablet tablet)
-
isEnableQueryRedirection
public boolean isEnableQueryRedirection()
-
setEnableQueryRedirection
public void setEnableQueryRedirection(boolean enableQueryRedirection)
-
-