Class Session


  • public class Session
    extends java.lang.Object
    • 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 one
      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)  
      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
      boolean checkTimeseriesExists​(java.lang.String path)  
      void close()  
      SessionConnection constructSessionConnection​(Session session, org.apache.iotdb.service.rpc.thrift.EndPoint endpoint, java.time.ZoneId zoneId)  
      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)  
      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)  
      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)  
      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)  
      void deleteData​(java.lang.String path, long endTime)
      delete data <= time in one timeseries
      void deleteData​(java.util.List<java.lang.String> paths, long endTime)
      delete data <= time in multiple timeseries
      void deleteData​(java.util.List<java.lang.String> paths, long startTime, long endTime)
      delete data >= startTime and data <= endTime in multiple timeseries
      void deleteStorageGroup​(java.lang.String storageGroup)  
      void deleteStorageGroups​(java.util.List<java.lang.String> storageGroups)  
      void deleteTimeseries​(java.lang.String path)
      delete a timeseries, including data and schema
      void deleteTimeseries​(java.util.List<java.lang.String> paths)
      delete some timeseries, including data and schema
      void executeNonQueryStatement​(java.lang.String sql)
      execute non query statement
      SessionDataSet executeQueryStatement​(java.lang.String sql)
      execute query sql
      SessionDataSet executeQueryStatement​(java.lang.String sql, long timeoutInMs)
      execute query sql with explicit timeout
      SessionDataSet executeRawDataQuery​(java.util.List<java.lang.String> paths, long startTime, long endTime)
      query eg.
      int getFetchSize()  
      long getQueryTimeout()  
      java.lang.String getTimeZone()  
      void insertRecord​(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 method
      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)
      insert data in one row, if you want to improve your performance, please use insertRecords method or insertTablet method
      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)
      insert data in one row, if you want improve your performance, please use insertInBatch method or insertBatch method
      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)
      Insert multiple rows, which can reduce the overhead of network.
      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)
      Insert multiple rows, which can reduce the overhead of network.
      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)
      Insert multiple rows, which can reduce the overhead of network.
      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)
      Insert multiple rows, which can reduce the overhead of network.
      void insertTablet​(org.apache.iotdb.tsfile.write.record.Tablet tablet)
      insert the data of a device.
      void insertTablet​(org.apache.iotdb.tsfile.write.record.Tablet tablet, boolean sorted)
      insert a Tablet
      void insertTablets​(java.util.Map<java.lang.String,​org.apache.iotdb.tsfile.write.record.Tablet> tablets)
      insert the data of several deivces.
      void insertTablets​(java.util.Map<java.lang.String,​org.apache.iotdb.tsfile.write.record.Tablet> tablets, boolean sorted)
      insert the data of several devices.
      boolean isEnableQueryRedirection()  
      void open()  
      void open​(boolean enableRPCCompression)  
      void open​(boolean enableRPCCompression, int connectionTimeoutInMs)  
      void setEnableQueryRedirection​(boolean enableQueryRedirection)  
      void setFetchSize​(int fetchSize)  
      void setQueryTimeout​(long timeoutInMs)  
      void setSchemaTemplate​(java.lang.String templateName, java.lang.String prefixPath)  
      void setStorageGroup​(java.lang.String storageGroup)  
      void setTimeZone​(java.lang.String zoneId)  
      protected void sortTablet​(org.apache.iotdb.tsfile.write.record.Tablet tablet)  
      void testInsertRecord​(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 client
      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)
      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
      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)
      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
      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)
      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
      void testInsertTablet​(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 client
      void testInsertTablet​(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 client
      void testInsertTablets​(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 client
      void testInsertTablets​(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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
      • enableCacheLeader

        protected boolean enableCacheLeader
      • 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 - List Multiple 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.StatementExecutionException
        org.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.IoTDBConnectionException
        org.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.IoTDBConnectionException
        org.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.IoTDBConnectionException
        org.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.IoTDBConnectionException
        org.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 name
        schemaNames - 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 name
        measurements - 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 measurements
        dataTypes - 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 dataTypes
        encodings - 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 encodings
        compressors - List of compressors
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.IoTDBConnectionException
        org.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.IoTDBConnectionException
        org.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.IoTDBConnectionException
        org.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.IoTDBConnectionException
        org.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.StatementExecutionException
        org.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 statement
        timeoutInMs - the timeout of this query, in milliseconds
        Returns:
        result set
        Throws:
        org.apache.iotdb.rpc.StatementExecutionException
        org.apache.iotdb.rpc.IoTDBConnectionException
      • executeNonQueryStatement

        public void executeNonQueryStatement​(java.lang.String sql)
                                      throws org.apache.iotdb.rpc.IoTDBConnectionException,
                                             org.apache.iotdb.rpc.StatementExecutionException
        execute non query statement
        Parameters:
        sql - non query statement
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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 path
        startTime - included
        endTime - excluded
        Returns:
        data set
        Throws:
        org.apache.iotdb.rpc.StatementExecutionException - statement is not right
        org.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.StatementExecutionException
        insert data in one row, if you want to improve your performance, please use insertRecords method or insertTablet method
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        insert data in one row, if you want improve your performance, please use insertInBatch method or insertBatch method
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        insert data in one row, if you want improve your performance, please use insertInBatch method or insertBatch method
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        Insert 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 method

        Each row is independent, which could have different deviceId, time, number of measurements

        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        Insert 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 method

        Each row is independent, which could have different deviceId, time, number of measurements

        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        Insert 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 method

        Each row is independent, which could have different deviceId, time, number of measurements

        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        Insert 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 method

        Each 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.IoTDBConnectionException
        org.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.IoTDBConnectionException
        insert 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.StatementExecutionException
        org.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.StatementExecutionException
        insert a Tablet
        Parameters:
        tablet - data batch
        sorted - whether times in Tablet are in ascending order
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        insert 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.IoTDBConnectionException
        org.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.StatementExecutionException
        insert the data of several devices. Given a device, for each timestamp, the number of measurements is the same.
        Parameters:
        tablets - data batch in multiple device
        sorted - whether times in each Tablet are in ascending order
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        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
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        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
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        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
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        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
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        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
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        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
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        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
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        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
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.apache.iotdb.rpc.StatementExecutionException
      • deleteTimeseries

        public void deleteTimeseries​(java.lang.String path)
                              throws org.apache.iotdb.rpc.IoTDBConnectionException,
                                     org.apache.iotdb.rpc.StatementExecutionException
        delete a timeseries, including data and schema
        Parameters:
        path - timeseries to delete, should be a whole path
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        delete some timeseries, including data and schema
        Parameters:
        paths - timeseries to delete, should be a whole path
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.apache.iotdb.rpc.StatementExecutionException
      • deleteData

        public void deleteData​(java.lang.String path,
                               long endTime)
                        throws org.apache.iotdb.rpc.IoTDBConnectionException,
                               org.apache.iotdb.rpc.StatementExecutionException
        delete data <= time in one timeseries
        Parameters:
        path - data in which time series to delete
        endTime - data with time stamp less than or equal to time will be deleted
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        delete data <= time in multiple timeseries
        Parameters:
        paths - data in which time series to delete
        endTime - data with time stamp less than or equal to time will be deleted
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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.StatementExecutionException
        delete data >= startTime and data <= endTime in multiple timeseries
        Parameters:
        paths - data in which time series to delete
        startTime - delete range start time
        endTime - delete range end time
        Throws:
        org.apache.iotdb.rpc.IoTDBConnectionException
        org.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)