return Optional.of(generatePreCalculatedTableSql(Optional.of(tableName), "materialized", timePredicate, timeColumn, dimensionRequired));
Optional<String> preComputedTable = getPreComputedTable(project, timePredicate, timeColumn, Optional.empty(), dimension, Optional.empty(), missingPreComputedTables, dimension.isPresent(), timezone); collections.entrySet().stream() .filter(entry -> entry.getValue().stream().anyMatch(e -> e.getName().equals(projectConfig.getUserColumn()))) .map(collection -> getTableSubQuery(collection.getValue().stream().anyMatch(e -> e.getName().equals("_device_id")), collection.getKey(), connectorField, Optional.of(isText), timeColumn, dimension, startDate, endDate, Optional.empty())) String collection = retentionAction.get().collection(); Optional<String> preComputedTable = getPreComputedTable(project, timePredicate, timeColumn, Optional.of(collection), dimension, retentionAction.get().filter(), missingPreComputedTables, dimension.isPresent(), timezone); approximate ? "approx_set" : "set", connectorField, connectorField, getTableSubQuery( metastore.getCollection(project, collection).stream().anyMatch(e -> e.getName().equals("_device_id")), collection, connectorField, Optional.empty(),
period.ifPresent(e -> checkArgument(e >= 0, "Period must be 0 or a positive value")); String timeColumn = getTimeExpression(dateUnit); String firstActionQuery = generateQuery(context.project, firstAction, projectConfig.getUserColumn(), timeColumn, dimension, startDate, endDate, missingPreComputedTables, timezone, approximate); String returningActionQuery = generateQuery(context.project, returningAction, projectConfig.getUserColumn(), timeColumn, dimension, startDate, endDate, missingPreComputedTables, timezone, approximate); String timeSubtraction = diffTimestamps(dateUnit, "data.date", "returning_action.date");
@BeforeSuite public void setup() throws Exception { testingEnvironment = new TestingEnvironment(); PrestoConfig prestoConfig = testingEnvironment.getPrestoConfig(); InMemoryQueryMetadataStore queryMetadataStore = new InMemoryQueryMetadataStore(); metastore = new PrestoRakamRaptorMetastore(testingEnvironment.getPrestoMetastore(), new EventBus(), new ProjectConfig(), prestoConfig); metastore.setup(); PrestoQueryExecutor queryExecutor = new PrestoQueryExecutor(new ProjectConfig(), prestoConfig, null, metastore); PrestoMaterializedViewService materializedViewService = new PrestoMaterializedViewService( new PrestoConfig(), queryExecutor, metastore, queryMetadataStore, Clock.systemUTC()); QueryExecutorService queryExecutorService = new QueryExecutorService(queryExecutor, metastore, materializedViewService, '"'); retentionQueryExecutor = new PrestoRetentionQueryExecutor(new ProjectConfig(), queryExecutorService, metastore, materializedViewService, new UserPluginConfig()); testingPrestoEventStore = new TestingPrestoEventStore(queryExecutor, prestoConfig); // TODO: Presto throws "No node available" error, find a way to avoid this ugly hack. Thread.sleep(1000); super.setup(); }