This is an automated email from the ASF dual-hosted git repository.
wyk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new c02697ccdc [NO ISSUE][OM] Move and rename
ColumnSecondaryIndexSchemaUtil to asterix-om
c02697ccdc is described below
commit c02697ccdc62651e82a6c8c65797e50d73ef4e68
Author: Wail Alkowaileet <[email protected]>
AuthorDate: Fri Jul 28 10:46:21 2023 -0700
[NO ISSUE][OM] Move and rename ColumnSecondaryIndexSchemaUtil to asterix-om
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
Rename ColumnSecondaryIndexSchemaUtil to ProjectionFiltrationTypeUtil
and move it to asterix-om, as it is used for purposes other
than columnar datasets. This patch also includes other refactorings.
Change-Id: I04c5ab3d82795078e54cf582f4a9b52681271e70
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17662
Integration-Tests: Jenkins <[email protected]>
Reviewed-by: Wail Alkowaileet <[email protected]>
Reviewed-by: Hussain Towaileb <[email protected]>
Tested-by: Jenkins <[email protected]>
---
...xpectedSchemaNodeToIATypeTranslatorVisitor.java | 8 +++--
.../org/apache/asterix/utils/RebalanceUtil.java | 8 ++---
.../operation/query/QueryColumnMetadata.java | 5 +--
.../asterix/column/test/bytes/FlushLargeTest.java | 4 +--
.../asterix/column/test/bytes/FlushSmallTest.java | 4 +--
.../asterix/column/test/dummy/AssemblerTest.java | 4 +--
.../parquet/AsterixTypeToParquetTypeVisitor.java | 7 +++--
.../asterix/external/util/ExternalDataUtils.java | 8 ++---
.../apache/asterix/external/util/HDFSUtils.java | 13 +++++---
.../metadata/declared/MetadataManagerUtil.java | 8 ++---
.../apache/asterix/metadata/entities/Index.java | 10 +++---
.../apache/asterix/metadata/utils/DatasetUtil.java | 9 +++---
.../apache/asterix/metadata/utils/IndexUtil.java | 8 ++---
.../metadata/utils/SampleOperationsHelper.java | 6 ++--
.../utils/filter/ArrayPathCheckerVisitor.java | 5 +--
.../om/utils/ProjectionFiltrationTypeUtil.java} | 20 ++++++++----
.../projection/DataProjectionFiltrationInfo.java | 9 ++----
.../projection/ProjectionFiltrationUtil.java | 36 ----------------------
18 files changed, 73 insertions(+), 99 deletions(-)
diff --git
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/visitor/ExpectedSchemaNodeToIATypeTranslatorVisitor.java
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/visitor/ExpectedSchemaNodeToIATypeTranslatorVisitor.java
index 825db1e765..f5461d17c2 100644
---
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/visitor/ExpectedSchemaNodeToIATypeTranslatorVisitor.java
+++
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/visitor/ExpectedSchemaNodeToIATypeTranslatorVisitor.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.optimizer.rules.pushdown.visitor;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.EMPTY_TYPE;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -37,7 +40,6 @@ import
org.apache.asterix.optimizer.rules.pushdown.schema.IExpectedSchemaNodeVis
import
org.apache.asterix.optimizer.rules.pushdown.schema.ObjectExpectedSchemaNode;
import
org.apache.asterix.optimizer.rules.pushdown.schema.RootExpectedSchemaNode;
import
org.apache.asterix.optimizer.rules.pushdown.schema.UnionExpectedSchemaNode;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
import org.apache.asterix.runtime.projection.FunctionCallInformation;
import
org.apache.asterix.runtime.projection.ProjectionFiltrationWarningFactoryProvider;
@@ -58,9 +60,9 @@ public class ExpectedSchemaNodeToIATypeTranslatorVisitor
implements IExpectedSch
@Override
public IAType visit(RootExpectedSchemaNode node, String arg) {
if (node.isAllFields()) {
- return DataProjectionFiltrationInfo.ALL_FIELDS_TYPE;
+ return ALL_FIELDS_TYPE;
} else if (node.isEmpty()) {
- return DataProjectionFiltrationInfo.EMPTY_TYPE;
+ return EMPTY_TYPE;
}
return createRecordType(node, String.valueOf(counter++));
}
diff --git
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/utils/RebalanceUtil.java
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/utils/RebalanceUtil.java
index 200e357bcd..1b0b4fdcd5 100644
---
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/utils/RebalanceUtil.java
+++
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/utils/RebalanceUtil.java
@@ -20,6 +20,7 @@ package org.apache.asterix.utils;
import static org.apache.asterix.app.translator.QueryTranslator.abort;
import static org.apache.asterix.common.config.DatasetConfig.DatasetType;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE;
import static
org.apache.hyracks.storage.am.common.dataflow.IndexDropOperatorDescriptor.DropOption;
import java.rmi.RemoteException;
@@ -50,7 +51,6 @@ import org.apache.asterix.metadata.utils.IndexUtil;
import org.apache.asterix.om.types.ARecordType;
import org.apache.asterix.rebalance.IDatasetRebalanceCallback;
import org.apache.asterix.runtime.job.listener.JobEventListenerFactory;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
import
org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
import
org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraintHelper;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -341,10 +341,8 @@ public class RebalanceUtil {
itemType = (ARecordType)
metadataProvider.findTypeForDatasetWithoutType(itemType, metaType, source);
int numberOfPrimaryKeys = source.getPrimaryKeys().size();
- // This could be expensive if record structure is "complex"
- ARecordType requestedType =
DataProjectionFiltrationInfo.ALL_FIELDS_TYPE;
-
- return
IndexUtil.createPrimaryIndexScanTupleProjectorFactory(source.getDatasetFormatInfo(),
requestedType,
+ // The assembly cost of ALL_FIELDS_TYPE could be expensive if record
structure is "complex"
+ return
IndexUtil.createPrimaryIndexScanTupleProjectorFactory(source.getDatasetFormatInfo(),
ALL_FIELDS_TYPE,
itemType, metaType, numberOfPrimaryKeys);
}
diff --git
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/query/QueryColumnMetadata.java
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/query/QueryColumnMetadata.java
index b8d9260246..248b5a5541 100644
---
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/query/QueryColumnMetadata.java
+++
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/query/QueryColumnMetadata.java
@@ -18,6 +18,8 @@
*/
package org.apache.asterix.column.operation.query;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE;
+
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.DataInputStream;
@@ -45,7 +47,6 @@ import org.apache.asterix.column.values.IColumnValuesReader;
import org.apache.asterix.column.values.IColumnValuesReaderFactory;
import org.apache.asterix.column.values.reader.PrimitiveColumnValuesReader;
import org.apache.asterix.om.types.ARecordType;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
import org.apache.asterix.runtime.projection.FunctionCallInformation;
import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
import org.apache.hyracks.algebricks.runtime.evaluators.EvaluatorContext;
@@ -239,7 +240,7 @@ public class QueryColumnMetadata extends
AbstractColumnImmutableReadMetadata {
protected static ObjectSchemaNode clip(ARecordType requestedType,
ObjectSchemaNode root,
SchemaClipperVisitor clipperVisitor) {
ObjectSchemaNode clippedRoot;
- if
(requestedType.getTypeName().equals(DataProjectionFiltrationInfo.ALL_FIELDS_TYPE.getTypeName()))
{
+ if (ALL_FIELDS_TYPE.getTypeName().equals(requestedType.getTypeName()))
{
clippedRoot = root;
} else {
clippedRoot = (ObjectSchemaNode)
requestedType.accept(clipperVisitor, root);
diff --git
a/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/bytes/FlushLargeTest.java
b/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/bytes/FlushLargeTest.java
index 24fbf92b0e..6a0256c353 100644
---
a/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/bytes/FlushLargeTest.java
+++
b/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/bytes/FlushLargeTest.java
@@ -31,7 +31,7 @@ import
org.apache.asterix.column.operation.lsm.flush.FlushColumnMetadata;
import org.apache.asterix.column.operation.query.QueryColumnMetadata;
import org.apache.asterix.column.values.reader.ColumnValueReaderFactory;
import org.apache.asterix.common.exceptions.NoOpWarningCollector;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
+import org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.api.IValueReference;
import org.junit.BeforeClass;
@@ -66,7 +66,7 @@ public class FlushLargeTest extends AbstractBytesTest {
QueryColumnMetadata readMetadata =
QueryColumnMetadata.create(columnMetadata.getDatasetType(),
columnMetadata.getNumberOfPrimaryKeys(),
columnMetadata.serializeColumnsMetadata(), new
ColumnValueReaderFactory(),
- ValueGetterFactory.INSTANCE,
DataProjectionFiltrationInfo.ALL_FIELDS_TYPE,
+ ValueGetterFactory.INSTANCE,
ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE,
Collections.emptyMap(),
NoOpColumnFilterEvaluatorFactory.INSTANCE,
NoOpColumnFilterEvaluatorFactory.INSTANCE,
NoOpWarningCollector.INSTANCE, null);
writeResult(fileId, readMetadata, pageZeros);
diff --git
a/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/bytes/FlushSmallTest.java
b/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/bytes/FlushSmallTest.java
index 9164a78103..8b45142c78 100644
---
a/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/bytes/FlushSmallTest.java
+++
b/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/bytes/FlushSmallTest.java
@@ -31,7 +31,7 @@ import
org.apache.asterix.column.operation.lsm.flush.FlushColumnMetadata;
import org.apache.asterix.column.operation.query.QueryColumnMetadata;
import org.apache.asterix.column.values.reader.ColumnValueReaderFactory;
import org.apache.asterix.common.exceptions.NoOpWarningCollector;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
+import org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.api.IValueReference;
import org.junit.BeforeClass;
@@ -65,7 +65,7 @@ public class FlushSmallTest extends AbstractBytesTest {
QueryColumnMetadata readMetadata =
QueryColumnMetadata.create(columnMetadata.getDatasetType(),
columnMetadata.getNumberOfPrimaryKeys(),
columnMetadata.serializeColumnsMetadata(), new
ColumnValueReaderFactory(),
- ValueGetterFactory.INSTANCE,
DataProjectionFiltrationInfo.ALL_FIELDS_TYPE,
+ ValueGetterFactory.INSTANCE,
ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE,
Collections.emptyMap(),
NoOpColumnFilterEvaluatorFactory.INSTANCE,
NoOpColumnFilterEvaluatorFactory.INSTANCE,
NoOpWarningCollector.INSTANCE, null);
writeResult(fileId, readMetadata, pageZeros);
diff --git
a/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/dummy/AssemblerTest.java
b/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/dummy/AssemblerTest.java
index f33610398f..80106dcebe 100644
---
a/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/dummy/AssemblerTest.java
+++
b/asterixdb/asterix-column/src/test/java/org/apache/asterix/column/test/dummy/AssemblerTest.java
@@ -44,7 +44,7 @@ import
org.apache.asterix.om.pointables.ARecordVisitablePointable;
import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
import org.apache.asterix.om.pointables.printer.json.clean.APrintVisitor;
import org.apache.asterix.om.types.ATypeTag;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
+import org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.utils.Pair;
import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -97,7 +97,7 @@ public class AssemblerTest extends AbstractDummyTest {
DummyColumnValuesReaderFactory readerFactory =
createDummyColumnValuesReaderFactory();
QueryColumnMetadata queryMetadata =
QueryColumnMetadata.create(columnMetadata.getDatasetType(),
columnMetadata.getNumberOfPrimaryKeys(),
columnMetadata.serializeColumnsMetadata(), readerFactory,
- DummyValueGetterFactory.INSTANCE,
DataProjectionFiltrationInfo.ALL_FIELDS_TYPE, Collections.emptyMap(),
+ DummyValueGetterFactory.INSTANCE,
ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE, Collections.emptyMap(),
NoOpColumnFilterEvaluatorFactory.INSTANCE,
NoOpColumnFilterEvaluatorFactory.INSTANCE,
NoOpWarningCollector.INSTANCE, null);
AbstractBytesInputStream[] streams = new
AbstractBytesInputStream[columnMetadata.getNumberOfColumns()];
diff --git
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/hdfs/parquet/AsterixTypeToParquetTypeVisitor.java
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/hdfs/parquet/AsterixTypeToParquetTypeVisitor.java
index af8733f78a..be9690e910 100644
---
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/hdfs/parquet/AsterixTypeToParquetTypeVisitor.java
+++
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/record/reader/hdfs/parquet/AsterixTypeToParquetTypeVisitor.java
@@ -19,6 +19,8 @@
package org.apache.asterix.external.input.record.reader.hdfs.parquet;
import static
org.apache.asterix.external.input.record.reader.hdfs.parquet.converter.primitve.PrimitiveConverterProvider.MISSING;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.EMPTY_TYPE;
import java.util.Map;
@@ -34,7 +36,6 @@ import org.apache.asterix.om.types.AUnionType;
import org.apache.asterix.om.types.AbstractCollectionType;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.types.IATypeVisitor;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
import org.apache.asterix.runtime.projection.FunctionCallInformation;
import org.apache.hyracks.api.exceptions.SourceLocation;
import org.apache.hyracks.api.exceptions.Warning;
@@ -67,9 +68,9 @@ public class AsterixTypeToParquetTypeVisitor implements
IATypeVisitor<Type, Type
public MessageType clipType(ARecordType rootType, MessageType fileSchema,
Map<String, FunctionCallInformation> funcInfo) {
- if (rootType == DataProjectionFiltrationInfo.EMPTY_TYPE) {
+ if (rootType == EMPTY_TYPE) {
return EMPTY_PARQUET_MESSAGE;
- } else if (rootType == DataProjectionFiltrationInfo.ALL_FIELDS_TYPE) {
+ } else if (rootType == ALL_FIELDS_TYPE) {
return fileSchema;
}
Types.MessageTypeBuilder builder = Types.buildMessage();
diff --git
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
index 35e68ed419..794c18ca69 100644
---
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
+++
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/ExternalDataUtils.java
@@ -29,6 +29,8 @@ import static
org.apache.asterix.external.util.ExternalDataConstants.KEY_RECORD_
import static
org.apache.asterix.external.util.azure.blob_storage.AzureUtils.validateAzureBlobProperties;
import static
org.apache.asterix.external.util.azure.blob_storage.AzureUtils.validateAzureDataLakeProperties;
import static
org.apache.asterix.external.util.google.gcs.GCSUtils.validateProperties;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.EMPTY_TYPE;
import static
org.apache.asterix.runtime.evaluators.functions.StringEvaluatorUtils.RESERVED_REGEX_CHARS;
import static org.msgpack.core.MessagePack.Code.ARRAY16;
@@ -457,8 +459,7 @@ public class ExternalDataUtils {
/**
* Prepares the configuration for data-lake table formats
*
- * @param configuration
- * external data configuration
+ * @param configuration external data configuration
*/
public static void prepareTableFormat(Map<String, String> configuration)
throws AlgebricksException {
// Apache Iceberg table format
@@ -900,8 +901,7 @@ public class ExternalDataUtils {
* @return the expected type as Base64 string
*/
private static String serializeExpectedTypeToString(ARecordType
expectedType) throws IOException {
- if (expectedType == DataProjectionFiltrationInfo.EMPTY_TYPE
- || expectedType ==
DataProjectionFiltrationInfo.ALL_FIELDS_TYPE) {
+ if (expectedType == EMPTY_TYPE || expectedType == ALL_FIELDS_TYPE) {
//Return the type name of EMPTY_TYPE and ALL_FIELDS_TYPE
return expectedType.getTypeName();
}
diff --git
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/HDFSUtils.java
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/HDFSUtils.java
index 7bafd78471..7b7b227af4 100644
---
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/HDFSUtils.java
+++
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/HDFSUtils.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.external.util;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.EMPTY_TYPE;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
@@ -226,7 +229,7 @@ public class HDFSUtils {
String requestedValues =
configuration.get(ExternalDataConstants.KEY_REQUESTED_FIELDS);
if (requestedValues == null) {
//No value is requested, return the entire record
- requestedValues =
DataProjectionFiltrationInfo.ALL_FIELDS_TYPE.getTypeName();
+ requestedValues = ALL_FIELDS_TYPE.getTypeName();
} else {
//Subset of the values were requested, set the
functionCallInformation
conf.set(ExternalDataConstants.KEY_HADOOP_ASTERIX_FUNCTION_CALL_INFORMATION,
@@ -257,12 +260,12 @@ public class HDFSUtils {
public static ARecordType getExpectedType(Configuration configuration)
throws IOException {
String encoded =
configuration.get(ExternalDataConstants.KEY_REQUESTED_FIELDS, "");
- if (encoded.isEmpty() ||
encoded.equals(DataProjectionFiltrationInfo.ALL_FIELDS_TYPE.getTypeName())) {
+ if (ALL_FIELDS_TYPE.getTypeName().equals(encoded)) {
//By default, return the entire records
- return DataProjectionFiltrationInfo.ALL_FIELDS_TYPE;
- } else if
(encoded.equals(DataProjectionFiltrationInfo.EMPTY_TYPE.getTypeName())) {
+ return ALL_FIELDS_TYPE;
+ } else if (EMPTY_TYPE.getTypeName().equals(encoded)) {
//No fields were requested
- return DataProjectionFiltrationInfo.EMPTY_TYPE;
+ return EMPTY_TYPE;
}
//A subset of the fields was requested
Base64.Decoder decoder = Base64.getDecoder();
diff --git
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataManagerUtil.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataManagerUtil.java
index 4b9483c8fd..b976448375 100644
---
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataManagerUtil.java
+++
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataManagerUtil.java
@@ -23,7 +23,6 @@ import static
org.apache.asterix.common.utils.IdentifierUtil.dataverse;
import java.util.ArrayList;
import java.util.List;
-import org.apache.asterix.column.util.ColumnSecondaryIndexSchemaUtil;
import org.apache.asterix.common.cluster.IClusterStateManager;
import org.apache.asterix.common.config.DatasetConfig;
import org.apache.asterix.common.exceptions.AsterixException;
@@ -46,6 +45,7 @@ import org.apache.asterix.metadata.entities.Synonym;
import org.apache.asterix.metadata.utils.MetadataConstants;
import org.apache.asterix.om.types.ARecordType;
import org.apache.asterix.om.types.IAType;
+import org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import
org.apache.hyracks.algebricks.core.algebra.properties.DefaultNodeGroupDomain;
import org.apache.hyracks.algebricks.core.algebra.properties.INodeDomain;
@@ -69,9 +69,9 @@ public class MetadataManagerUtil {
* creates and returns a record type based on the primary key and primary
key types information included in the
* internal details.
*
- * @param itemType record type of the dataset
+ * @param itemType record type of the dataset
* @param metaItemType record type of the meta part of the dataset
- * @param dataset the actual dataset
+ * @param dataset the actual dataset
* @return type computed from primary keys if dataset without type spec,
otherwise the original itemType itself
* @throws AlgebricksException
*/
@@ -88,7 +88,7 @@ public class MetadataManagerUtil {
private static IAType findType(List<List<String>> primaryKeys,
List<IAType> primaryKeyTypes)
throws AlgebricksException {
- return
ColumnSecondaryIndexSchemaUtil.getRecordTypeWithFieldTypes(primaryKeys,
primaryKeyTypes);
+ return
ProjectionFiltrationTypeUtil.getRecordTypeWithFieldTypes(primaryKeys,
primaryKeyTypes);
}
public static Datatype findTypeEntity(MetadataTransactionContext mdTxnCtx,
DataverseName dataverseName,
diff --git
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
index bb1fdd9015..963b3ff87d 100644
---
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
+++
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/entities/Index.java
@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
-import org.apache.asterix.column.util.ColumnSecondaryIndexSchemaUtil;
import org.apache.asterix.common.config.DatasetConfig.IndexType;
import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.common.exceptions.CompilationException;
@@ -40,6 +39,7 @@ import org.apache.asterix.om.types.ARecordType;
import org.apache.asterix.om.types.AUnionType;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.utils.NonTaggedFormatUtil;
+import org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.common.utils.Pair;
import org.apache.hyracks.api.job.profiling.IndexStats;
@@ -416,7 +416,7 @@ public class Index implements IMetadataEntity<Index>,
Comparable<Index> {
}
public ARecordType getIndexExpectedType() throws AlgebricksException {
- return
ColumnSecondaryIndexSchemaUtil.getRecordType(getKeyFieldNames());
+ return
ProjectionFiltrationTypeUtil.getRecordType(getKeyFieldNames());
}
}
@@ -511,10 +511,10 @@ public class Index implements IMetadataEntity<Index>,
Comparable<Index> {
public ARecordType getIndexExpectedType() throws AlgebricksException {
List<ARecordType> types = new ArrayList<>();
for (Index.ArrayIndexElement element : elementList) {
-
types.add(ColumnSecondaryIndexSchemaUtil.getRecordType(element.getUnnestList(),
- element.getProjectList()));
+ types.add(
+
ProjectionFiltrationTypeUtil.getRecordType(element.getUnnestList(),
element.getProjectList()));
}
- return ColumnSecondaryIndexSchemaUtil.merge(types);
+ return ProjectionFiltrationTypeUtil.merge(types);
}
}
diff --git
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtil.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtil.java
index 06e949f972..0cbdc244cb 100644
---
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtil.java
+++
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtil.java
@@ -19,6 +19,7 @@
package org.apache.asterix.metadata.utils;
import static org.apache.asterix.common.utils.IdentifierUtil.dataset;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.EMPTY_TYPE;
import java.io.DataOutput;
import java.util.ArrayList;
@@ -30,7 +31,6 @@ import java.util.UUID;
import org.apache.asterix.builders.IARecordBuilder;
import org.apache.asterix.builders.RecordBuilder;
-import org.apache.asterix.column.util.ColumnSecondaryIndexSchemaUtil;
import org.apache.asterix.common.cluster.PartitioningProperties;
import org.apache.asterix.common.config.DatasetConfig;
import org.apache.asterix.common.config.DatasetConfig.DatasetType;
@@ -65,8 +65,8 @@ import org.apache.asterix.om.types.ARecordType;
import org.apache.asterix.om.types.BuiltinType;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.types.visitor.SimpleStringBuilderForIATypeVisitor;
+import org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil;
import org.apache.asterix.runtime.operators.LSMPrimaryUpsertOperatorDescriptor;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
import org.apache.asterix.runtime.utils.RuntimeUtils;
import
org.apache.asterix.transaction.management.opcallbacks.PrimaryIndexInstantSearchOperationCallbackFactory;
import
org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
@@ -559,10 +559,9 @@ public class DatasetUtil {
}
}
- ARecordType result = indexPaths.isEmpty() ?
DataProjectionFiltrationInfo.EMPTY_TYPE
- : ColumnSecondaryIndexSchemaUtil.merge(indexPaths);
+ ARecordType result = indexPaths.isEmpty() ? EMPTY_TYPE :
ProjectionFiltrationTypeUtil.merge(indexPaths);
- if (LOGGER.isInfoEnabled() && result !=
DataProjectionFiltrationInfo.EMPTY_TYPE) {
+ if (LOGGER.isInfoEnabled() && result != EMPTY_TYPE) {
SimpleStringBuilderForIATypeVisitor schemaPrinter = new
SimpleStringBuilderForIATypeVisitor();
StringBuilder builder = new StringBuilder();
result.accept(schemaPrinter, builder);
diff --git
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/IndexUtil.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/IndexUtil.java
index df9fcec7ce..136fb372e6 100644
---
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/IndexUtil.java
+++
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/IndexUtil.java
@@ -18,6 +18,7 @@
*/
package org.apache.asterix.metadata.utils;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE;
import static
org.apache.hyracks.storage.am.common.dataflow.IndexDropOperatorDescriptor.DropOption;
import java.util.Collections;
@@ -278,10 +279,9 @@ public class IndexUtil {
DataProjectionFiltrationInfo dataProjectionInfo =
(DataProjectionFiltrationInfo) projectionInfo;
if (dataProjectionInfo == null) {
// projecting pushdown is disabled
- ARecordType metaType = metaItemType == null ? null :
DataProjectionFiltrationInfo.ALL_FIELDS_TYPE;
- return new QueryColumnTupleProjectorFactory(datasetType,
metaItemType, numberOfPrimaryKeys,
- DataProjectionFiltrationInfo.ALL_FIELDS_TYPE,
Collections.emptyMap(), metaType,
- Collections.emptyMap(),
NoOpColumnFilterEvaluatorFactory.INSTANCE,
+ ARecordType metaType = metaItemType == null ? null :
ALL_FIELDS_TYPE;
+ return new QueryColumnTupleProjectorFactory(datasetType,
metaItemType, numberOfPrimaryKeys, ALL_FIELDS_TYPE,
+ Collections.emptyMap(), metaType, Collections.emptyMap(),
NoOpColumnFilterEvaluatorFactory.INSTANCE,
NoOpColumnFilterEvaluatorFactory.INSTANCE);
}
diff --git
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SampleOperationsHelper.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SampleOperationsHelper.java
index 7587769b3b..8e5fa2b936 100644
---
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SampleOperationsHelper.java
+++
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SampleOperationsHelper.java
@@ -19,6 +19,8 @@
package org.apache.asterix.metadata.utils;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE;
+
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -40,7 +42,6 @@ import
org.apache.asterix.runtime.aggregates.collections.FirstElementEvalFactory
import org.apache.asterix.runtime.evaluators.comparisons.GreaterThanDescriptor;
import
org.apache.asterix.runtime.operators.DatasetStreamStatsOperatorDescriptor;
import org.apache.asterix.runtime.operators.LSMIndexBulkLoadOperatorDescriptor;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
import
org.apache.asterix.runtime.runningaggregates.std.SampleSlotRunningAggregateFunctionFactory;
import
org.apache.asterix.runtime.runningaggregates.std.TidRunningAggregateDescriptor;
import org.apache.asterix.runtime.utils.RuntimeUtils;
@@ -192,8 +193,7 @@ public class SampleOperationsHelper implements
ISecondaryIndexOperationsHelper {
// if format == column. Bring the entire record as we are sampling
ITupleProjectorFactory projectorFactory =
IndexUtil.createPrimaryIndexScanTupleProjectorFactory(
- dataset.getDatasetFormatInfo(),
DataProjectionFiltrationInfo.ALL_FIELDS_TYPE, itemType, metaType,
- dataset.getPrimaryKeys().size());
+ dataset.getDatasetFormatInfo(), ALL_FIELDS_TYPE, itemType,
metaType, dataset.getPrimaryKeys().size());
// dummy key provider ----> primary index scan
IOperatorDescriptor sourceOp =
DatasetUtil.createDummyKeyProviderOp(spec, dataset, metadataProvider);
diff --git
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/filter/ArrayPathCheckerVisitor.java
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/filter/ArrayPathCheckerVisitor.java
index ef1915b9f1..594cf9be4f 100644
---
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/filter/ArrayPathCheckerVisitor.java
+++
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/filter/ArrayPathCheckerVisitor.java
@@ -18,6 +18,8 @@
*/
package org.apache.asterix.metadata.utils.filter;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.EMPTY_TYPE;
+
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -29,7 +31,6 @@ import org.apache.asterix.om.types.AUnionType;
import org.apache.asterix.om.types.AbstractCollectionType;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.types.IATypeVisitor;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
/**
@@ -46,7 +47,7 @@ public class ArrayPathCheckerVisitor implements
IATypeVisitor<Boolean, AbstractC
}
public boolean containsMultipleArrayPaths(Collection<ARecordType> paths)
throws AlgebricksException {
- ARecordType mergedPaths = DataProjectionFiltrationInfo.EMPTY_TYPE;
+ ARecordType mergedPaths = EMPTY_TYPE;
for (ARecordType path : paths) {
mergedPaths = (ARecordType)
RecordMergeTypeComputer.merge(mergedPaths, path);
}
diff --git
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/util/ColumnSecondaryIndexSchemaUtil.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ProjectionFiltrationTypeUtil.java
similarity index 88%
rename from
asterixdb/asterix-column/src/main/java/org/apache/asterix/column/util/ColumnSecondaryIndexSchemaUtil.java
rename to
asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ProjectionFiltrationTypeUtil.java
index 414cd1f6be..ab837b8838 100644
---
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/util/ColumnSecondaryIndexSchemaUtil.java
+++
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/utils/ProjectionFiltrationTypeUtil.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.asterix.column.util;
+package org.apache.asterix.om.utils;
import java.util.List;
@@ -25,11 +25,15 @@ import org.apache.asterix.om.types.AOrderedListType;
import org.apache.asterix.om.types.ARecordType;
import org.apache.asterix.om.types.BuiltinType;
import org.apache.asterix.om.types.IAType;
-import org.apache.asterix.runtime.projection.DataProjectionFiltrationInfo;
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
-public class ColumnSecondaryIndexSchemaUtil {
- private ColumnSecondaryIndexSchemaUtil() {
+public class ProjectionFiltrationTypeUtil {
+ //Default open record type when requesting the entire fields
+ public static final ARecordType ALL_FIELDS_TYPE = createType("");
+ //Default open record type when requesting none of the fields
+ public static final ARecordType EMPTY_TYPE = createType("{}");
+
+ private ProjectionFiltrationTypeUtil() {
}
/**
@@ -39,7 +43,7 @@ public class ColumnSecondaryIndexSchemaUtil {
* @return expected type
*/
public static ARecordType getRecordType(List<List<String>> paths) throws
AlgebricksException {
- ARecordType result = DataProjectionFiltrationInfo.EMPTY_TYPE;
+ ARecordType result = EMPTY_TYPE;
for (List<String> path : paths) {
ARecordType type = getRecordType(path, "root", 0, BuiltinType.ANY);
result = (ARecordType) RecordMergeTypeComputer.merge(result, type);
@@ -51,7 +55,7 @@ public class ColumnSecondaryIndexSchemaUtil {
public static ARecordType getRecordTypeWithFieldTypes(List<List<String>>
paths, List<IAType> types)
throws AlgebricksException {
- ARecordType result = DataProjectionFiltrationInfo.EMPTY_TYPE;
+ ARecordType result = EMPTY_TYPE;
for (int i = 0; i < paths.size(); i++) {
List<String> path = paths.get(i);
ARecordType type = getRecordType(path, "root", 0, types.get(i));
@@ -127,4 +131,8 @@ public class ColumnSecondaryIndexSchemaUtil {
return fieldName + "_Type";
}
+ private static ARecordType createType(String typeName) {
+ return new ARecordType(typeName, new String[] {}, new IAType[] {},
true);
+ }
+
}
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/projection/DataProjectionFiltrationInfo.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/projection/DataProjectionFiltrationInfo.java
index de9b852852..4444fff443 100644
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/projection/DataProjectionFiltrationInfo.java
+++
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/projection/DataProjectionFiltrationInfo.java
@@ -18,6 +18,9 @@
*/
package org.apache.asterix.runtime.projection;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.ALL_FIELDS_TYPE;
+import static
org.apache.asterix.om.utils.ProjectionFiltrationTypeUtil.EMPTY_TYPE;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -33,12 +36,6 @@ import
org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
import
org.apache.hyracks.algebricks.core.algebra.metadata.IProjectionFiltrationInfo;
public class DataProjectionFiltrationInfo implements
IProjectionFiltrationInfo<ARecordType> {
- //Default open record type when requesting the entire fields
- public static final ARecordType ALL_FIELDS_TYPE = createType("");
- //Default open record type when requesting none of the fields
- public static final ARecordType EMPTY_TYPE = createType("{}");
- public static final String FILTER_VALUE_ACCESSOR = "filter-value-accessor";
-
private final ARecordType root;
private final Map<String, FunctionCallInformation> functionCallInfoMap;
private final Map<ILogicalExpression, ARecordType> normalizedPaths;
diff --git
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/projection/ProjectionFiltrationUtil.java
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/projection/ProjectionFiltrationUtil.java
deleted file mode 100644
index 6f2d5a49c7..0000000000
---
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/projection/ProjectionFiltrationUtil.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.runtime.projection;
-
-import org.apache.asterix.om.types.ARecordType;
-import org.apache.asterix.om.types.IAType;
-
-public class ProjectionFiltrationUtil {
- //Default open record type when requesting the entire fields
- public static final ARecordType ALL_FIELDS_TYPE = createType("");
- //Default open record type when requesting none of the fields
- public static final ARecordType EMPTY_TYPE = createType("{}");
-
- private ProjectionFiltrationUtil() {
- }
-
- private static ARecordType createType(String typeName) {
- return new ARecordType(typeName, new String[] {}, new IAType[] {},
true);
- }
-}