This is an automated email from the ASF dual-hosted git repository. mblow pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit 45b86c53871e6ca77bd10dd08a46cca788efb84f Author: ggalvizo <[email protected]> AuthorDate: Mon Feb 14 09:20:46 2022 -0800 [NO ISSUE][COMP] Extension-specific SET statements - user model changes: no - storage format changes: no - interface changes: no Adding a method to alter the SET parameter whitelist, so as to allow extensions to more flexibly use the SET statement. Change-Id: Ib6bafec178b959025e8822925eb27cd41d8bef03 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/15283 Integration-Tests: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Reviewed-by: Ian Maxon <[email protected]> Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/17347 Reviewed-by: Michael Blow <[email protected]> Tested-by: Michael Blow <[email protected]> --- asterixdb/NOTICE | 2 +- .../provider/ILangCompilationProvider.java | 35 ++++++++++++++++++++++ .../apache/asterix/api/common/APIFramework.java | 35 +++------------------- hyracks-fullstack/NOTICE | 2 +- 4 files changed, 41 insertions(+), 33 deletions(-) diff --git a/asterixdb/NOTICE b/asterixdb/NOTICE index 17c97bb248..a46bfe7f19 100644 --- a/asterixdb/NOTICE +++ b/asterixdb/NOTICE @@ -1,5 +1,5 @@ Apache AsterixDB -Copyright 2015-2022 The Apache Software Foundation +Copyright 2015-2023 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/compiler/provider/ILangCompilationProvider.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/compiler/provider/ILangCompilationProvider.java index f625343168..8e2f47284f 100644 --- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/compiler/provider/ILangCompilationProvider.java +++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/compiler/provider/ILangCompilationProvider.java @@ -18,11 +18,24 @@ */ package org.apache.asterix.compiler.provider; +import java.util.HashSet; +import java.util.Set; + import org.apache.asterix.algebra.base.ILangExpressionToPlanTranslatorFactory; import org.apache.asterix.algebra.base.ILangExtension; +import org.apache.asterix.common.config.CompilerProperties; +import org.apache.asterix.external.feed.watch.FeedActivityDetails; import org.apache.asterix.lang.common.base.IAstPrintVisitorFactory; import org.apache.asterix.lang.common.base.IParserFactory; import org.apache.asterix.lang.common.base.IRewriterFactory; +import org.apache.asterix.lang.common.statement.StartFeedStatement; +import org.apache.asterix.lang.common.util.FunctionUtil; +import org.apache.asterix.lang.sqlpp.rewrites.SqlppQueryRewriter; +import org.apache.asterix.optimizer.base.FuzzyUtils; +import org.apache.asterix.optimizer.rules.DisjunctivePredicateToJoinRule; +import org.apache.asterix.optimizer.rules.SetAsterixPhysicalOperatorsRule; +import org.apache.asterix.optimizer.rules.util.EquivalenceClassUtils; +import org.apache.asterix.translator.SqlppExpressionToPlanTranslator; public interface ILangCompilationProvider { /** @@ -54,4 +67,26 @@ public interface ILangCompilationProvider { * @return the rule set factory of a language implementation */ IRuleSetFactory getRuleSetFactory(); + + /** + * @return all configurable parameters of a language implementation. + */ + default Set<String> getConfigurableParameters() { + return new HashSet<>(Set.of(CompilerProperties.COMPILER_JOINMEMORY_KEY, + CompilerProperties.COMPILER_GROUPMEMORY_KEY, CompilerProperties.COMPILER_SORTMEMORY_KEY, + CompilerProperties.COMPILER_WINDOWMEMORY_KEY, CompilerProperties.COMPILER_TEXTSEARCHMEMORY_KEY, + CompilerProperties.COMPILER_PARALLELISM_KEY, CompilerProperties.COMPILER_SORT_PARALLEL_KEY, + CompilerProperties.COMPILER_SORT_SAMPLES_KEY, CompilerProperties.COMPILER_EXTERNALSCANMEMORY_KEY, + CompilerProperties.COMPILER_INDEXONLY_KEY, CompilerProperties.COMPILER_INTERNAL_SANITYCHECK_KEY, + CompilerProperties.COMPILER_EXTERNAL_FIELD_PUSHDOWN_KEY, CompilerProperties.COMPILER_SUBPLAN_MERGE_KEY, + CompilerProperties.COMPILER_SUBPLAN_NESTEDPUSHDOWN_KEY, CompilerProperties.COMPILER_ARRAYINDEX_KEY, + CompilerProperties.COMPILER_MIN_MEMORY_ALLOCATION_KEY, FunctionUtil.IMPORT_PRIVATE_FUNCTIONS, + FuzzyUtils.SIM_FUNCTION_PROP_NAME, FuzzyUtils.SIM_THRESHOLD_PROP_NAME, + StartFeedStatement.WAIT_FOR_COMPLETION, FeedActivityDetails.FEED_POLICY_NAME, + FeedActivityDetails.COLLECT_LOCATIONS, SqlppQueryRewriter.INLINE_WITH_OPTION, + SqlppExpressionToPlanTranslator.REWRITE_IN_AS_OR_OPTION, "hash_merge", "output-record-type", + DisjunctivePredicateToJoinRule.REWRITE_OR_AS_JOIN_OPTION, + SetAsterixPhysicalOperatorsRule.REWRITE_ATTEMPT_BATCH_ASSIGN, + EquivalenceClassUtils.REWRITE_INTERNAL_QUERYUID_PK, SqlppQueryRewriter.SQL_COMPAT_OPTION)); + } } diff --git a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java index 3a9d54de05..abf5036372 100644 --- a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java +++ b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java @@ -54,7 +54,6 @@ import org.apache.asterix.dataflow.data.common.ExpressionTypeComputer; import org.apache.asterix.dataflow.data.common.MergeAggregationExpressionFactory; import org.apache.asterix.dataflow.data.common.MissableTypeComputer; import org.apache.asterix.dataflow.data.common.PartialAggregationTypeComputer; -import org.apache.asterix.external.feed.watch.FeedActivityDetails; import org.apache.asterix.formats.base.IDataFormat; import org.apache.asterix.jobgen.QueryLogicalExpressionJobGen; import org.apache.asterix.lang.common.base.IAstPrintVisitorFactory; @@ -65,25 +64,17 @@ import org.apache.asterix.lang.common.base.Statement; import org.apache.asterix.lang.common.rewrites.LangRewritingContext; import org.apache.asterix.lang.common.statement.FunctionDecl; import org.apache.asterix.lang.common.statement.Query; -import org.apache.asterix.lang.common.statement.StartFeedStatement; import org.apache.asterix.lang.common.statement.ViewDecl; import org.apache.asterix.lang.common.struct.VarIdentifier; -import org.apache.asterix.lang.common.util.FunctionUtil; -import org.apache.asterix.lang.sqlpp.rewrites.SqlppQueryRewriter; import org.apache.asterix.metadata.declared.MetadataProvider; import org.apache.asterix.om.base.IAObject; import org.apache.asterix.optimizer.base.AsterixOptimizationContext; -import org.apache.asterix.optimizer.base.FuzzyUtils; -import org.apache.asterix.optimizer.rules.DisjunctivePredicateToJoinRule; -import org.apache.asterix.optimizer.rules.SetAsterixPhysicalOperatorsRule; -import org.apache.asterix.optimizer.rules.util.EquivalenceClassUtils; import org.apache.asterix.runtime.job.listener.JobEventListenerFactory; import org.apache.asterix.translator.CompiledStatements.ICompiledDmlStatement; import org.apache.asterix.translator.ExecutionPlans; import org.apache.asterix.translator.IRequestParameters; import org.apache.asterix.translator.SessionConfig; import org.apache.asterix.translator.SessionOutput; -import org.apache.asterix.translator.SqlppExpressionToPlanTranslator; import org.apache.asterix.utils.ResourceUtils; import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint; import org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint; @@ -121,7 +112,6 @@ import org.apache.hyracks.control.common.config.OptionTypes; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; -import com.google.common.collect.ImmutableSet; /** * Provides helper methods for compilation of a query into a JobSpec and submission @@ -133,29 +123,11 @@ public class APIFramework { public static final String PREFIX_INTERNAL_PARAMETERS = "_internal"; - // A white list of supported configurable parameters. - private static final Set<String> CONFIGURABLE_PARAMETER_NAMES = ImmutableSet.of( - CompilerProperties.COMPILER_JOINMEMORY_KEY, CompilerProperties.COMPILER_GROUPMEMORY_KEY, - CompilerProperties.COMPILER_SORTMEMORY_KEY, CompilerProperties.COMPILER_WINDOWMEMORY_KEY, - CompilerProperties.COMPILER_TEXTSEARCHMEMORY_KEY, CompilerProperties.COMPILER_PARALLELISM_KEY, - CompilerProperties.COMPILER_SORT_PARALLEL_KEY, CompilerProperties.COMPILER_SORT_SAMPLES_KEY, - CompilerProperties.COMPILER_EXTERNALSCANMEMORY_KEY, CompilerProperties.COMPILER_INDEXONLY_KEY, - CompilerProperties.COMPILER_INTERNAL_SANITYCHECK_KEY, - CompilerProperties.COMPILER_EXTERNAL_FIELD_PUSHDOWN_KEY, CompilerProperties.COMPILER_SUBPLAN_MERGE_KEY, - CompilerProperties.COMPILER_SUBPLAN_NESTEDPUSHDOWN_KEY, CompilerProperties.COMPILER_ARRAYINDEX_KEY, - CompilerProperties.COMPILER_MIN_MEMORY_ALLOCATION_KEY, FunctionUtil.IMPORT_PRIVATE_FUNCTIONS, - FuzzyUtils.SIM_FUNCTION_PROP_NAME, FuzzyUtils.SIM_THRESHOLD_PROP_NAME, - StartFeedStatement.WAIT_FOR_COMPLETION, FeedActivityDetails.FEED_POLICY_NAME, - FeedActivityDetails.COLLECT_LOCATIONS, SqlppQueryRewriter.INLINE_WITH_OPTION, - SqlppExpressionToPlanTranslator.REWRITE_IN_AS_OR_OPTION, "hash_merge", "output-record-type", - DisjunctivePredicateToJoinRule.REWRITE_OR_AS_JOIN_OPTION, - SetAsterixPhysicalOperatorsRule.REWRITE_ATTEMPT_BATCH_ASSIGN, - EquivalenceClassUtils.REWRITE_INTERNAL_QUERYUID_PK, SqlppQueryRewriter.SQL_COMPAT_OPTION); - private final IRewriterFactory rewriterFactory; private final IAstPrintVisitorFactory astPrintVisitorFactory; private final ILangExpressionToPlanTranslatorFactory translatorFactory; private final IRuleSetFactory ruleSetFactory; + private final Set<String> configurableParameterNames; private final ExecutionPlans executionPlans; public APIFramework(ILangCompilationProvider compilationProvider) { @@ -163,6 +135,7 @@ public class APIFramework { this.astPrintVisitorFactory = compilationProvider.getAstPrintVisitorFactory(); this.translatorFactory = compilationProvider.getExpressionToPlanTranslatorFactory(); this.ruleSetFactory = compilationProvider.getRuleSetFactory(); + this.configurableParameterNames = compilationProvider.getConfigurableParameters(); executionPlans = new ExecutionPlans(); } @@ -502,10 +475,10 @@ public class APIFramework { } // Validates if the query contains unsupported query parameters. - private static Map<String, Object> validateConfig(Map<String, Object> config, SourceLocation sourceLoc) + private Map<String, Object> validateConfig(Map<String, Object> config, SourceLocation sourceLoc) throws AlgebricksException { for (String parameterName : config.keySet()) { - if (!CONFIGURABLE_PARAMETER_NAMES.contains(parameterName) + if (!configurableParameterNames.contains(parameterName) && !parameterName.startsWith(PREFIX_INTERNAL_PARAMETERS)) { throw AsterixException.create(ErrorCode.COMPILATION_UNSUPPORTED_QUERY_PARAMETER, sourceLoc, parameterName); diff --git a/hyracks-fullstack/NOTICE b/hyracks-fullstack/NOTICE index 2e33eed8fb..6e9c46bca4 100644 --- a/hyracks-fullstack/NOTICE +++ b/hyracks-fullstack/NOTICE @@ -1,5 +1,5 @@ Apache Hyracks and Algebricks -Copyright 2015-2022 The Apache Software Foundation +Copyright 2015-2023 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/).
