Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iotdb.session;
import org.apache.iotdb.common.rpc.thrift.TAggregationType;
import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.isession.INodeSupplier;
import org.apache.iotdb.isession.ISession;
import org.apache.iotdb.isession.SessionConfig;
import org.apache.iotdb.isession.SessionDataSet;
import org.apache.iotdb.isession.template.Template;
import org.apache.iotdb.isession.util.Version;
import org.apache.iotdb.rpc.BatchExecutionException;
import org.apache.iotdb.rpc.IoTDBConnectionException;
import org.apache.iotdb.rpc.NoValidValueException;
import org.apache.iotdb.rpc.RedirectException;
import org.apache.iotdb.rpc.StatementExecutionException;
import org.apache.iotdb.service.rpc.thrift.TCreateTimeseriesUsingSchemaTemplateReq;
import org.apache.iotdb.service.rpc.thrift.TSAppendSchemaTemplateReq;
import org.apache.iotdb.service.rpc.thrift.TSBackupConfigurationResp;
import org.apache.iotdb.service.rpc.thrift.TSConnectionInfoResp;
import org.apache.iotdb.service.rpc.thrift.TSCreateAlignedTimeseriesReq;
import org.apache.iotdb.service.rpc.thrift.TSCreateMultiTimeseriesReq;
import org.apache.iotdb.service.rpc.thrift.TSCreateSchemaTemplateReq;
import org.apache.iotdb.service.rpc.thrift.TSCreateTimeseriesReq;
import org.apache.iotdb.service.rpc.thrift.TSDeleteDataReq;
import org.apache.iotdb.service.rpc.thrift.TSDropSchemaTemplateReq;
import org.apache.iotdb.service.rpc.thrift.TSInsertRecordReq;
import org.apache.iotdb.service.rpc.thrift.TSInsertRecordsOfOneDeviceReq;
import org.apache.iotdb.service.rpc.thrift.TSInsertRecordsReq;
import org.apache.iotdb.service.rpc.thrift.TSInsertStringRecordReq;
import org.apache.iotdb.service.rpc.thrift.TSInsertStringRecordsOfOneDeviceReq;
import org.apache.iotdb.service.rpc.thrift.TSInsertStringRecordsReq;
import org.apache.iotdb.service.rpc.thrift.TSInsertTabletReq;
import org.apache.iotdb.service.rpc.thrift.TSInsertTabletsReq;
import org.apache.iotdb.service.rpc.thrift.TSProtocolVersion;
import org.apache.iotdb.service.rpc.thrift.TSPruneSchemaTemplateReq;
import org.apache.iotdb.service.rpc.thrift.TSQueryTemplateReq;
import org.apache.iotdb.service.rpc.thrift.TSQueryTemplateResp;
import org.apache.iotdb.service.rpc.thrift.TSSetSchemaTemplateReq;
import org.apache.iotdb.service.rpc.thrift.TSUnsetSchemaTemplateReq;
import org.apache.iotdb.session.template.MeasurementNode;
import org.apache.iotdb.session.template.TemplateQueryType;
import org.apache.iotdb.session.util.SessionUtils;
import org.apache.iotdb.session.util.ThreadUtils;
import org.apache.thrift.TException;
import org.apache.tsfile.enums.TSDataType;
import org.apache.tsfile.file.metadata.enums.CompressionType;
import org.apache.tsfile.file.metadata.enums.TSEncoding;
import org.apache.tsfile.utils.Binary;
import org.apache.tsfile.utils.BitMap;
import org.apache.tsfile.utils.Pair;
import org.apache.tsfile.write.UnSupportedDataTypeException;
import org.apache.tsfile.write.record.Tablet;
import org.apache.tsfile.write.schema.IMeasurementSchema;
import org.apache.tsfile.write.schema.MeasurementSchema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@SuppressWarnings({"java:S107", "java:S1135"}) // need enough parameters, ignore todos
public class Session implements ISession {
private static final Logger logger = LoggerFactory.getLogger(Session.class);
protected static final TSProtocolVersion protocolVersion =
TSProtocolVersion.IOTDB_SERVICE_PROTOCOL_V3;
public static final String MSG_UNSUPPORTED_DATA_TYPE = "Unsupported data type:";
public static final String MSG_DONOT_ENABLE_REDIRECT =
"Query do not enable redirect," + " please confirm the session and server conf.";
private static final ThreadPoolExecutor OPERATION_EXECUTOR =
new ThreadPoolExecutor(
SessionConfig.DEFAULT_SESSION_EXECUTOR_THREAD_NUM,
SessionConfig.DEFAULT_SESSION_EXECUTOR_THREAD_NUM,
0,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(SessionConfig.DEFAULT_SESSION_EXECUTOR_TASK_NUM),
ThreadUtils.createThreadFactory("SessionExecutor", true));
protected List nodeUrls;
protected String username;
protected String password;
protected int fetchSize;
protected boolean useSSL;
protected String trustStore;
protected String trustStorePwd;
/**
* Timeout of query can be set by users. A negative number means using the default configuration
* of server. And value 0 will disable the function of query timeout.
*/
private long queryTimeoutInMs = -1;
protected boolean enableRPCCompression;
protected int connectionTimeoutInMs;
protected ZoneId zoneId;
protected int thriftDefaultBufferSize;
protected int thriftMaxFrameSize;
protected TEndPoint defaultEndPoint;
protected SessionConnection defaultSessionConnection;
private boolean isClosed = true;
// this field only take effect in write request, nothing to do with any other type requests,
// like query, load and so on.
// if set to true, it means that we may redirect the write request to its corresponding leader
// if set to false, it means that we will only send write request to first available DataNode(it
// may be changed while current DataNode is not available, for example, we may retry to connect
// to another available DataNode)
// so even if enableRedirection is set to false, we may also send write request to another
// datanode while encountering retriable errors in current DataNode
protected boolean enableRedirection;
protected boolean enableRecordsAutoConvertTablet =
SessionConfig.DEFAULT_RECORDS_AUTO_CONVERT_TABLET;
private static final double CONVERT_THRESHOLD = 0.5;
private static final double SAMPLE_PROPORTION = 0.05;
private static final int MIN_RECORDS_SIZE = 40;
@SuppressWarnings("squid:S3077") // Non-primitive fields should not be "volatile"
protected volatile Map deviceIdToEndpoint;
@SuppressWarnings("squid:S3077") // Non-primitive fields should not be "volatile"
protected volatile Map endPointToSessionConnection;
// used to update datanodeList periodically
@SuppressWarnings("squid:S3077") // Non-primitive fields should not be "volatile"
protected volatile ScheduledExecutorService executorService;
protected INodeSupplier availableNodes;
protected boolean enableQueryRedirection = false;
// The version number of the client which used for compatibility in the server
protected Version version;
// set to true, means that we will start a background thread to fetch all available (Status is
// not Removing) datanodes in cluster, and these available nodes will be used in retrying stage
protected boolean enableAutoFetch = true;
// max retry count, if set to 0, means that we won't do any retry
// we can use any available DataNodes(fetched in background thread if enableAutoFetch is true,
// or nodeUrls user specified) to retry, even if enableRedirection is false
protected int maxRetryCount = SessionConfig.MAX_RETRY_COUNT;
protected long retryIntervalInMs = SessionConfig.RETRY_INTERVAL_IN_MS;
private static final String REDIRECT_TWICE = "redirect twice";
private static final String REDIRECT_TWICE_RETRY = "redirect twice, please try again.";
private static final String VALUES_SIZE_SHOULD_BE_EQUAL =
"times, measurementsList and valuesList's size should be equal";
private static final String SESSION_CANNOT_CONNECT = "Session can not connect to {}";
private static final String ALL_VALUES_ARE_NULL =
"All values are null and this submission is ignored,deviceId is [{}],time is [{}],measurements is [{}]";
private static final String ALL_VALUES_ARE_NULL_WITH_TIME =
"All values are null and this submission is ignored,deviceId is [{}],times are [{}],measurements are [{}]";
private static final String ALL_VALUES_ARE_NULL_MULTI_DEVICES =
"All values are null and this submission is ignored,deviceIds are [{}],times are [{}],measurements are [{}]";
private static final String ALL_INSERT_DATA_IS_NULL = "All inserted data is null.";
public Session(String host, int rpcPort) {
this(
host,
rpcPort,
SessionConfig.DEFAULT_USER,
SessionConfig.DEFAULT_PASSWORD,
SessionConfig.DEFAULT_FETCH_SIZE,
null,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
SessionConfig.DEFAULT_REDIRECTION_MODE,
SessionConfig.DEFAULT_VERSION);
}
public Session(String host, String rpcPort, String username, String password) {
this(
host,
Integer.parseInt(rpcPort),
username,
password,
SessionConfig.DEFAULT_FETCH_SIZE,
null,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
SessionConfig.DEFAULT_REDIRECTION_MODE,
SessionConfig.DEFAULT_VERSION);
}
public Session(String host, int rpcPort, String username, String password) {
this(
host,
rpcPort,
username,
password,
SessionConfig.DEFAULT_FETCH_SIZE,
null,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
SessionConfig.DEFAULT_REDIRECTION_MODE,
SessionConfig.DEFAULT_VERSION);
}
public Session(String host, int rpcPort, String username, String password, int fetchSize) {
this(
host,
rpcPort,
username,
password,
fetchSize,
null,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
SessionConfig.DEFAULT_REDIRECTION_MODE,
SessionConfig.DEFAULT_VERSION);
}
public Session(
String host,
int rpcPort,
String username,
String password,
int fetchSize,
long queryTimeoutInMs) {
this(
host,
rpcPort,
username,
password,
fetchSize,
null,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
SessionConfig.DEFAULT_REDIRECTION_MODE,
SessionConfig.DEFAULT_VERSION);
this.queryTimeoutInMs = queryTimeoutInMs;
}
public Session(String host, int rpcPort, String username, String password, ZoneId zoneId) {
this(
host,
rpcPort,
username,
password,
SessionConfig.DEFAULT_FETCH_SIZE,
zoneId,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
SessionConfig.DEFAULT_REDIRECTION_MODE,
SessionConfig.DEFAULT_VERSION);
}
public Session(
String host, int rpcPort, String username, String password, boolean enableRedirection) {
this(
host,
rpcPort,
username,
password,
SessionConfig.DEFAULT_FETCH_SIZE,
null,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
enableRedirection,
SessionConfig.DEFAULT_VERSION);
}
public Session(
String host,
int rpcPort,
String username,
String password,
int fetchSize,
ZoneId zoneId,
boolean enableRedirection) {
this(
host,
rpcPort,
username,
password,
fetchSize,
zoneId,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
enableRedirection,
SessionConfig.DEFAULT_VERSION);
}
@SuppressWarnings("squid:S107")
public Session(
String host,
int rpcPort,
String username,
String password,
int fetchSize,
ZoneId zoneId,
int thriftDefaultBufferSize,
int thriftMaxFrameSize,
boolean enableRedirection,
Version version) {
this.defaultEndPoint = new TEndPoint(host, rpcPort);
this.username = username;
this.password = password;
this.fetchSize = fetchSize;
this.zoneId = zoneId;
this.thriftDefaultBufferSize = thriftDefaultBufferSize;
this.thriftMaxFrameSize = thriftMaxFrameSize;
this.enableRedirection = enableRedirection;
this.version = version;
}
public Session(List nodeUrls, String username, String password) {
this(
nodeUrls,
username,
password,
SessionConfig.DEFAULT_FETCH_SIZE,
null,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
SessionConfig.DEFAULT_REDIRECTION_MODE,
SessionConfig.DEFAULT_VERSION);
}
/**
* Multiple nodeUrl,If one node down, connect to the next one
*
* @param nodeUrls List Multiple ip:rpcPort eg.127.0.0.1:9001
*/
public Session(List nodeUrls, String username, String password, int fetchSize) {
this(
nodeUrls,
username,
password,
fetchSize,
null,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
SessionConfig.DEFAULT_REDIRECTION_MODE,
SessionConfig.DEFAULT_VERSION);
}
public Session(List nodeUrls, String username, String password, ZoneId zoneId) {
this(
nodeUrls,
username,
password,
SessionConfig.DEFAULT_FETCH_SIZE,
zoneId,
SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
SessionConfig.DEFAULT_MAX_FRAME_SIZE,
SessionConfig.DEFAULT_REDIRECTION_MODE,
SessionConfig.DEFAULT_VERSION);
}
public Session(
List nodeUrls,
String username,
String password,
int fetchSize,
ZoneId zoneId,
int thriftDefaultBufferSize,
int thriftMaxFrameSize,
boolean enableRedirection,
Version version) {
if (nodeUrls.isEmpty()) {
throw new IllegalArgumentException("nodeUrls shouldn't be empty.");
}
this.nodeUrls = nodeUrls;
this.username = username;
this.password = password;
this.fetchSize = fetchSize;
this.zoneId = zoneId;
this.thriftDefaultBufferSize = thriftDefaultBufferSize;
this.thriftMaxFrameSize = thriftMaxFrameSize;
this.enableRedirection = enableRedirection;
this.version = version;
}
public Session(Builder builder) {
if (builder.nodeUrls != null) {
if (builder.nodeUrls.isEmpty()) {
throw new IllegalArgumentException("nodeUrls shouldn't be empty.");
}
this.nodeUrls = builder.nodeUrls;
this.enableQueryRedirection = true;
} else {
this.defaultEndPoint = new TEndPoint(builder.host, builder.rpcPort);
this.enableQueryRedirection = builder.enableRedirection;
}
this.enableRedirection = builder.enableRedirection;
this.enableRecordsAutoConvertTablet = builder.enableRecordsAutoConvertTablet;
this.username = builder.username;
this.password = builder.pw;
this.fetchSize = builder.fetchSize;
this.zoneId = builder.zoneId;
this.thriftDefaultBufferSize = builder.thriftDefaultBufferSize;
this.thriftMaxFrameSize = builder.thriftMaxFrameSize;
this.version = builder.version;
this.useSSL = builder.useSSL;
this.trustStore = builder.trustStore;
this.trustStorePwd = builder.trustStorePwd;
this.enableAutoFetch = builder.enableAutoFetch;
this.maxRetryCount = builder.maxRetryCount;
this.retryIntervalInMs = builder.retryIntervalInMs;
this.queryTimeoutInMs = builder.timeOut;
}
@Override
public void setFetchSize(int fetchSize) {
this.fetchSize = fetchSize;
}
@Override
public int getFetchSize() {
return this.fetchSize;
}
@Override
public Version getVersion() {
return version;
}
@Override
public void setVersion(Version version) {
this.version = version;
}
@Override
public synchronized void open() throws IoTDBConnectionException {
open(false, SessionConfig.DEFAULT_CONNECTION_TIMEOUT_MS);
}
@Override
public synchronized void open(boolean enableRPCCompression) throws IoTDBConnectionException {
open(enableRPCCompression, SessionConfig.DEFAULT_CONNECTION_TIMEOUT_MS);
}
@Override
public synchronized void open(boolean enableRPCCompression, int connectionTimeoutInMs)
throws IoTDBConnectionException {
if (!isClosed) {
return;
}
if (this.executorService != null) {
this.executorService.shutdown();
this.executorService = null;
}
if (this.availableNodes != null) {
this.availableNodes.close();
this.availableNodes = null;
}
if (enableAutoFetch) {
initThreadPool();
this.availableNodes =
NodesSupplier.createNodeSupplier(
getNodeUrls(),
executorService,
username,
password,
zoneId,
thriftDefaultBufferSize,
thriftMaxFrameSize,
connectionTimeoutInMs,
useSSL,
trustStore,
trustStorePwd,
enableRPCCompression,
version.toString());
} else {
this.availableNodes = new DummyNodesSupplier(getNodeUrls());
}
this.enableRPCCompression = enableRPCCompression;
this.connectionTimeoutInMs = connectionTimeoutInMs;
defaultSessionConnection = constructSessionConnection(this, defaultEndPoint, zoneId);
defaultSessionConnection.setEnableRedirect(enableQueryRedirection);
isClosed = false;
if (enableRedirection || enableQueryRedirection) {
deviceIdToEndpoint = new ConcurrentHashMap<>();
endPointToSessionConnection = new ConcurrentHashMap<>();
endPointToSessionConnection.put(defaultEndPoint, defaultSessionConnection);
}
}
private void initThreadPool() {
this.executorService =
Executors.newSingleThreadScheduledExecutor(
r -> {
Thread t =
new Thread(
Thread.currentThread().getThreadGroup(), r, "PeriodicalUpdateDNList", 0);
if (!t.isDaemon()) {
t.setDaemon(true);
}
if (t.getPriority() != Thread.NORM_PRIORITY) {
t.setPriority(Thread.NORM_PRIORITY);
}
return t;
});
}
private List getNodeUrls() {
if (defaultEndPoint != null) {
return Collections.singletonList(defaultEndPoint);
} else {
return SessionUtils.parseSeedNodeUrls(nodeUrls);
}
}
@Override
public synchronized void open(
boolean enableRPCCompression,
int connectionTimeoutInMs,
Map deviceIdToEndpoint,
INodeSupplier nodesSupplier)
throws IoTDBConnectionException {
if (!isClosed) {
return;
}
this.availableNodes = nodesSupplier;
this.enableRPCCompression = enableRPCCompression;
this.connectionTimeoutInMs = connectionTimeoutInMs;
defaultSessionConnection = constructSessionConnection(this, defaultEndPoint, zoneId);
defaultSessionConnection.setEnableRedirect(enableQueryRedirection);
isClosed = false;
if (enableRedirection || enableQueryRedirection) {
this.deviceIdToEndpoint = deviceIdToEndpoint;
endPointToSessionConnection = new ConcurrentHashMap<>();
endPointToSessionConnection.put(defaultEndPoint, defaultSessionConnection);
}
}
@Override
public synchronized void close() throws IoTDBConnectionException {
if (isClosed) {
return;
}
try {
if (enableRedirection) {
for (SessionConnection sessionConnection : endPointToSessionConnection.values()) {
sessionConnection.close();
}
} else {
defaultSessionConnection.close();
}
} finally {
// if executorService is null, it means that availableNodes is got from SessionPool and we
// shouldn't clean that
if (this.executorService != null) {
this.executorService.shutdown();
this.executorService = null;
this.availableNodes.close();
this.availableNodes = null;
}
isClosed = true;
}
}
public SessionConnection constructSessionConnection(
Session session, TEndPoint endpoint, ZoneId zoneId) throws IoTDBConnectionException {
if (endpoint == null) {
return new SessionConnection(
session, zoneId, availableNodes, maxRetryCount, retryIntervalInMs);
}
return new SessionConnection(
session, endpoint, zoneId, availableNodes, maxRetryCount, retryIntervalInMs);
}
@Override
public synchronized String getTimeZone() {
return defaultSessionConnection.getTimeZone();
}
@Override
public synchronized void setTimeZone(String zoneId)
throws StatementExecutionException, IoTDBConnectionException {
defaultSessionConnection.setTimeZone(zoneId);
this.zoneId = ZoneId.of(zoneId);
}
/** Only changes the member variable of the Session object without sending it to server. */
@Override
public void setTimeZoneOfSession(String zoneId) {
defaultSessionConnection.setTimeZoneOfSession(zoneId);
this.zoneId = ZoneId.of(zoneId);
}
@Override
public void setStorageGroup(String storageGroup)
throws IoTDBConnectionException, StatementExecutionException {
defaultSessionConnection.setStorageGroup(storageGroup);
}
@Override
public void deleteStorageGroup(String storageGroup)
throws IoTDBConnectionException, StatementExecutionException {
defaultSessionConnection.deleteStorageGroups(Collections.singletonList(storageGroup));
}
@Override
public void deleteStorageGroups(List storageGroups)
throws IoTDBConnectionException, StatementExecutionException {
defaultSessionConnection.deleteStorageGroups(storageGroups);
}
@Override
public void createDatabase(String database)
throws IoTDBConnectionException, StatementExecutionException {
defaultSessionConnection.setStorageGroup(database);
}
@Override
public void deleteDatabase(String database)
throws IoTDBConnectionException, StatementExecutionException {
defaultSessionConnection.deleteStorageGroups(Collections.singletonList(database));
}
@Override
public void deleteDatabases(List databases)
throws IoTDBConnectionException, StatementExecutionException {
defaultSessionConnection.deleteStorageGroups(databases);
}
@Override
public void createTimeseries(
String path, TSDataType dataType, TSEncoding encoding, CompressionType compressor)
throws IoTDBConnectionException, StatementExecutionException {
TSCreateTimeseriesReq request =
genTSCreateTimeseriesReq(path, dataType, encoding, compressor, null, null, null, null);
defaultSessionConnection.createTimeseries(request);
}
@Override
public void createTimeseries(
String path,
TSDataType dataType,
TSEncoding encoding,
CompressionType compressor,
Map props,
Map tags,
Map attributes,
String measurementAlias)
throws IoTDBConnectionException, StatementExecutionException {
TSCreateTimeseriesReq request =
genTSCreateTimeseriesReq(
path, dataType, encoding, compressor, props, tags, attributes, measurementAlias);
defaultSessionConnection.createTimeseries(request);
}
private TSCreateTimeseriesReq genTSCreateTimeseriesReq(
String path,
TSDataType dataType,
TSEncoding encoding,
CompressionType compressor,
Map props,
Map tags,
Map attributes,
String measurementAlias) {
TSCreateTimeseriesReq request = new TSCreateTimeseriesReq();
request.setPath(path);
request.setDataType(dataType.ordinal());
request.setEncoding(encoding.ordinal());
request.setCompressor(compressor.serialize());
request.setProps(props);
request.setTags(tags);
request.setAttributes(attributes);
request.setMeasurementAlias(measurementAlias);
return request;
}
@Override
public void createAlignedTimeseries(
String deviceId,
List measurements,
List dataTypes,
List encodings,
List compressors,
List measurementAliasList)
throws IoTDBConnectionException, StatementExecutionException {
TSCreateAlignedTimeseriesReq request =
getTSCreateAlignedTimeseriesReq(
deviceId,
measurements,
dataTypes,
encodings,
compressors,
measurementAliasList,
null,
null);
defaultSessionConnection.createAlignedTimeseries(request);
}
@Override
public void createAlignedTimeseries(
String deviceId,
List measurements,
List dataTypes,
List encodings,
List compressors,
List measurementAliasList,
List