diff --git a/.circleci/continue_config.yml b/.circleci/continue_config.yml
index bddbafb0ef43d..193be83bb7f6c 100644
--- a/.circleci/continue_config.yml
+++ b/.circleci/continue_config.yml
@@ -33,6 +33,10 @@ workflows:
run_linux_tests: << pipeline.parameters.run_linux_tests >>
requires:
- linux-build-and-unit-test
+ - linux-presto-native-sidecar-tests:
+ run_linux_tests: << pipeline.parameters.run_linux_tests >>
+ requires:
+ - linux-build-and-unit-test
conditionals:
when: << pipeline.parameters.run_native_specific_jobs >>
@@ -193,6 +197,51 @@ jobs:
- store_artifacts:
path: '/tmp/PrestoNativeQueryRunnerUtils'
+ linux-presto-native-sidecar-tests:
+ executor: build
+ parameters:
+ run_linux_tests:
+ type: boolean
+ default: false
+ parallelism: 5
+ steps:
+ - run: echo "Run Linux tests is << parameters.run_linux_tests >>"
+ - when:
+ condition: << parameters.run_linux_tests >>
+ steps:
+ - checkout
+ - attach_workspace:
+ at: presto-native-execution
+ - maven_install:
+ maven_install_opts: ${MAVEN_INSTALL_OPTS}
+ maven_fast_install: ${MAVEN_FAST_INSTALL}
+ - run:
+ name: 'Run Presto native sidecar tests'
+ command: |
+ export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib:/usr/local/lib64"
+ export PRESTO_SERVER_PATH="${HOME}/project/presto-native-execution/_build/debug/presto_cpp/main/presto_server"
+ export TEMP_PATH="/tmp"
+ TESTFILES=$(circleci tests glob "presto-native-sidecar-plugin/src/test/**/Test*.java" | circleci tests split --split-by=timings)
+ # Convert file paths to comma separated class names
+ export TESTCLASSES=
+ for test_file in $TESTFILES
+ do
+ tmp=${test_file##*/}
+ test_class=${tmp%%\.*}
+ export TESTCLASSES="${TESTCLASSES},$test_class"
+ done
+ export TESTCLASSES=${TESTCLASSES#,}
+ if [ ! -z $TESTCLASSES ]; then
+ mvn test \
+ ${MAVEN_TEST} \
+ -pl 'presto-native-sidecar-plugin' \
+ -Dtest="${TESTCLASSES}" \
+ -DPRESTO_SERVER=${PRESTO_SERVER_PATH} \
+ -DDATA_DIR=${TEMP_PATH} \
+ -Duser.timezone=America/Bahia_Banderas \
+ -T1C
+ fi
+
linux-spark-e2e-tests:
executor: build
parameters:
diff --git a/.github/workflows/test-other-modules.yml b/.github/workflows/test-other-modules.yml
index ccfccf6a79c0c..3c3f84817a0d1 100644
--- a/.github/workflows/test-other-modules.yml
+++ b/.github/workflows/test-other-modules.yml
@@ -83,4 +83,5 @@ jobs:
!presto-native-execution,
!presto-test-coverage,
!presto-iceberg,
- !presto-singlestore'
+ !presto-singlestore,
+ !presto-native-sidecar-plugin'
diff --git a/pom.xml b/pom.xml
index fd8bb1baddba1..e00a654e529f8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -200,6 +200,7 @@
presto-singlestore
presto-hana
presto-openapi
+ presto-native-sidecar-plugin
@@ -450,6 +451,12 @@
${project.version}
+
+ com.facebook.presto
+ presto-session-property-providers
+ ${project.version}
+
+
com.facebook.presto
presto-bigquery
diff --git a/presto-druid/src/test/java/com/facebook/presto/druid/TestDruidQueryBase.java b/presto-druid/src/test/java/com/facebook/presto/druid/TestDruidQueryBase.java
index f1fabf17c495b..428d6d7bf300d 100644
--- a/presto-druid/src/test/java/com/facebook/presto/druid/TestDruidQueryBase.java
+++ b/presto-druid/src/test/java/com/facebook/presto/druid/TestDruidQueryBase.java
@@ -20,7 +20,6 @@
import com.facebook.presto.metadata.FunctionAndTypeManager;
import com.facebook.presto.metadata.Metadata;
import com.facebook.presto.metadata.MetadataManager;
-import com.facebook.presto.metadata.SessionPropertyManager;
import com.facebook.presto.spi.ColumnHandle;
import com.facebook.presto.spi.ConnectorId;
import com.facebook.presto.spi.ConnectorSession;
@@ -62,6 +61,7 @@
import static com.facebook.presto.druid.DruidQueryGeneratorContext.Origin.DERIVED;
import static com.facebook.presto.druid.DruidQueryGeneratorContext.Origin.TABLE_COLUMN;
import static com.facebook.presto.metadata.FunctionAndTypeManager.createTestFunctionAndTypeManager;
+import static com.facebook.presto.metadata.SessionPropertyManager.createTestingSessionPropertyManager;
import static com.facebook.presto.spi.plan.LimitNode.Step.FINAL;
import static com.facebook.presto.sql.analyzer.ExpressionAnalyzer.getExpressionTypes;
import static com.facebook.presto.testing.TestingConnectorSession.SESSION;
@@ -109,7 +109,7 @@ protected static class SessionHolder
public SessionHolder()
{
connectorSession = SESSION;
- session = TestingSession.testSessionBuilder(new SessionPropertyManager(new SystemSessionProperties().getSessionProperties())).build();
+ session = TestingSession.testSessionBuilder(createTestingSessionPropertyManager(new SystemSessionProperties().getSessionProperties())).build();
}
public ConnectorSession getConnectorSession()
diff --git a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergFileWriter.java b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergFileWriter.java
index e96b0a501d788..734d47172ded8 100644
--- a/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergFileWriter.java
+++ b/presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergFileWriter.java
@@ -63,6 +63,7 @@
import static com.facebook.presto.iceberg.IcebergAbstractMetadata.toIcebergSchema;
import static com.facebook.presto.iceberg.IcebergQueryRunner.ICEBERG_CATALOG;
import static com.facebook.presto.iceberg.IcebergSessionProperties.dataSizeSessionProperty;
+import static com.facebook.presto.metadata.SessionPropertyManager.createTestingSessionPropertyManager;
import static com.facebook.presto.testing.TestingSession.testSessionBuilder;
import static com.google.common.io.Files.createTempDir;
import static org.apache.iceberg.parquet.ParquetSchemaUtil.convert;
@@ -78,7 +79,7 @@ public class TestIcebergFileWriter
public void setup() throws Exception
{
ConnectorId connectorId = new ConnectorId("iceberg");
- SessionPropertyManager sessionPropertyManager = new SessionPropertyManager();
+ SessionPropertyManager sessionPropertyManager = createTestingSessionPropertyManager();
sessionPropertyManager.addConnectorSessionProperties(
connectorId,
diff --git a/presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java b/presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java
index c22c7e80f06a8..dd0070fba695d 100644
--- a/presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java
+++ b/presto-main/src/main/java/com/facebook/presto/SystemSessionProperties.java
@@ -152,19 +152,7 @@ public final class SystemSessionProperties
public static final String TREAT_LOW_CONFIDENCE_ZERO_ESTIMATION_AS_UNKNOWN_ENABLED = "treat_low_confidence_zero_estimation_unknown_enabled";
public static final String SPILL_ENABLED = "spill_enabled";
public static final String JOIN_SPILL_ENABLED = "join_spill_enabled";
- public static final String AGGREGATION_SPILL_ENABLED = "aggregation_spill_enabled";
- public static final String TOPN_SPILL_ENABLED = "topn_spill_enabled";
- public static final String DISTINCT_AGGREGATION_SPILL_ENABLED = "distinct_aggregation_spill_enabled";
- public static final String DEDUP_BASED_DISTINCT_AGGREGATION_SPILL_ENABLED = "dedup_based_distinct_aggregation_spill_enabled";
- public static final String DISTINCT_AGGREGATION_LARGE_BLOCK_SPILL_ENABLED = "distinct_aggregation_large_block_spill_enabled";
- public static final String DISTINCT_AGGREGATION_LARGE_BLOCK_SIZE_THRESHOLD = "distinct_aggregation_large_block_size_threshold";
- public static final String ORDER_BY_AGGREGATION_SPILL_ENABLED = "order_by_aggregation_spill_enabled";
- public static final String WINDOW_SPILL_ENABLED = "window_spill_enabled";
- public static final String ORDER_BY_SPILL_ENABLED = "order_by_spill_enabled";
- public static final String AGGREGATION_OPERATOR_UNSPILL_MEMORY_LIMIT = "aggregation_operator_unspill_memory_limit";
- public static final String TOPN_OPERATOR_UNSPILL_MEMORY_LIMIT = "topn_operator_unspill_memory_limit";
public static final String QUERY_MAX_REVOCABLE_MEMORY_PER_NODE = "query_max_revocable_memory_per_node";
- public static final String TEMP_STORAGE_SPILLER_BUFFER_SIZE = "temp_storage_spiller_buffer_size";
public static final String OPTIMIZE_DISTINCT_AGGREGATIONS = "optimize_mixed_distinct_aggregations";
public static final String LEGACY_ROW_FIELD_ORDINAL_ACCESS = "legacy_row_field_ordinal_access";
public static final String LEGACY_MAP_SUBSCRIPT = "do_not_use_legacy_map_subscript";
@@ -332,48 +320,18 @@ public final class SystemSessionProperties
public static final String PRINT_ESTIMATED_STATS_FROM_CACHE = "print_estimated_stats_from_cache";
public static final String REMOVE_CROSS_JOIN_WITH_CONSTANT_SINGLE_ROW_INPUT = "remove_cross_join_with_constant_single_row_input";
public static final String EAGER_PLAN_VALIDATION_ENABLED = "eager_plan_validation_enabled";
+ public static final String DEFAULT_VIEW_SECURITY_MODE = "default_view_security_mode";
+ public static final String JOIN_PREFILTER_BUILD_SIDE = "join_prefilter_build_side";
+ public static final String OPTIMIZER_USE_HISTOGRAMS = "optimizer_use_histograms";
+ public static final String WARN_ON_COMMON_NAN_PATTERNS = "warn_on_common_nan_patterns";
+ public static final String INLINE_PROJECTIONS_ON_VALUES = "inline_projections_on_values";
// TODO: Native execution related session properties that are temporarily put here. They will be relocated in the future.
- public static final String NATIVE_SIMPLIFIED_EXPRESSION_EVALUATION_ENABLED = "native_simplified_expression_evaluation_enabled";
- public static final String NATIVE_EXPRESSION_MAX_ARRAY_SIZE_IN_REDUCE = "native_expression_max_array_size_in_reduce";
public static final String NATIVE_AGGREGATION_SPILL_ALL = "native_aggregation_spill_all";
- public static final String NATIVE_MAX_SPILL_LEVEL = "native_max_spill_level";
- public static final String NATIVE_MAX_SPILL_FILE_SIZE = "native_max_spill_file_size";
- public static final String NATIVE_SPILL_COMPRESSION_CODEC = "native_spill_compression_codec";
- public static final String NATIVE_SPILL_WRITE_BUFFER_SIZE = "native_spill_write_buffer_size";
- public static final String NATIVE_SPILL_FILE_CREATE_CONFIG = "native_spill_file_create_config";
- public static final String NATIVE_JOIN_SPILL_ENABLED = "native_join_spill_enabled";
- public static final String NATIVE_WINDOW_SPILL_ENABLED = "native_window_spill_enabled";
- public static final String NATIVE_WRITER_SPILL_ENABLED = "native_writer_spill_enabled";
- public static final String NATIVE_ROW_NUMBER_SPILL_ENABLED = "native_row_number_spill_enabled";
- public static final String NATIVE_TOPN_ROW_NUMBER_SPILL_ENABLED = "native_topn_row_number_spill_enabled";
- public static final String NATIVE_SPILLER_NUM_PARTITION_BITS = "native_spiller_num_partition_bits";
private static final String NATIVE_EXECUTION_ENABLED = "native_execution_enabled";
private static final String NATIVE_EXECUTION_EXECUTABLE_PATH = "native_execution_executable_path";
private static final String NATIVE_EXECUTION_PROGRAM_ARGUMENTS = "native_execution_program_arguments";
public static final String NATIVE_EXECUTION_PROCESS_REUSE_ENABLED = "native_execution_process_reuse_enabled";
- public static final String NATIVE_DEBUG_VALIDATE_OUTPUT_FROM_OPERATORS = "native_debug_validate_output_from_operators";
- public static final String NATIVE_DEBUG_DISABLE_EXPRESSION_WITH_PEELING = "native_debug_disable_expression_with_peeling";
- public static final String NATIVE_DEBUG_DISABLE_COMMON_SUB_EXPRESSION = "native_debug_disable_common_sub_expressions";
- public static final String NATIVE_DEBUG_DISABLE_EXPRESSION_WITH_MEMOIZATION = "native_debug_disable_expression_with_memoization";
- public static final String NATIVE_DEBUG_DISABLE_EXPRESSION_WITH_LAZY_INPUTS = "native_debug_disable_expression_with_lazy_inputs";
- public static final String NATIVE_SELECTIVE_NIMBLE_READER_ENABLED = "native_selective_nimble_reader_enabled";
- public static final String NATIVE_MAX_PARTIAL_AGGREGATION_MEMORY = "native_max_partial_aggregation_memory";
- public static final String NATIVE_MAX_EXTENDED_PARTIAL_AGGREGATION_MEMORY = "native_max_extended_partial_aggregation_memory";
- public static final String NATIVE_MAX_SPILL_BYTES = "native_max_spill_bytes";
- public static final String NATIVE_QUERY_TRACE_ENABLED = "native_query_trace_enabled";
- public static final String NATIVE_QUERY_TRACE_DIR = "native_query_trace_dir";
- public static final String NATIVE_QUERY_TRACE_NODE_IDS = "native_query_trace_node_ids";
- public static final String NATIVE_QUERY_TRACE_MAX_BYTES = "native_query_trace_max_bytes";
- public static final String NATIVE_QUERY_TRACE_REG_EXP = "native_query_trace_task_reg_exp";
- public static final String NATIVE_MAX_PAGE_PARTITIONING_BUFFER_SIZE = "native_max_page_partitioning_buffer_size";
- public static final String NATIVE_MAX_OUTPUT_BUFFER_SIZE = "native_max_output_buffer_size";
-
- public static final String DEFAULT_VIEW_SECURITY_MODE = "default_view_security_mode";
- public static final String JOIN_PREFILTER_BUILD_SIDE = "join_prefilter_build_side";
- public static final String OPTIMIZER_USE_HISTOGRAMS = "optimizer_use_histograms";
- public static final String WARN_ON_COMMON_NAN_PATTERNS = "warn_on_common_nan_patterns";
- public static final String INLINE_PROJECTIONS_ON_VALUES = "inline_projections_on_values";
private final List> sessionProperties;
@@ -822,73 +780,6 @@ public SystemSessionProperties(
"Enable join spilling",
featuresConfig.isJoinSpillingEnabled(),
false),
- booleanProperty(
- AGGREGATION_SPILL_ENABLED,
- "Enable aggregate spilling if spill_enabled",
- featuresConfig.isAggregationSpillEnabled(),
- false),
- booleanProperty(
- TOPN_SPILL_ENABLED,
- "Enable topN spilling if spill_enabled",
- featuresConfig.isTopNSpillEnabled(),
- false),
- booleanProperty(
- DISTINCT_AGGREGATION_SPILL_ENABLED,
- "Enable spill for distinct aggregations if spill_enabled and aggregation_spill_enabled",
- featuresConfig.isDistinctAggregationSpillEnabled(),
- false),
- booleanProperty(
- DEDUP_BASED_DISTINCT_AGGREGATION_SPILL_ENABLED,
- "Perform deduplication of input data for distinct aggregates before spilling",
- featuresConfig.isDedupBasedDistinctAggregationSpillEnabled(),
- false),
- booleanProperty(
- DISTINCT_AGGREGATION_LARGE_BLOCK_SPILL_ENABLED,
- "Spill large block to a separate spill file",
- featuresConfig.isDistinctAggregationLargeBlockSpillEnabled(),
- false),
- new PropertyMetadata<>(
- DISTINCT_AGGREGATION_LARGE_BLOCK_SIZE_THRESHOLD,
- "Block size threshold beyond which it will be spilled into a separate spill file",
- VARCHAR,
- DataSize.class,
- featuresConfig.getDistinctAggregationLargeBlockSizeThreshold(),
- false,
- value -> DataSize.valueOf((String) value),
- DataSize::toString),
- booleanProperty(
- ORDER_BY_AGGREGATION_SPILL_ENABLED,
- "Enable spill for order-by aggregations if spill_enabled and aggregation_spill_enabled",
- featuresConfig.isOrderByAggregationSpillEnabled(),
- false),
- booleanProperty(
- WINDOW_SPILL_ENABLED,
- "Enable window spilling if spill_enabled",
- featuresConfig.isWindowSpillEnabled(),
- false),
- booleanProperty(
- ORDER_BY_SPILL_ENABLED,
- "Enable order by spilling if spill_enabled",
- featuresConfig.isOrderBySpillEnabled(),
- false),
- new PropertyMetadata<>(
- AGGREGATION_OPERATOR_UNSPILL_MEMORY_LIMIT,
- "Experimental: How much memory can should be allocated per aggregation operator in unspilling process",
- VARCHAR,
- DataSize.class,
- featuresConfig.getAggregationOperatorUnspillMemoryLimit(),
- false,
- value -> DataSize.valueOf((String) value),
- DataSize::toString),
- new PropertyMetadata<>(
- TOPN_OPERATOR_UNSPILL_MEMORY_LIMIT,
- "How much memory can should be allocated per topN operator in unspilling process",
- VARCHAR,
- DataSize.class,
- featuresConfig.getTopNOperatorUnspillMemoryLimit(),
- false,
- value -> DataSize.valueOf((String) value),
- DataSize::toString),
new PropertyMetadata<>(
QUERY_MAX_REVOCABLE_MEMORY_PER_NODE,
"Maximum amount of revocable memory a query can use",
@@ -898,15 +789,6 @@ public SystemSessionProperties(
true,
value -> DataSize.valueOf((String) value),
DataSize::toString),
- new PropertyMetadata<>(
- TEMP_STORAGE_SPILLER_BUFFER_SIZE,
- "Experimental: Buffer size used by TempStorageSingleStreamSpiller",
- VARCHAR,
- DataSize.class,
- nodeSpillConfig.getTempStorageBufferSize(),
- false,
- value -> DataSize.valueOf((String) value),
- DataSize::toString),
booleanProperty(
OPTIMIZE_DISTINCT_AGGREGATIONS,
"Optimize mixed non-distinct and distinct aggregations",
@@ -1646,16 +1528,6 @@ public SystemSessionProperties(
"Combine individual approx_percentile calls on individual field to evaluation on an array",
featuresConfig.isOptimizeMultipleApproxPercentileOnSameFieldEnabled(),
false),
- booleanProperty(
- NATIVE_SIMPLIFIED_EXPRESSION_EVALUATION_ENABLED,
- "Native Execution only. Enable simplified path in expression evaluation",
- false,
- false),
- integerProperty(
- NATIVE_EXPRESSION_MAX_ARRAY_SIZE_IN_REDUCE,
- "Native Execution only. Reduce() function will throw an error if it encounters an array of size greater than this value.",
- 100000,
- false),
booleanProperty(
NATIVE_AGGREGATION_SPILL_ALL,
"Native Execution only. If true and spilling has been triggered during the input " +
@@ -1664,160 +1536,16 @@ public SystemSessionProperties(
"output processing stage.",
true,
false),
- integerProperty(
- NATIVE_MAX_SPILL_LEVEL,
- "Native Execution only. The maximum allowed spilling level for hash join build.\n" +
- "0 is the initial spilling level, -1 means unlimited.",
- 4,
- false),
- integerProperty(
- NATIVE_MAX_SPILL_FILE_SIZE,
- "The max allowed spill file size. If it is zero, then there is no limit.",
- 0,
- false),
- stringProperty(
- NATIVE_SPILL_COMPRESSION_CODEC,
- "Native Execution only. The compression algorithm type to compress the spilled data.\n " +
- "Supported compression codecs are: ZLIB, SNAPPY, LZO, ZSTD, LZ4 and GZIP. NONE means no compression.",
- "zstd",
- false),
- longProperty(
- NATIVE_SPILL_WRITE_BUFFER_SIZE,
- "Native Execution only. The maximum size in bytes to buffer the serialized spill data before writing to disk for IO efficiency.\n" +
- "If set to zero, buffering is disabled.",
- 1024L * 1024L,
- false),
- stringProperty(
- NATIVE_SPILL_FILE_CREATE_CONFIG,
- "Native Execution only. Config used to create spill files. This config is \n" +
- "provided to underlying file system and the config is free form. The form should be\n" +
- "defined by the underlying file system.",
- "",
- false),
- booleanProperty(
- NATIVE_JOIN_SPILL_ENABLED,
- "Native Execution only. Enable join spilling on native engine",
- false,
- false),
- booleanProperty(
- NATIVE_WINDOW_SPILL_ENABLED,
- "Native Execution only. Enable window spilling on native engine",
- false,
- false),
- booleanProperty(
- NATIVE_WRITER_SPILL_ENABLED,
- "Native Execution only. Enable writer spilling on native engine",
- false,
- false),
- booleanProperty(
- NATIVE_ROW_NUMBER_SPILL_ENABLED,
- "Native Execution only. Enable row number spilling on native engine",
- false,
- false),
booleanProperty(
- NATIVE_TOPN_ROW_NUMBER_SPILL_ENABLED,
- "Native Execution only. Enable topN row number spilling on native engine",
- false,
- false),
- integerProperty(
- NATIVE_SPILLER_NUM_PARTITION_BITS,
- "Native Execution only. The number of bits (N) used to calculate the " +
- "spilling partition number for hash join and RowNumber: 2 ^ N",
- 3,
- false),
+ NATIVE_EXECUTION_ENABLED,
+ "Enable execution on native engine",
+ featuresConfig.isNativeExecutionEnabled(),
+ true),
booleanProperty(
NATIVE_EXECUTION_PROCESS_REUSE_ENABLED,
"Enable reuse the native process within the same JVM",
true,
false),
- booleanProperty(
- NATIVE_DEBUG_VALIDATE_OUTPUT_FROM_OPERATORS,
- "If set to true, then during execution of tasks, the output vectors of " +
- "every operator are validated for consistency. This is an expensive check " +
- "so should only be used for debugging. It can help debug issues where " +
- "malformed vector cause failures or crashes by helping identify which " +
- "operator is generating them.",
- false,
- true),
- booleanProperty(
- NATIVE_DEBUG_DISABLE_EXPRESSION_WITH_PEELING,
- "If set to true, disables optimization in expression evaluation to peel common " +
- "dictionary layer from inputs. Should only be used for debugging.",
- false,
- true),
- booleanProperty(
- NATIVE_DEBUG_DISABLE_COMMON_SUB_EXPRESSION,
- "If set to true, disables optimization in expression evaluation to reuse cached " +
- "results for common sub-expressions. Should only be used for debugging.",
- false,
- true),
- booleanProperty(
- NATIVE_DEBUG_DISABLE_EXPRESSION_WITH_MEMOIZATION,
- "If set to true, disables optimization in expression evaluation to reuse cached " +
- "results between subsequent input batches that are dictionary encoded and " +
- "have the same alphabet(underlying flat vector). Should only be used for " +
- "debugging.",
- false,
- true),
- booleanProperty(
- NATIVE_DEBUG_DISABLE_EXPRESSION_WITH_LAZY_INPUTS,
- "If set to true, disables optimization in expression evaluation to delay loading " +
- "of lazy inputs unless required. Should only be used for debugging.",
- false,
- true),
- booleanProperty(
- NATIVE_SELECTIVE_NIMBLE_READER_ENABLED,
- "Temporary flag to control whether selective Nimble reader should be " +
- "used in this query or not. Will be removed after the selective Nimble " +
- "reader is fully rolled out.",
- false,
- true),
- longProperty(
- NATIVE_MAX_PARTIAL_AGGREGATION_MEMORY,
- "The max partial aggregation memory when data reduction is not optimal.",
- 1L << 24,
- false),
- longProperty(
- NATIVE_MAX_EXTENDED_PARTIAL_AGGREGATION_MEMORY,
- "The max partial aggregation memory when data reduction is optimal.",
- 1L << 26,
- false),
- longProperty(
- NATIVE_MAX_SPILL_BYTES,
- "The max allowed spill bytes",
- 100L << 30,
- false),
- booleanProperty(NATIVE_QUERY_TRACE_ENABLED,
- "Enables query tracing.",
- false,
- false),
- stringProperty(NATIVE_QUERY_TRACE_DIR,
- "Base dir of a query to store tracing data.",
- "",
- false),
- stringProperty(NATIVE_QUERY_TRACE_NODE_IDS,
- "A comma-separated list of plan node ids whose input data will be traced. Empty string if only want to trace the query metadata.",
- "",
- false),
- longProperty(NATIVE_QUERY_TRACE_MAX_BYTES,
- "The max trace bytes limit. Tracing is disabled if zero.",
- 0L,
- false),
- stringProperty(NATIVE_QUERY_TRACE_REG_EXP,
- "The regexp of traced task id. We only enable trace on a task if its id matches.",
- "",
- false),
- longProperty(NATIVE_MAX_OUTPUT_BUFFER_SIZE,
- "The maximum size in bytes for the task's buffered output. The buffer is shared among all drivers.",
- 200L << 20,
- false),
- longProperty(NATIVE_MAX_PAGE_PARTITIONING_BUFFER_SIZE,
- "The maximum bytes to buffer per PartitionedOutput operator to avoid creating tiny " +
- "SerializedPages. For PartitionedOutputNode::Kind::kPartitioned, PartitionedOutput operator " +
- "would buffer up to that number of bytes / number of destinations for each destination before " +
- "producing a SerializedPage.",
- 24L << 20,
- false),
booleanProperty(
RANDOMIZE_OUTER_JOIN_NULL_KEY,
"(Deprecated) Randomize null join key for outer join",
@@ -2472,77 +2200,11 @@ public static boolean isJoinSpillingEnabled(Session session)
return session.getSystemProperty(JOIN_SPILL_ENABLED, Boolean.class) && isSpillEnabled(session);
}
- public static boolean isAggregationSpillEnabled(Session session)
- {
- return session.getSystemProperty(AGGREGATION_SPILL_ENABLED, Boolean.class) && isSpillEnabled(session);
- }
-
- public static boolean isTopNSpillEnabled(Session session)
- {
- return session.getSystemProperty(TOPN_SPILL_ENABLED, Boolean.class) && isSpillEnabled(session);
- }
-
- public static boolean isDistinctAggregationSpillEnabled(Session session)
- {
- return session.getSystemProperty(DISTINCT_AGGREGATION_SPILL_ENABLED, Boolean.class) && isAggregationSpillEnabled(session);
- }
-
- public static boolean isDedupBasedDistinctAggregationSpillEnabled(Session session)
- {
- return session.getSystemProperty(DEDUP_BASED_DISTINCT_AGGREGATION_SPILL_ENABLED, Boolean.class);
- }
-
- public static boolean isDistinctAggregationLargeBlockSpillEnabled(Session session)
- {
- return session.getSystemProperty(DISTINCT_AGGREGATION_LARGE_BLOCK_SPILL_ENABLED, Boolean.class);
- }
-
- public static DataSize getDistinctAggregationLargeBlockSizeThreshold(Session session)
- {
- return session.getSystemProperty(DISTINCT_AGGREGATION_LARGE_BLOCK_SIZE_THRESHOLD, DataSize.class);
- }
-
- public static boolean isOrderByAggregationSpillEnabled(Session session)
- {
- return session.getSystemProperty(ORDER_BY_AGGREGATION_SPILL_ENABLED, Boolean.class) && isAggregationSpillEnabled(session);
- }
-
- public static boolean isWindowSpillEnabled(Session session)
- {
- return session.getSystemProperty(WINDOW_SPILL_ENABLED, Boolean.class) && isSpillEnabled(session);
- }
-
- public static boolean isOrderBySpillEnabled(Session session)
- {
- return session.getSystemProperty(ORDER_BY_SPILL_ENABLED, Boolean.class) && isSpillEnabled(session);
- }
-
- public static DataSize getAggregationOperatorUnspillMemoryLimit(Session session)
- {
- DataSize memoryLimitForMerge = session.getSystemProperty(AGGREGATION_OPERATOR_UNSPILL_MEMORY_LIMIT, DataSize.class);
- checkArgument(memoryLimitForMerge.toBytes() >= 0, "%s must be non-negative", AGGREGATION_OPERATOR_UNSPILL_MEMORY_LIMIT);
- return memoryLimitForMerge;
- }
-
- public static DataSize getTopNOperatorUnspillMemoryLimit(Session session)
- {
- DataSize unspillMemoryLimit = session.getSystemProperty(TOPN_OPERATOR_UNSPILL_MEMORY_LIMIT, DataSize.class);
- checkArgument(unspillMemoryLimit.toBytes() >= 0, "%s must be non-negative", TOPN_OPERATOR_UNSPILL_MEMORY_LIMIT);
- return unspillMemoryLimit;
- }
-
public static DataSize getQueryMaxRevocableMemoryPerNode(Session session)
{
return session.getSystemProperty(QUERY_MAX_REVOCABLE_MEMORY_PER_NODE, DataSize.class);
}
- public static DataSize getTempStorageSpillerBufferSize(Session session)
- {
- DataSize tempStorageSpillerBufferSize = session.getSystemProperty(TEMP_STORAGE_SPILLER_BUFFER_SIZE, DataSize.class);
- checkArgument(tempStorageSpillerBufferSize.toBytes() >= 0, "%s must be non-negative", TEMP_STORAGE_SPILLER_BUFFER_SIZE);
- return tempStorageSpillerBufferSize;
- }
-
public static boolean isOptimizeDistinctAggregationEnabled(Session session)
{
return session.getSystemProperty(OPTIMIZE_DISTINCT_AGGREGATIONS, Boolean.class);
@@ -2604,6 +2266,11 @@ public static boolean shouldPushAggregationThroughJoin(Session session)
return session.getSystemProperty(PUSH_AGGREGATION_THROUGH_JOIN, Boolean.class);
}
+ public static boolean isNativeExecutionEnabled(Session session)
+ {
+ return session.getSystemProperty(NATIVE_EXECUTION_ENABLED, Boolean.class);
+ }
+
public static boolean isPushAggregationThroughJoin(Session session)
{
return session.getSystemProperty(PUSH_PARTIAL_AGGREGATION_THROUGH_JOIN, Boolean.class);
diff --git a/presto-main/src/main/java/com/facebook/presto/connector/ConnectorAwareNodeManager.java b/presto-main/src/main/java/com/facebook/presto/connector/ConnectorAwareNodeManager.java
index 3506d55393f21..b0b092b4a306a 100644
--- a/presto-main/src/main/java/com/facebook/presto/connector/ConnectorAwareNodeManager.java
+++ b/presto-main/src/main/java/com/facebook/presto/connector/ConnectorAwareNodeManager.java
@@ -20,12 +20,12 @@
import com.facebook.presto.spi.NodeManager;
import com.facebook.presto.spi.PrestoException;
import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Iterables;
+import java.util.Random;
import java.util.Set;
import static com.facebook.presto.spi.StandardErrorCode.NO_CPP_SIDECARS;
-import static com.facebook.presto.spi.StandardErrorCode.TOO_MANY_SIDECARS;
-import static com.google.common.collect.Iterables.getOnlyElement;
import static java.util.Objects.requireNonNull;
public class ConnectorAwareNodeManager
@@ -70,10 +70,7 @@ public Node getSidecarNode()
if (coordinatorSidecars.isEmpty()) {
throw new PrestoException(NO_CPP_SIDECARS, "Expected exactly one coordinator sidecar, but found none");
}
- if (coordinatorSidecars.size() > 1) {
- throw new PrestoException(TOO_MANY_SIDECARS, "Expected exactly one coordinator sidecar, but found " + coordinatorSidecars.size());
- }
- return getOnlyElement(coordinatorSidecars);
+ return Iterables.get(coordinatorSidecars, new Random().nextInt(coordinatorSidecars.size()));
}
@Override
diff --git a/presto-main/src/main/java/com/facebook/presto/connector/system/SystemConnectorSessionUtil.java b/presto-main/src/main/java/com/facebook/presto/connector/system/SystemConnectorSessionUtil.java
index 3fe9b2601ed24..19cc00b0a7065 100644
--- a/presto-main/src/main/java/com/facebook/presto/connector/system/SystemConnectorSessionUtil.java
+++ b/presto-main/src/main/java/com/facebook/presto/connector/system/SystemConnectorSessionUtil.java
@@ -16,13 +16,14 @@
import com.facebook.presto.Session;
import com.facebook.presto.SystemSessionProperties;
import com.facebook.presto.common.transaction.TransactionId;
-import com.facebook.presto.metadata.SessionPropertyManager;
import com.facebook.presto.spi.ConnectorSession;
import com.facebook.presto.spi.QueryId;
import com.facebook.presto.spi.connector.ConnectorTransactionHandle;
import com.facebook.presto.spi.security.ConnectorIdentity;
import com.facebook.presto.spi.security.Identity;
+import static com.facebook.presto.metadata.SessionPropertyManager.createTestingSessionPropertyManager;
+
public final class SystemConnectorSessionUtil
{
private static final SystemSessionProperties SYSTEM_SESSION_PROPERTIES = new SystemSessionProperties();
@@ -35,7 +36,7 @@ public static Session toSession(ConnectorTransactionHandle transactionHandle, Co
TransactionId transactionId = ((GlobalSystemTransactionHandle) transactionHandle).getTransactionId();
ConnectorIdentity connectorIdentity = session.getIdentity();
Identity identity = new Identity(connectorIdentity.getUser(), connectorIdentity.getPrincipal(), connectorIdentity.getExtraCredentials());
- return Session.builder(new SessionPropertyManager(SYSTEM_SESSION_PROPERTIES))
+ return Session.builder(createTestingSessionPropertyManager(SYSTEM_SESSION_PROPERTIES))
.setQueryId(new QueryId(session.getQueryId()))
.setTransactionId(transactionId)
.setCatalog("catalog")
diff --git a/presto-main/src/main/java/com/facebook/presto/dispatcher/DispatchManager.java b/presto-main/src/main/java/com/facebook/presto/dispatcher/DispatchManager.java
index 2639529ba1abd..1b57af2b25880 100644
--- a/presto-main/src/main/java/com/facebook/presto/dispatcher/DispatchManager.java
+++ b/presto-main/src/main/java/com/facebook/presto/dispatcher/DispatchManager.java
@@ -24,7 +24,6 @@
import com.facebook.presto.execution.QueryTracker;
import com.facebook.presto.execution.resourceGroups.ResourceGroupManager;
import com.facebook.presto.execution.warnings.WarningCollectorFactory;
-import com.facebook.presto.metadata.SessionPropertyManager;
import com.facebook.presto.resourcemanager.ClusterQueryTrackerService;
import com.facebook.presto.resourcemanager.ClusterStatusSender;
import com.facebook.presto.server.BasicQueryInfo;
@@ -56,6 +55,7 @@
import static com.facebook.presto.Session.SessionBuilder;
import static com.facebook.presto.SystemSessionProperties.getAnalyzerType;
+import static com.facebook.presto.metadata.SessionPropertyManager.createTestingSessionPropertyManager;
import static com.facebook.presto.spi.StandardErrorCode.QUERY_TEXT_TOO_LARGE;
import static com.facebook.presto.util.AnalyzerUtil.createAnalyzerOptions;
import static com.google.common.base.Preconditions.checkArgument;
@@ -330,7 +330,7 @@ private void createQueryInternal(QueryId queryId, String slug, int retryCoun
catch (Throwable throwable) {
// creation must never fail, so register a failed query in this case
if (session == null) {
- session = Session.builder(new SessionPropertyManager())
+ session = Session.builder(createTestingSessionPropertyManager())
.setQueryId(queryId)
.setIdentity(sessionContext.getIdentity())
.setSource(sessionContext.getSource())
diff --git a/presto-main/src/main/java/com/facebook/presto/execution/ClusterSizeMonitor.java b/presto-main/src/main/java/com/facebook/presto/execution/ClusterSizeMonitor.java
index 396d6d575f2d3..6833912e31c18 100644
--- a/presto-main/src/main/java/com/facebook/presto/execution/ClusterSizeMonitor.java
+++ b/presto-main/src/main/java/com/facebook/presto/execution/ClusterSizeMonitor.java
@@ -40,7 +40,6 @@
import static com.facebook.airlift.concurrent.Threads.threadsNamed;
import static com.facebook.presto.spi.StandardErrorCode.GENERIC_INSUFFICIENT_RESOURCES;
import static com.facebook.presto.spi.StandardErrorCode.NO_CPP_SIDECARS;
-import static com.facebook.presto.spi.StandardErrorCode.TOO_MANY_SIDECARS;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static java.lang.String.format;
@@ -183,11 +182,7 @@ public boolean hasRequiredCoordinators()
*/
public boolean hasRequiredCoordinatorSidecars()
{
- if (currentCoordinatorSidecarCount > 1) {
- throw new PrestoException(TOO_MANY_SIDECARS,
- format("Expected a single active coordinator sidecar. Found %s active coordinator sidecars", currentCoordinatorSidecarCount));
- }
- return currentCoordinatorSidecarCount == 1;
+ return currentCoordinatorSidecarCount > 0;
}
/**
@@ -257,7 +252,7 @@ public synchronized ListenableFuture> waitForMinimumCoordinators()
public synchronized ListenableFuture> waitForMinimumCoordinatorSidecars()
{
- if (currentCoordinatorSidecarCount == 1 || !isCoordinatorSidecarEnabled) {
+ if (currentCoordinatorSidecarCount > 0 || !isCoordinatorSidecarEnabled) {
return immediateFuture(null);
}
@@ -309,7 +304,6 @@ private synchronized void updateAllNodes(AllNodes allNodes)
Set activeNodes = new HashSet<>(allNodes.getActiveNodes());
activeNodes.removeAll(allNodes.getActiveCoordinators());
activeNodes.removeAll(allNodes.getActiveResourceManagers());
- activeNodes.removeAll(allNodes.getActiveCoordinatorSidecars());
currentWorkerCount = activeNodes.size();
}
currentCoordinatorCount = allNodes.getActiveCoordinators().size();
diff --git a/presto-main/src/main/java/com/facebook/presto/metadata/MetadataManager.java b/presto-main/src/main/java/com/facebook/presto/metadata/MetadataManager.java
index 24703303c9a2e..c9b86244de8ce 100644
--- a/presto-main/src/main/java/com/facebook/presto/metadata/MetadataManager.java
+++ b/presto-main/src/main/java/com/facebook/presto/metadata/MetadataManager.java
@@ -119,6 +119,7 @@
import static com.facebook.presto.metadata.MetadataUtil.getOptionalCatalogMetadata;
import static com.facebook.presto.metadata.MetadataUtil.getOptionalTableHandle;
import static com.facebook.presto.metadata.MetadataUtil.toSchemaTableName;
+import static com.facebook.presto.metadata.SessionPropertyManager.createTestingSessionPropertyManager;
import static com.facebook.presto.metadata.TableLayout.fromConnectorLayout;
import static com.facebook.presto.spi.Constraint.alwaysTrue;
import static com.facebook.presto.spi.StandardErrorCode.INVALID_VIEW;
@@ -240,7 +241,7 @@ public static MetadataManager createTestMetadataManager(TransactionManager trans
return new MetadataManager(
new FunctionAndTypeManager(transactionManager, blockEncodingManager, featuresConfig, functionsConfig, new HandleResolver(), ImmutableSet.of()),
blockEncodingManager,
- new SessionPropertyManager(),
+ createTestingSessionPropertyManager(),
new SchemaPropertyManager(),
new TablePropertyManager(),
new ColumnPropertyManager(),
diff --git a/presto-main/src/main/java/com/facebook/presto/metadata/SessionPropertyManager.java b/presto-main/src/main/java/com/facebook/presto/metadata/SessionPropertyManager.java
index 4e6fed01d5471..3e9e23e1a6e9a 100644
--- a/presto-main/src/main/java/com/facebook/presto/metadata/SessionPropertyManager.java
+++ b/presto-main/src/main/java/com/facebook/presto/metadata/SessionPropertyManager.java
@@ -24,17 +24,29 @@
import com.facebook.presto.common.type.DoubleType;
import com.facebook.presto.common.type.IntegerType;
import com.facebook.presto.common.type.MapType;
+import com.facebook.presto.common.type.TinyintType;
import com.facebook.presto.common.type.Type;
+import com.facebook.presto.common.type.TypeManager;
import com.facebook.presto.common.type.VarcharType;
+import com.facebook.presto.sessionpropertyproviders.JavaWorkerSessionPropertyProvider;
import com.facebook.presto.spi.ConnectorId;
+import com.facebook.presto.spi.NodeManager;
import com.facebook.presto.spi.PrestoException;
import com.facebook.presto.spi.session.PropertyMetadata;
+import com.facebook.presto.spi.session.SessionPropertyContext;
+import com.facebook.presto.spi.session.WorkerSessionPropertyProvider;
+import com.facebook.presto.spi.session.WorkerSessionPropertyProviderFactory;
+import com.facebook.presto.spiller.NodeSpillConfig;
+import com.facebook.presto.sql.analyzer.FeaturesConfig;
+import com.facebook.presto.sql.analyzer.JavaFeaturesConfig;
import com.facebook.presto.sql.planner.ParameterRewriter;
import com.facebook.presto.sql.tree.Expression;
import com.facebook.presto.sql.tree.ExpressionTreeRewriter;
import com.facebook.presto.sql.tree.NodeRef;
import com.facebook.presto.sql.tree.Parameter;
+import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import javax.annotation.Nullable;
@@ -47,35 +59,107 @@
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import java.util.function.Supplier;
import static com.facebook.presto.common.type.TypeUtils.writeNativeValue;
import static com.facebook.presto.spi.StandardErrorCode.INVALID_SESSION_PROPERTY;
import static com.facebook.presto.sql.planner.ExpressionInterpreter.evaluateConstantExpression;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
+import static java.util.concurrent.TimeUnit.HOURS;
public final class SessionPropertyManager
{
private static final JsonCodecFactory JSON_CODEC_FACTORY = new JsonCodecFactory();
private final ConcurrentMap> systemSessionProperties = new ConcurrentHashMap<>();
private final ConcurrentMap>> connectorSessionProperties = new ConcurrentHashMap<>();
+ private final Map workerSessionPropertyProviders;
+ private final Map workerSessionPropertyProviderFactories = new ConcurrentHashMap<>();
+ private final Supplier