>From Murtadha Hubail <[email protected]>: Murtadha Hubail has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/10303 )
Change subject: [NO ISSUE][OTH] Introduce DatasetFullyQualifiedName ...................................................................... [NO ISSUE][OTH] Introduce DatasetFullyQualifiedName - user model changes: no - storage format changes: no - interface changes: no Details: - Introduce DatasetFullyQualifiedName that is used to represent a dataset's DataverseName as well as its name. - This new class can be used as an identifier for a dataset rather than using a Pair object of a DataverseName and a String. Change-Id: Ie94b5dc400c04a143f5be3b1cb2a652d765dfdba Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/10303 Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Reviewed-by: Murtadha Hubail <[email protected]> Reviewed-by: Dmitry Lychagin <[email protected]> --- A asterixdb/asterix-common/src/main/java/org/apache/asterix/common/metadata/DatasetFullyQualifiedName.java M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataset.java 2 files changed, 72 insertions(+), 0 deletions(-) Approvals: Murtadha Hubail: Looks good to me, but someone else must approve Dmitry Lychagin: Looks good to me, approved Jenkins: Verified; Verified diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/metadata/DatasetFullyQualifiedName.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/metadata/DatasetFullyQualifiedName.java new file mode 100644 index 0000000..4a1a118 --- /dev/null +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/metadata/DatasetFullyQualifiedName.java @@ -0,0 +1,64 @@ +/* + * 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.asterix.common.metadata; + +import java.io.Serializable; +import java.util.Objects; + +public class DatasetFullyQualifiedName implements Serializable { + + private static final long serialVersionUID = 1L; + private final DataverseName dataverseName; + private final String datasetName; + + public DatasetFullyQualifiedName(DataverseName dataverseName, String datasetName) { + this.dataverseName = dataverseName; + this.datasetName = datasetName; + } + + public DataverseName getDataverseName() { + return dataverseName; + } + + public String getDatasetName() { + return datasetName; + } + + @Override + public String toString() { + return dataverseName + "." + datasetName; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o instanceof DatasetFullyQualifiedName) { + DatasetFullyQualifiedName that = (DatasetFullyQualifiedName) o; + return dataverseName.equals(that.dataverseName) && datasetName.equals(that.datasetName); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(dataverseName, datasetName); + } +} diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataset.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataset.java index dd3f67d..39a8eff 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataset.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Dataset.java @@ -38,6 +38,7 @@ import org.apache.asterix.common.exceptions.ErrorCode; import org.apache.asterix.common.ioopcallbacks.LSMIndexIOOperationCallbackFactory; import org.apache.asterix.common.ioopcallbacks.LSMIndexPageWriteCallbackFactory; +import org.apache.asterix.common.metadata.DatasetFullyQualifiedName; import org.apache.asterix.common.metadata.DataverseName; import org.apache.asterix.common.metadata.IDataset; import org.apache.asterix.common.transactions.IRecoveryManager.ResourceType; @@ -154,6 +155,7 @@ private final long rebalanceCount; private int pendingOp; private final String compressionScheme; + private final DatasetFullyQualifiedName datasetFullyQualifiedName; public Dataset(DataverseName dataverseName, String datasetName, DataverseName recordTypeDataverseName, String recordTypeName, String nodeGroupName, String compactionPolicy, @@ -203,6 +205,7 @@ this.hints = hints; this.rebalanceCount = rebalanceCount; this.compressionScheme = compressionScheme; + datasetFullyQualifiedName = new DatasetFullyQualifiedName(dataverseName, datasetName); } @Override @@ -877,4 +880,9 @@ public String getCompressionScheme() { return compressionScheme; } + + public DatasetFullyQualifiedName getDatasetFullyQualifiedName() { + return datasetFullyQualifiedName; + } + } -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/10303 To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-Project: asterixdb Gerrit-Branch: cheshire-cat Gerrit-Change-Id: Ie94b5dc400c04a143f5be3b1cb2a652d765dfdba Gerrit-Change-Number: 10303 Gerrit-PatchSet: 3 Gerrit-Owner: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Ali Alsuliman <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Dmitry Lychagin <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-MessageType: merged
