Skip to content

Commit

Permalink
UnsupportedOperationException thrown for unimplemented functionality …
Browse files Browse the repository at this point in the history
…in TableSession.
  • Loading branch information
YangYumings committed Dec 27, 2024
1 parent 6a21b80 commit 882c89b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected abstract void insertRecords(
public abstract void insertTablet(Tablet tablet, DeviceSchema deviceSchema)
throws IoTDBConnectionException, StatementExecutionException;

public abstract void init();
public abstract void open();

public abstract void close() throws TsdbException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected void insertRecord(
List<String> measurements,
List<TSDataType> types,
List<Object> values) {
// nothing to do
throw new UnsupportedOperationException("TableSession does not implement this function");
}

@Override
Expand All @@ -89,7 +89,7 @@ protected void insertRecords(
List<List<String>> measurementsList,
List<List<TSDataType>> typesList,
List<List<Object>> valuesList) {
// nothing to do
throw new UnsupportedOperationException("TableSession does not implement this function");
}

@Override
Expand All @@ -105,7 +105,7 @@ public void insertTablet(Tablet tablet, DeviceSchema deviceSchema)
}

@Override
public void init() {
public void open() {
// TableSession combines the build and open operations of the session
}

Expand All @@ -121,22 +121,22 @@ public void close() throws TsdbException {

@Override
public void createSchemaTemplate(Template template) {
// nothing to do
throw new UnsupportedOperationException("TableSession does not implement this function");
}

@Override
public void setStorageGroup(String storageGroup) {
// nothing to do
throw new UnsupportedOperationException("TableSession does not implement this function");
}

@Override
public void setSchemaTemplate(String templateName, String prefixPath) {
// nothing to do
throw new UnsupportedOperationException("TableSession does not implement this function");
}

@Override
public void createTimeseriesUsingSchemaTemplate(List<String> devicePathList) {
// nothing to do
throw new UnsupportedOperationException("TableSession does not implement this function");
}

@Override
Expand All @@ -147,7 +147,7 @@ public void createAlignedTimeseries(
List<TSEncoding> encodings,
List<CompressionType> compressors,
List<String> measurementAliasList) {
// nothing to do
throw new UnsupportedOperationException("TableSession does not implement this function");
}

@Override
Expand All @@ -160,7 +160,7 @@ public void createMultiTimeseries(
List<Map<String, String>> tagsList,
List<Map<String, String>> attributesList,
List<String> measurementAliasList) {
// nothing to do
throw new UnsupportedOperationException("TableSession does not implement this function");
}

private ITableSession builderTableSession(List<String> hostUrls) throws IoTDBConnectionException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void insertTablet(Tablet tablet, DeviceSchema deviceSchema)
}

@Override
public void init() {
public void open() {
try {
if (config.isENABLE_THRIFT_COMPRESSION()) {
session.open(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public Double registerSchema(List<DeviceSchema> schemaList) throws TsdbException
sessionManager = new TableSessionManager(dbConfig);
} else {
sessionManager = new TreeSessionManager(dbConfig);
sessionManager.init();
}
sessionManager.open();
sessionManagerListMap.put(sessionManager, createTimeseries(schemaList));
modelStrategy.registerSchema(sessionManagerListMap, schemaList);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -152,11 +151,10 @@ private Template createTemplate(DeviceSchema deviceSchema) {

/** register template */
private void registerTemplate(SessionManager metaSession, Template template)
throws IoTDBConnectionException, IOException, TsdbException {
throws TsdbException {
try {
metaSession.createSchemaTemplate(template);
} catch (StatementExecutionException e) {
// do nothing
} catch (Exception e) {
handleRegisterException(e);
}
}
Expand Down

0 comments on commit 882c89b

Please sign in to comment.