>From Janhavi Tripurwar <janhavi.tripur...@couchbase.com>: Janhavi Tripurwar has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20209 )
Change subject: [ASTERIXDB-3639]: add datasetName for index ...................................................................... [ASTERIXDB-3639]: add datasetName for index - user model changes: no - storage format changes: no - interface changes: no Ext-ref: MB-68042 Change-Id: I4269a893b433d620807d1c1b0108107f2ae43d36 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20209 Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Murtadha Hubail <mhub...@apache.org> Reviewed-by: Janhavi Tripurwar <janhavi.tripur...@couchbase.com> --- M asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java M asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/EntityDetails.java 2 files changed, 37 insertions(+), 8 deletions(-) Approvals: Murtadha Hubail: Looks good to me, approved Janhavi Tripurwar: Looks good to me, but someone else must approve Jenkins: Verified diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java index 2b75477..f6f06ea 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java @@ -1674,7 +1674,7 @@ stmtCreateIndex.isEnforced(), false, MetadataUtil.PENDING_ADD_OP, creator); bActiveTxn = false; // doCreateIndexImpl() takes over the current transaction - EntityDetails entityDetails = EntityDetails.newIndex(databaseName, dataverseName, indexName); + EntityDetails entityDetails = EntityDetails.newIndex(databaseName, dataverseName, datasetName, indexName); doCreateIndexImpl(hcc, metadataProvider, ds, newIndex, jobFlags, sourceLoc, creator, entityDetails); } catch (Exception e) { @@ -2661,7 +2661,7 @@ MetadataManager.INSTANCE.dropIndex(mdTxnCtx, databaseName, dataverseName, datasetName, indexName); } beforeDropTxnCommit(metadataProvider, mdTxnCtx, - EntityDetails.newIndex(databaseName, dataverseName, indexName)); + EntityDetails.newIndex(databaseName, dataverseName, datasetName, indexName)); MetadataManager.INSTANCE.commitTransaction(mdTxnCtx); return true; } catch (Exception e) { diff --git a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/EntityDetails.java b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/EntityDetails.java index c7e771b..4d10388 100644 --- a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/EntityDetails.java +++ b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/EntityDetails.java @@ -40,6 +40,8 @@ private final DataverseName dataverseName; private final String entityName; private final EntityType entityType; + // The name of the dataset, only applicable for index entities. + private String datasetName; // The number of arguments that the function accepts. Relevant only for function entity. private int functionArity; @@ -52,13 +54,16 @@ private EntityDetails(String databaseName, DataverseName dataverseName, String entityName, EntityType entityType, int functionArity) { - this.databaseName = databaseName; - this.dataverseName = dataverseName; - this.entityName = entityName; - this.entityType = entityType; + this(databaseName, dataverseName, entityName, entityType); this.functionArity = functionArity; } + private EntityDetails(String databaseName, DataverseName dataverseName, String datasetName, String entityName, + EntityType entityType) { + this(databaseName, dataverseName, entityName, entityType); + this.datasetName = datasetName; + } + public static EntityDetails newDatabase(String databaseName) { return new EntityDetails(databaseName, null, null, EntityType.DATABASE); } @@ -84,8 +89,9 @@ return new EntityDetails(databaseName, dataverseName, synonymName, EntityType.SYNONYM); } - public static EntityDetails newIndex(String databaseName, DataverseName dataverseName, String indexName) { - return new EntityDetails(databaseName, dataverseName, indexName, EntityType.INDEX); + public static EntityDetails newIndex(String databaseName, DataverseName dataverseName, String datasetName, + String indexName) { + return new EntityDetails(databaseName, dataverseName, datasetName, indexName, EntityType.INDEX); } public static EntityDetails newExtension(String extensionName) { @@ -112,6 +118,10 @@ return functionArity; } + public String getDatasetName() { + return datasetName; + } + public static String getFunctionNameWithArity(String functionName, int functionArity) { return functionName + "(" + functionArity + ")"; } -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20209 To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-Project: asterixdb Gerrit-Branch: ionic Gerrit-Change-Id: I4269a893b433d620807d1c1b0108107f2ae43d36 Gerrit-Change-Number: 20209 Gerrit-PatchSet: 11 Gerrit-Owner: Janhavi Tripurwar <janhavi.tripur...@couchbase.com> Gerrit-Reviewer: Ali Alsuliman <ali.al.solai...@gmail.com> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Janhavi Tripurwar <janhavi.tripur...@couchbase.com> Gerrit-Reviewer: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Gerrit-Reviewer: Michael Blow <mb...@apache.org> Gerrit-Reviewer: Murtadha Hubail <mhub...@apache.org> Gerrit-MessageType: merged