This is an automated email from the ASF dual-hosted git repository.
jackietien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new f1cfc48867d Support database properties in table model
f1cfc48867d is described below
commit f1cfc48867dcdc6017868fb9940f9e625204272e
Author: Caideyipi <[email protected]>
AuthorDate: Wed Sep 18 11:21:41 2024 +0800
Support database properties in table model
---
.../relational/it/schema/IoTDBDatabaseIT.java | 44 ++++++-
.../iotdb/relational/it/schema/IoTDBTableIT.java | 4 +-
.../execution/config/TableConfigTaskVisitor.java | 129 ++++++++++++++++++---
.../config/executor/ClusterConfigTaskExecutor.java | 31 ++---
.../config/executor/IConfigTaskExecutor.java | 5 +-
.../config/metadata/relational/CreateDBTask.java | 22 +++-
.../plan/relational/sql/ast/CreateDB.java | 17 +--
7 files changed, 194 insertions(+), 58 deletions(-)
diff --git
a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java
b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java
index 0ecb5b81e83..a357fda8fc6 100644
---
a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBDatabaseIT.java
@@ -79,10 +79,10 @@ public class IoTDBDatabaseIT {
// create duplicated database with IF NOT EXISTS
statement.execute("create database IF NOT EXISTS test");
- final String[] databaseNames = new String[] {"test"};
- final int[] schemaReplicaFactors = new int[] {1};
- final int[] dataReplicaFactors = new int[] {1};
- final int[] timePartitionInterval = new int[] {604800000};
+ String[] databaseNames = new String[] {"test"};
+ int[] schemaReplicaFactors = new int[] {1};
+ int[] dataReplicaFactors = new int[] {1};
+ int[] timePartitionInterval = new int[] {604800000};
// show
try (final ResultSet resultSet = statement.executeQuery("SHOW
DATABASES")) {
@@ -130,6 +130,42 @@ public class IoTDBDatabaseIT {
// drop nonexistent database with IF EXISTS
statement.execute("drop database IF EXISTS test");
+ // Test create database with properties
+ statement.execute(
+ "create database test_prop with (schema_replication_factor=DEFAULT,
data_replication_factor=3, time_partition_interval=100000)");
+
+ databaseNames = new String[] {"test_prop"};
+ dataReplicaFactors = new int[] {3};
+ timePartitionInterval = new int[] {100000};
+
+ // show
+ try (final ResultSet resultSet = statement.executeQuery("SHOW
DATABASES")) {
+ int cnt = 0;
+ final ResultSetMetaData metaData = resultSet.getMetaData();
+ assertEquals(showDBColumnHeaders.size(), metaData.getColumnCount());
+ for (int i = 0; i < showDBColumnHeaders.size(); i++) {
+ assertEquals(showDBColumnHeaders.get(i).getColumnName(),
metaData.getColumnName(i + 1));
+ }
+ while (resultSet.next()) {
+ assertEquals(databaseNames[cnt], resultSet.getString(1));
+ assertEquals(schemaReplicaFactors[cnt], resultSet.getInt(2));
+ assertEquals(dataReplicaFactors[cnt], resultSet.getInt(3));
+ assertEquals(timePartitionInterval[cnt], resultSet.getLong(4));
+ cnt++;
+ }
+ assertEquals(databaseNames.length, cnt);
+ }
+
+ try {
+ statement.execute("create database test_prop_2 with
(non_exist_prop=DEFAULT)");
+ fail(
+ "create database test_prop_2 shouldn't succeed because the
property key does not exist.");
+ } catch (final SQLException e) {
+ assertTrue(
+ e.getMessage(),
+ e.getMessage().contains("Unsupported database property key:
non_exist_prop"));
+ }
+
// create with strange name
try {
statement.execute("create database 1test");
diff --git
a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java
b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java
index 1bcde880efc..400724e66d0 100644
---
a/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java
@@ -210,7 +210,7 @@ public class IoTDBTableIT {
fail();
} catch (final SQLException e) {
assertEquals(
- "701: TTL' value must be a LongLiteral, but now is NullLiteral,
value: null",
+ "701: ttl value must be a LongLiteral, but now is NullLiteral,
value: null",
e.getMessage());
}
@@ -220,7 +220,7 @@ public class IoTDBTableIT {
fail();
} catch (final SQLException e) {
assertEquals(
- "701: TTL' value must be equal to or greater than 0, but now is:
-1", e.getMessage());
+ "701: ttl value must be equal to or greater than 0, but now is:
-1", e.getMessage());
}
try {
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
index df07c8b60eb..f2d49a6594d 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/TableConfigTaskVisitor.java
@@ -19,8 +19,10 @@
package org.apache.iotdb.db.queryengine.plan.execution.config;
+import org.apache.iotdb.commons.exception.IllegalPathException;
import org.apache.iotdb.commons.schema.table.TsTable;
import org.apache.iotdb.commons.schema.table.column.TsTableColumnCategory;
+import org.apache.iotdb.confignode.rpc.thrift.TDatabaseSchema;
import org.apache.iotdb.db.exception.sql.SemanticException;
import org.apache.iotdb.db.protocol.session.IClientSession;
import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
@@ -84,9 +86,20 @@ import java.util.Locale;
import java.util.Map;
import java.util.Objects;
+import static
org.apache.iotdb.commons.conf.IoTDBConstant.MAX_DATABASE_NAME_LENGTH;
import static
org.apache.iotdb.commons.schema.table.TsTable.TABLE_ALLOWED_PROPERTIES_2_DEFAULT_VALUE_MAP;
+import static org.apache.iotdb.commons.schema.table.TsTable.TTL_PROPERTY;
+import static
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.CreateDBTask.DATA_REGION_GROUP_NUM_KEY;
+import static
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.CreateDBTask.DATA_REPLICATION_FACTOR_KEY;
+import static
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.CreateDBTask.SCHEMA_REGION_GROUP_NUM_KEY;
+import static
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.CreateDBTask.SCHEMA_REPLICATION_FACTOR_KEY;
+import static
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.CreateDBTask.TIME_PARTITION_INTERVAL_KEY;
+import static
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational.CreateDBTask.TTL_KEY;
import static
org.apache.iotdb.db.queryengine.plan.relational.type.InternalTypeManager.getTSDataType;
import static
org.apache.iotdb.db.queryengine.plan.relational.type.TypeSignatureTranslator.toTypeSignature;
+import static org.apache.iotdb.db.utils.constant.SqlConstant.ROOT;
+import static org.apache.tsfile.common.constant.TsFileConstant.PATH_SEPARATOR;
+import static
org.apache.tsfile.common.constant.TsFileConstant.PATH_SEPARATOR_CHAR;
public class TableConfigTaskVisitor extends AstVisitor<IConfigTask,
MPPQueryContext> {
@@ -110,7 +123,67 @@ public class TableConfigTaskVisitor extends
AstVisitor<IConfigTask, MPPQueryCont
@Override
protected IConfigTask visitCreateDB(final CreateDB node, final
MPPQueryContext context) {
context.setQueryType(QueryType.WRITE);
- return new CreateDBTask(node);
+
+ final TDatabaseSchema schema = new TDatabaseSchema();
+
+ final String dbName = node.getDbName();
+ // Check database length here
+ // We need to calculate the database name without "root."
+ if (dbName.contains(PATH_SEPARATOR) || dbName.length() >
MAX_DATABASE_NAME_LENGTH) {
+ throw new SemanticException(
+ new IllegalPathException(
+ node.getDbName(),
+ dbName.contains(PATH_SEPARATOR)
+ ? "The database name shall not contain '.'"
+ : "the length of database name shall not exceed " +
MAX_DATABASE_NAME_LENGTH));
+ }
+ schema.setName(ROOT + PATH_SEPARATOR_CHAR + node.getDbName());
+
+ for (final Property property : node.getProperties()) {
+ final String key =
property.getName().getValue().toLowerCase(Locale.ENGLISH);
+ if (property.isSetToDefault()) {
+ switch (key) {
+ case TTL_KEY:
+ case SCHEMA_REPLICATION_FACTOR_KEY:
+ case DATA_REPLICATION_FACTOR_KEY:
+ case TIME_PARTITION_INTERVAL_KEY:
+ case SCHEMA_REGION_GROUP_NUM_KEY:
+ case DATA_REGION_GROUP_NUM_KEY:
+ break;
+ default:
+ throw new SemanticException("Unsupported database property key: "
+ key);
+ }
+ continue;
+ }
+
+ final Object value = property.getNonDefaultValue();
+
+ switch (key) {
+ case TTL_KEY:
+ schema.setTTL(parseLongFromLiteral(value, TTL_KEY));
+ break;
+ case SCHEMA_REPLICATION_FACTOR_KEY:
+ schema.setSchemaReplicationFactor(
+ parseIntFromLiteral(value, SCHEMA_REPLICATION_FACTOR_KEY));
+ break;
+ case DATA_REPLICATION_FACTOR_KEY:
+ schema.setDataReplicationFactor(parseIntFromLiteral(value,
DATA_REPLICATION_FACTOR_KEY));
+ break;
+ case TIME_PARTITION_INTERVAL_KEY:
+ schema.setTimePartitionInterval(parseLongFromLiteral(value,
TIME_PARTITION_INTERVAL_KEY));
+ break;
+ case SCHEMA_REGION_GROUP_NUM_KEY:
+ schema.setMinSchemaRegionGroupNum(
+ parseIntFromLiteral(value, SCHEMA_REGION_GROUP_NUM_KEY));
+ break;
+ case DATA_REGION_GROUP_NUM_KEY:
+ schema.setMinDataRegionGroupNum(parseIntFromLiteral(value,
DATA_REGION_GROUP_NUM_KEY));
+ break;
+ default:
+ throw new SemanticException("Unsupported database property key: " +
key);
+ }
+ }
+ return new CreateDBTask(schema, node.isSetIfNotExists());
}
@Override
@@ -252,19 +325,10 @@ public class TableConfigTaskVisitor extends
AstVisitor<IConfigTask, MPPQueryCont
continue;
}
// TODO: support validation for other properties
- if (!(value instanceof LongLiteral)) {
- throw new SemanticException(
- "TTL' value must be a LongLiteral, but now is "
- + (Objects.nonNull(value) ?
value.getClass().getSimpleName() : null)
- + ", value: "
- + value);
- }
- final long parsedValue = ((LongLiteral) value).getParsedValue();
- if (parsedValue < 0) {
- throw new SemanticException(
- "TTL' value must be equal to or greater than 0, but now is: "
+ value);
- }
- map.put(key, String.valueOf(parsedValue));
+ map.put(
+ key,
+ String.valueOf(
+ parseLongFromLiteral(value,
TTL_PROPERTY.toLowerCase(Locale.ENGLISH))));
} else if (serializeDefault) {
map.put(key, null);
}
@@ -330,4 +394,41 @@ public class TableConfigTaskVisitor extends
AstVisitor<IConfigTask, MPPQueryCont
context.setQueryType(QueryType.WRITE);
return new SetConfigurationTask(((SetConfigurationStatement)
node.getInnerTreeStatement()));
}
+
+ private long parseLongFromLiteral(final Object value, final String name) {
+ if (!(value instanceof LongLiteral)) {
+ throw new SemanticException(
+ name
+ + " value must be a LongLiteral, but now is "
+ + (Objects.nonNull(value) ? value.getClass().getSimpleName() :
null)
+ + ", value: "
+ + value);
+ }
+ final long parsedValue = ((LongLiteral) value).getParsedValue();
+ if (parsedValue < 0) {
+ throw new SemanticException(
+ name + " value must be equal to or greater than 0, but now is: " +
value);
+ }
+ return parsedValue;
+ }
+
+ private int parseIntFromLiteral(final Object value, final String name) {
+ if (!(value instanceof LongLiteral)) {
+ throw new SemanticException(
+ name
+ + " value must be a LongLiteral, but now is "
+ + (Objects.nonNull(value) ? value.getClass().getSimpleName() :
null)
+ + ", value: "
+ + value);
+ }
+ final long parsedValue = ((LongLiteral) value).getParsedValue();
+ if (parsedValue < 0) {
+ throw new SemanticException(
+ name + " value must be equal to or greater than 0, but now is: " +
value);
+ } else if (parsedValue > Integer.MAX_VALUE) {
+ throw new SemanticException(
+ name + " value must be lower than " + Integer.MAX_VALUE + ", but now
is: " + value);
+ }
+ return (int) parsedValue;
+ }
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
index 7d188cac3ff..85833bbd473 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java
@@ -181,7 +181,6 @@ import
org.apache.iotdb.db.queryengine.plan.execution.config.sys.subscription.Sh
import org.apache.iotdb.db.queryengine.plan.expression.Expression;
import
org.apache.iotdb.db.queryengine.plan.expression.visitor.TransformToViewExpressionVisitor;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metadata.write.view.AlterLogicalViewNode;
-import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.CreateDB;
import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.DropDB;
import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowCluster;
import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowConfigNodes;
@@ -3078,28 +3077,11 @@ public class ClusterConfigTaskExecutor implements
IConfigTaskExecutor {
}
@Override
- public SettableFuture<ConfigTaskResult> createDatabase(final CreateDB
createDB) {
+ public SettableFuture<ConfigTaskResult> createDatabase(
+ final TDatabaseSchema databaseSchema, final boolean ifNotExists) {
final SettableFuture<ConfigTaskResult> future = SettableFuture.create();
- final String dbName = createDB.getDbName();
- // Check database length here
- // We need to calculate the database name without "root."
- if (dbName.contains(".") || dbName.length() > MAX_DATABASE_NAME_LENGTH) {
- final IllegalPathException illegalPathException =
- new IllegalPathException(
- createDB.getDbName(),
- dbName.contains(".")
- ? "The database name shall not contain '.'"
- : "the length of database name shall not exceed " +
MAX_DATABASE_NAME_LENGTH);
- future.setException(
- new IoTDBException(
- illegalPathException.getMessage(),
illegalPathException.getErrorCode()));
- return future;
- }
-
// Construct request using statement
- final TDatabaseSchema databaseSchema = new TDatabaseSchema();
- databaseSchema.setName(ROOT + PATH_SEPARATOR_CHAR + createDB.getDbName());
try (final ConfigNodeClient configNodeClient =
CONFIG_NODE_CLIENT_MANAGER.borrowClient(ConfigNodeInfo.CONFIG_REGION_ID)) {
// Send request to some API server
@@ -3108,20 +3090,21 @@ public class ClusterConfigTaskExecutor implements
IConfigTaskExecutor {
if (TSStatusCode.SUCCESS_STATUS.getStatusCode() == tsStatus.getCode()) {
future.set(new ConfigTaskResult(TSStatusCode.SUCCESS_STATUS));
} else if (TSStatusCode.DATABASE_ALREADY_EXISTS.getStatusCode() ==
tsStatus.getCode()) {
- if (createDB.isSetIfNotExists()) {
+ if (ifNotExists) {
future.set(new ConfigTaskResult(TSStatusCode.SUCCESS_STATUS));
} else {
LOGGER.info(
- "Failed to CREATE DATABASE {}, because it already exists",
createDB.getDbName());
+ "Failed to CREATE DATABASE {}, because it already exists",
databaseSchema.getName());
future.setException(
new IoTDBException(
- String.format("Database %s already exists",
createDB.getDbName()),
+ String.format(
+ "Database %s already exists",
databaseSchema.getName().substring(5)),
TSStatusCode.DATABASE_ALREADY_EXISTS.getStatusCode()));
}
} else {
LOGGER.warn(
"Failed to execute create database {} in config node, status is
{}.",
- createDB.getDbName(),
+ databaseSchema.getName(),
tsStatus);
future.setException(new IoTDBException(tsStatus.message,
tsStatus.code));
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java
index d8b0364e11b..68b32f6ec47 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/IConfigTaskExecutor.java
@@ -25,13 +25,13 @@ import
org.apache.iotdb.common.rpc.thrift.TSetConfigurationReq;
import org.apache.iotdb.commons.cluster.NodeStatus;
import org.apache.iotdb.commons.schema.table.TsTable;
import org.apache.iotdb.commons.schema.table.column.TsTableColumnSchema;
+import org.apache.iotdb.confignode.rpc.thrift.TDatabaseSchema;
import org.apache.iotdb.confignode.rpc.thrift.TSpaceQuotaResp;
import org.apache.iotdb.confignode.rpc.thrift.TThrottleQuotaResp;
import org.apache.iotdb.db.protocol.session.IClientSession;
import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
import org.apache.iotdb.db.queryengine.plan.execution.config.ConfigTaskResult;
import
org.apache.iotdb.db.queryengine.plan.planner.plan.node.metadata.write.view.AlterLogicalViewNode;
-import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.CreateDB;
import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.DropDB;
import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowCluster;
import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.ShowConfigNodes;
@@ -287,7 +287,8 @@ public interface IConfigTaskExecutor {
SettableFuture<ConfigTaskResult> dropDatabase(final DropDB dropDB);
- SettableFuture<ConfigTaskResult> createDatabase(final CreateDB createDB);
+ SettableFuture<ConfigTaskResult> createDatabase(
+ final TDatabaseSchema databaseSchema, final boolean ifNotExists);
SettableFuture<ConfigTaskResult> createTable(
final TsTable table, final String database, final boolean ifNotExists);
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/CreateDBTask.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/CreateDBTask.java
index 937023ed30e..10b63a04a44 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/CreateDBTask.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/metadata/relational/CreateDBTask.java
@@ -19,24 +19,36 @@
package
org.apache.iotdb.db.queryengine.plan.execution.config.metadata.relational;
+import org.apache.iotdb.confignode.rpc.thrift.TDatabaseSchema;
import org.apache.iotdb.db.queryengine.plan.execution.config.ConfigTaskResult;
import org.apache.iotdb.db.queryengine.plan.execution.config.IConfigTask;
import
org.apache.iotdb.db.queryengine.plan.execution.config.executor.IConfigTaskExecutor;
-import org.apache.iotdb.db.queryengine.plan.relational.sql.ast.CreateDB;
import com.google.common.util.concurrent.ListenableFuture;
public class CreateDBTask implements IConfigTask {
- private final CreateDB node;
+ /////////////////////////////// Allowed properties
///////////////////////////////
+ public static final String TTL_KEY = "ttl";
+ public static final String SCHEMA_REPLICATION_FACTOR_KEY =
"schema_replication_factor";
+ public static final String DATA_REPLICATION_FACTOR_KEY =
"data_replication_factor";
+ public static final String TIME_PARTITION_INTERVAL_KEY =
"time_partition_interval";
+ public static final String SCHEMA_REGION_GROUP_NUM_KEY =
"schema_region_group_num";
+ public static final String DATA_REGION_GROUP_NUM_KEY =
"data_region_group_num";
- public CreateDBTask(final CreateDB node) {
- this.node = node;
+ /////////////////////////////// Fields ///////////////////////////////
+
+ private final TDatabaseSchema schema;
+ private final boolean ifNotExists;
+
+ public CreateDBTask(final TDatabaseSchema schema, final boolean ifNotExists)
{
+ this.schema = schema;
+ this.ifNotExists = ifNotExists;
}
@Override
public ListenableFuture<ConfigTaskResult> execute(final IConfigTaskExecutor
configTaskExecutor)
throws InterruptedException {
- return configTaskExecutor.createDatabase(node);
+ return configTaskExecutor.createDatabase(schema, ifNotExists);
}
}
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/CreateDB.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/CreateDB.java
index 02dd25c19bf..c230b90e962 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/CreateDB.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/CreateDB.java
@@ -34,21 +34,21 @@ public class CreateDB extends Statement {
private final String dbName;
private final List<Property> properties;
- public CreateDB(boolean ifNotExists, String dbName) {
+ public CreateDB(final boolean ifNotExists, final String dbName) {
super(null);
this.ifNotExists = ifNotExists;
this.dbName = requireNonNull(dbName, "dbName is
null").toLowerCase(Locale.ENGLISH);
this.properties = null;
}
- public CreateDB(NodeLocation location, boolean ifNotExists, String dbName) {
+ public CreateDB(final NodeLocation location, final boolean ifNotExists,
final String dbName) {
super(requireNonNull(location, "location is null"));
this.ifNotExists = ifNotExists;
this.dbName = requireNonNull(dbName, "dbName is
null").toLowerCase(Locale.ENGLISH);
this.properties = null;
}
- public CreateDB(boolean ifNotExists, String dbName, List<Property>
properties) {
+ public CreateDB(final boolean ifNotExists, final String dbName, final
List<Property> properties) {
super(null);
this.ifNotExists = ifNotExists;
this.dbName = requireNonNull(dbName, "dbName is
null").toLowerCase(Locale.ENGLISH);
@@ -56,7 +56,10 @@ public class CreateDB extends Statement {
}
public CreateDB(
- NodeLocation location, boolean ifNotExists, String dbName,
List<Property> properties) {
+ final NodeLocation location,
+ final boolean ifNotExists,
+ final String dbName,
+ final List<Property> properties) {
super(requireNonNull(location, "location is null"));
this.ifNotExists = ifNotExists;
this.dbName = requireNonNull(dbName, "dbName is
null").toLowerCase(Locale.ENGLISH);
@@ -76,7 +79,7 @@ public class CreateDB extends Statement {
}
@Override
- public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
+ public <R, C> R accept(final AstVisitor<R, C> visitor, final C context) {
return visitor.visitCreateDB(this, context);
}
@@ -91,14 +94,14 @@ public class CreateDB extends Statement {
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if ((obj == null) || (getClass() != obj.getClass())) {
return false;
}
- CreateDB o = (CreateDB) obj;
+ final CreateDB o = (CreateDB) obj;
return Objects.equals(dbName, o.dbName)
&& Objects.equals(ifNotExists, o.ifNotExists)
&& Objects.equals(properties, o.properties);