Skip to content
Permalink
Browse files
[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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mhubail@apache.org>
Reviewed-by: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
  • Loading branch information
mhubail committed Mar 3, 2021
1 parent 265e3ce commit 08200153038688b7ce392df7e53317590fc9ab02
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
@@ -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);
}
}
@@ -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 @@ public class Dataset implements IMetadataEntity<Dataset>, IDataset {
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 @@ public Dataset(DataverseName dataverseName, String datasetName, DataverseName it
this.hints = hints;
this.rebalanceCount = rebalanceCount;
this.compressionScheme = compressionScheme;
datasetFullyQualifiedName = new DatasetFullyQualifiedName(dataverseName, datasetName);
}

@Override
@@ -877,4 +880,9 @@ protected int[] getDatasetPartitions(MetadataProvider metadataProvider) throws A
public String getCompressionScheme() {
return compressionScheme;
}

public DatasetFullyQualifiedName getDatasetFullyQualifiedName() {
return datasetFullyQualifiedName;
}

}

0 comments on commit 0820015

Please sign in to comment.