You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by al...@apache.org on 2023/02/27 20:29:15 UTC
[asterixdb] 15/16: [ASTERIXDB-3119][*DB][IDX] Make local ordering property only on SKs
This is an automated email from the ASF dual-hosted git repository.
alsuliman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit 5316f0ce23ebaeab461dfc6a11da7364d5aef26d
Author: Ali Alsuliman <al...@gmail.com>
AuthorDate: Sat Feb 25 23:01:43 2023 -0800
[ASTERIXDB-3119][*DB][IDX] Make local ordering property only on SKs
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
For now, make the local ordering property of query-index() on
only the secondary keys.
Change-Id: I8afb2b197da19b45b91507280652f2171b40e9c4
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17399
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <mh...@apache.org>
---
.../apache/asterix/app/function/QueryIndexDatasource.java | 15 +++++++++------
.../apache/asterix/app/function/QueryIndexRewriter.java | 3 ++-
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/QueryIndexDatasource.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/QueryIndexDatasource.java
index f43588e1de..cf2b891357 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/QueryIndexDatasource.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/QueryIndexDatasource.java
@@ -56,13 +56,16 @@ public class QueryIndexDatasource extends FunctionDataSource {
private final Dataset ds;
private final String indexName;
private final AlgebricksAbsolutePartitionConstraint storageLocations;
+ private final int numSecKeys;
public QueryIndexDatasource(Dataset ds, String indexName, INodeDomain domain,
- AlgebricksAbsolutePartitionConstraint storageLocations, ARecordType recType) throws AlgebricksException {
+ AlgebricksAbsolutePartitionConstraint storageLocations, ARecordType recType, int numSecKeys)
+ throws AlgebricksException {
super(createQueryIndexDataSourceId(ds, indexName), QueryIndexRewriter.QUERY_INDEX, domain, recType);
this.ds = ds;
this.indexName = indexName;
this.storageLocations = storageLocations;
+ this.numSecKeys = numSecKeys;
}
@Override
@@ -109,12 +112,12 @@ public class QueryIndexDatasource extends FunctionDataSource {
public IDataSourcePropertiesProvider getPropertiesProvider() {
return scanVariables -> {
List<ILocalStructuralProperty> propsLocal = new ArrayList<>(1);
- int numScanKeys = scanVariables.size();
- List<OrderColumn> scanKeys = new ArrayList<>(numScanKeys);
- for (int i = 0; i < numScanKeys; i++) {
- scanKeys.add(new OrderColumn(scanVariables.get(i), OrderOperator.IOrder.OrderKind.ASC));
+ //TODO(ali): consider primary keys?
+ List<OrderColumn> secKeys = new ArrayList<>(numSecKeys);
+ for (int i = 0; i < numSecKeys; i++) {
+ secKeys.add(new OrderColumn(scanVariables.get(i), OrderOperator.IOrder.OrderKind.ASC));
}
- propsLocal.add(new LocalOrderProperty(scanKeys));
+ propsLocal.add(new LocalOrderProperty(secKeys));
return new StructuralPropertiesVector(new RandomPartitioningProperty(domain), propsLocal);
};
}
diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/QueryIndexRewriter.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/QueryIndexRewriter.java
index 1906fcf9b3..e0ff9c2ee0 100644
--- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/QueryIndexRewriter.java
+++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/function/QueryIndexRewriter.java
@@ -128,7 +128,8 @@ public class QueryIndexRewriter extends FunctionRewriter implements IResultTypeC
(AlgebricksAbsolutePartitionConstraint) secIdxHelper.getSecondaryPartitionConstraint();
INodeDomain domain = mp.findNodeDomain(ds.getNodeGroupName());
ARecordType recType = computeRecType(f, mp, null, null, null);
- return new QueryIndexDatasource(ds, idx.getIndexName(), domain, secPartitionConstraint, recType);
+ int numSecKeys = ((Index.ValueIndexDetails) idx.getIndexDetails()).getKeyFieldNames().size();
+ return new QueryIndexDatasource(ds, idx.getIndexName(), domain, secPartitionConstraint, recType, numSecKeys);
}
private ARecordType computeRecType(AbstractFunctionCallExpression f, MetadataProvider metadataProvider,