@VisibleForTesting public TypeRegistry() { this(ImmutableSet.of(), new FeaturesConfig()); }
.setCpuCostWeight(75) .setMemoryCostWeight(10) .setNetworkCostWeight(15) .setDistributedIndexJoinsEnabled(false) .setJoinDistributionType(PARTITIONED) .setJoinMaxBroadcastTableSize(null) .setGroupedExecutionForAggregationEnabled(false) .setDynamicScheduleForGroupedExecutionEnabled(false) .setConcurrentLifespansPerTask(0) .setFastInequalityJoins(true) .setColocatedJoinsEnabled(false) .setSpatialJoinsEnabled(true) .setJoinReorderingStrategy(ELIMINATE_CROSS_JOINS) .setMaxReorderedJoins(9) .setRedistributeWrites(true) .setScaleWriters(false) .setWriterMinSize(new DataSize(32, MEGABYTE)) .setOptimizeMetadataQueries(false) .setOptimizeHashGeneration(true) .setPushTableWriteThroughUnion(true) .setDictionaryAggregation(false) .setGroupByUsesEqualTo(false) .setLegacyMapSubscript(false) .setRegexLibrary(JONI) .setRe2JDfaStatesLimit(Integer.MAX_VALUE) .setRe2JDfaRetries(5) .setSpillEnabled(false) .setAggregationOperatorUnspillMemoryLimit(DataSize.valueOf("4MB")) .setSpillerSpillPaths("")
private static PagesHashStrategy pagesHashStrategy() { return new SimplePagesHashStrategy( ImmutableList.of(BIGINT), ImmutableList.of(), ImmutableList.of(ImmutableList.of(TEST_PAGE.getBlock(0))), ImmutableList.of(), OptionalInt.empty(), Optional.of(0), MetadataManager.createTestMetadataManager().getFunctionRegistry(), new FeaturesConfig().isGroupByUsesEqualTo()); }
@Inject public DefaultFactory(OrderingCompiler orderingCompiler, JoinCompiler joinCompiler, FeaturesConfig featuresConfig, Metadata metadata) { this.orderingCompiler = requireNonNull(orderingCompiler, "orderingCompiler is null"); this.joinCompiler = requireNonNull(joinCompiler, "joinCompiler is null"); this.eagerCompact = requireNonNull(featuresConfig, "featuresConfig is null").isPagesIndexEagerCompactionEnabled(); this.functionRegistry = requireNonNull(metadata, "metadata is null").getFunctionRegistry(); this.groupByUsesEqualTo = featuresConfig.isGroupByUsesEqualTo(); }
private TestLegacyMapSubscript() { super(new FeaturesConfig().setLegacyMapSubscript(true)); }
public TestingConnectorSession( String user, Optional<String> source, Optional<String> traceToken, TimeZoneKey timeZoneKey, Locale locale, long startTime, List<PropertyMetadata<?>> propertyMetadatas, Map<String, Object> propertyValues, boolean isLegacyTimestamp) { this.queryId = queryIdGenerator.createNextQueryId().toString(); this.identity = new ConnectorIdentity(requireNonNull(user, "user is null"), Optional.empty(), Optional.empty()); this.source = requireNonNull(source, "source is null"); this.traceToken = requireNonNull(traceToken, "traceToken is null"); this.timeZoneKey = requireNonNull(timeZoneKey, "timeZoneKey is null"); this.locale = requireNonNull(locale, "locale is null"); this.startTime = startTime; this.properties = Maps.uniqueIndex(propertyMetadatas, PropertyMetadata::getName); this.propertyValues = ImmutableMap.copyOf(propertyValues); this.isLegacyTimestamp = isLegacyTimestamp; }
public List<PlanOptimizer> getPlanOptimizers(boolean forceSingleNode) { FeaturesConfig featuresConfig = new FeaturesConfig() .setDistributedIndexJoinsEnabled(false) .setOptimizeHashGeneration(true); return new PlanOptimizers( metadata, sqlParser, featuresConfig, forceSingleNode, new MBeanExporter(new TestingMBeanServer()), splitManager, pageSourceManager, statsCalculator, costCalculator, estimatedExchangesCostCalculator, new CostComparator(featuresConfig), taskCountEstimator).get(); }
public MetadataManager getMetadata(HistogramGroupImplementation groupMode) { MetadataManager metadata = MetadataManager.createTestMetadataManager(new FeaturesConfig() .setHistogramGroupImplementation(groupMode)); return metadata; } }
private static JoinCompiler getJoinCompiler(boolean groupByUsesEqual) { return new JoinCompiler(MetadataManager.createTestMetadataManager(), new FeaturesConfig().setGroupByUsesEqualTo(groupByUsesEqual)); }
@BeforeClass public void setUp() throws Exception { tempDirectory = createTempDirectory(getClass().getSimpleName()); FeaturesConfig featuresConfig = new FeaturesConfig(); featuresConfig.setSpillerSpillPaths(tempDirectory.toString()); featuresConfig.setSpillerThreads(8); featuresConfig.setSpillMaxUsedSpaceThreshold(1.0); singleStreamSpillerFactory = new FileSingleStreamSpillerFactory(blockEncodingSerde, new SpillerStats(), featuresConfig); factory = new GenericPartitioningSpillerFactory(singleStreamSpillerFactory); scheduledExecutor = newSingleThreadScheduledExecutor(); }
private LocalQueryRunner createLocalQueryRunner(NodeSpillConfig nodeSpillConfig) { LocalQueryRunner queryRunner = new LocalQueryRunner( SESSION, new FeaturesConfig() .setSpillerSpillPaths(spillPath.getAbsolutePath()) .setSpillEnabled(true), nodeSpillConfig, false, true); queryRunner.createCatalog( SESSION.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of()); return queryRunner; } }
@BeforeMethod public void setUp() { blockEncodingSerde = new BlockEncodingManager(new TypeRegistry()); spillerStats = new SpillerStats(); FeaturesConfig featuresConfig = new FeaturesConfig(); featuresConfig.setSpillerSpillPaths(spillPath.getAbsolutePath()); featuresConfig.setSpillMaxUsedSpaceThreshold(1.0); singleStreamSpillerFactory = new FileSingleStreamSpillerFactory(blockEncodingSerde, spillerStats, featuresConfig); factory = new GenericSpillerFactory(singleStreamSpillerFactory); PagesSerdeFactory pagesSerdeFactory = new PagesSerdeFactory(requireNonNull(blockEncodingSerde, "blockEncodingSerde is null"), false); pagesSerde = pagesSerdeFactory.createPagesSerde(); memoryContext = newSimpleAggregatedMemoryContext(); }
@Test public void testTooManyGroupingElements() { Session session = testSessionBuilder(new SessionPropertyManager(new SystemSessionProperties( new QueryManagerConfig(), new TaskManagerConfig(), new MemoryManagerConfig(), new FeaturesConfig().setMaxGroupingSets(2048)))).build(); analyze(session, "SELECT a, b, c, d, e, f, g, h, i, j, k, SUM(l)" + "FROM (VALUES (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))\n" + "t (a, b, c, d, e, f, g, h, i, j, k, l)\n" + "GROUP BY CUBE (a, b, c, d, e, f), CUBE (g, h, i, j, k)"); assertFails(session, TOO_MANY_GROUPING_SETS, "line 3:10: GROUP BY has 4096 grouping sets but can contain at most 2048", "SELECT a, b, c, d, e, f, g, h, i, j, k, l, SUM(m)" + "FROM (VALUES (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13))\n" + "t (a, b, c, d, e, f, g, h, i, j, k, l, m)\n" + "GROUP BY CUBE (a, b, c, d, e, f), CUBE (g, h, i, j, k, l)"); assertFails(session, TOO_MANY_GROUPING_SETS, format("line 3:10: GROUP BY has more than %s grouping sets but can contain at most 2048", Integer.MAX_VALUE), "SELECT a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, " + "q, r, s, t, u, v, x, w, y, z, aa, ab, ac, ad, ae, SUM(af)" + "FROM (VALUES (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, " + "17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32))\n" + "t (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, " + "q, r, s, t, u, v, x, w, y, z, aa, ab, ac, ad, ae, af)\n" + "GROUP BY CUBE (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, " + "q, r, s, t, u, v, x, w, y, z, aa, ab, ac, ad, ae)"); }
private QueryExplainer getQueryExplainer() { Metadata metadata = queryRunner.getMetadata(); FeaturesConfig featuresConfig = new FeaturesConfig().setOptimizeHashGeneration(true); boolean forceSingleNode = queryRunner.getNodeCount() == 1; TaskCountEstimator taskCountEstimator = new TaskCountEstimator(queryRunner::getNodeCount); CostCalculator costCalculator = new CostCalculatorUsingExchanges(taskCountEstimator); List<PlanOptimizer> optimizers = new PlanOptimizers( metadata, sqlParser, featuresConfig, forceSingleNode, new MBeanExporter(new TestingMBeanServer()), queryRunner.getSplitManager(), queryRunner.getPageSourceManager(), queryRunner.getStatsCalculator(), costCalculator, new CostCalculatorWithEstimatedExchanges(costCalculator, taskCountEstimator), new CostComparator(featuresConfig), taskCountEstimator).get(); return new QueryExplainer( optimizers, new PlanFragmenter(metadata, queryRunner.getNodePartitioningManager(), new QueryManagerConfig()), metadata, queryRunner.getAccessControl(), sqlParser, queryRunner.getStatsCalculator(), costCalculator, ImmutableMap.of()); }
@Inject public JoinCompiler(Metadata metadata, FeaturesConfig config) { this.registry = requireNonNull(metadata, "metadata is null").getFunctionRegistry(); this.groupByUsesEqualTo = requireNonNull(config, "config is null").isGroupByUsesEqualTo(); }
public MetadataManager getMetadata(HistogramGroupImplementation groupMode) { MetadataManager metadata = MetadataManager.createTestMetadataManager(new FeaturesConfig() .setHistogramGroupImplementation(groupMode)); return metadata; } }
private static JoinCompiler getJoinCompiler(boolean groupByUsesEqual) { return new JoinCompiler(MetadataManager.createTestMetadataManager(), new FeaturesConfig().setGroupByUsesEqualTo(groupByUsesEqual)); }
@BeforeClass public void setUp() throws Exception { tempDirectory = createTempDirectory(getClass().getSimpleName()); FeaturesConfig featuresConfig = new FeaturesConfig(); featuresConfig.setSpillerSpillPaths(tempDirectory.toString()); featuresConfig.setSpillerThreads(8); featuresConfig.setSpillMaxUsedSpaceThreshold(1.0); singleStreamSpillerFactory = new FileSingleStreamSpillerFactory(blockEncodingSerde, new SpillerStats(), featuresConfig); factory = new GenericPartitioningSpillerFactory(singleStreamSpillerFactory); scheduledExecutor = newSingleThreadScheduledExecutor(); }
@BeforeMethod public void setUp() { blockEncodingSerde = new BlockEncodingManager(new TypeRegistry()); spillerStats = new SpillerStats(); FeaturesConfig featuresConfig = new FeaturesConfig(); featuresConfig.setSpillerSpillPaths(spillPath.getAbsolutePath()); featuresConfig.setSpillMaxUsedSpaceThreshold(1.0); singleStreamSpillerFactory = new FileSingleStreamSpillerFactory(blockEncodingSerde, spillerStats, featuresConfig); factory = new GenericSpillerFactory(singleStreamSpillerFactory); PagesSerdeFactory pagesSerdeFactory = new PagesSerdeFactory(requireNonNull(blockEncodingSerde, "blockEncodingSerde is null"), false); pagesSerde = pagesSerdeFactory.createPagesSerde(); memoryContext = newSimpleAggregatedMemoryContext(); }
private TestLegacyMapSubscript() { super(new FeaturesConfig().setLegacyMapSubscript(true)); }