>From Glenn Galvizo <ggalv...@uci.edu>: Glenn Galvizo has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/15283 )
Change subject: [NO ISSUE][COMP] Extension-specific SET statements ...................................................................... [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 <jenk...@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Reviewed-by: Ian Maxon <ima...@uci.edu> --- M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/compiler/provider/ILangCompilationProvider.java M asterixdb/asterix-app/src/main/java/org/apache/asterix/api/common/APIFramework.java 2 files changed, 39 insertions(+), 31 deletions(-) Approvals: Ian Maxon: Looks good to me, approved Jenkins: Verified; Verified Objections: Anon. E. Moose #1000171: Violations found 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 f625343..8e2f472 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 @@ * @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 3a9d54d..abf5036 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.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.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 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 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 @@ this.astPrintVisitorFactory = compilationProvider.getAstPrintVisitorFactory(); this.translatorFactory = compilationProvider.getExpressionToPlanTranslatorFactory(); this.ruleSetFactory = compilationProvider.getRuleSetFactory(); + this.configurableParameterNames = compilationProvider.getConfigurableParameters(); executionPlans = new ExecutionPlans(); } @@ -502,10 +475,10 @@ } // 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); -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/15283 To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Change-Id: Ib6bafec178b959025e8822925eb27cd41d8bef03 Gerrit-Change-Number: 15283 Gerrit-PatchSet: 3 Gerrit-Owner: Glenn Galvizo <ggalv...@uci.edu> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Glenn Galvizo <ggalv...@uci.edu> Gerrit-Reviewer: Ian Maxon <ima...@uci.edu> Gerrit-Reviewer: Jenkins <jenk...@fulliautomatix.ics.uci.edu> Gerrit-MessageType: merged