Search in sources :

Example 1 with Slf4jQueryLogger

use of com.yahoo.elide.datastores.aggregation.core.Slf4jQueryLogger in project elide by yahoo.

the class AggregationDataStoreTestHarness method getDataStore.

@Override
public DataStore getDataStore() {
    AggregationDataStore.AggregationDataStoreBuilder aggregationDataStoreBuilder = AggregationDataStore.builder();
    ClassScanner scanner = DefaultClassScanner.getInstance();
    MetaDataStore metaDataStore;
    if (validator != null) {
        metaDataStore = new MetaDataStore(scanner, validator.getElideTableConfig().getTables(), validator.getElideNamespaceConfig().getNamespaceconfigs(), true);
        aggregationDataStoreBuilder.dynamicCompiledClasses(metaDataStore.getDynamicTypes());
    } else {
        metaDataStore = new MetaDataStore(scanner, true);
    }
    AggregationDataStore aggregationDataStore = aggregationDataStoreBuilder.queryEngine(new SQLQueryEngine(metaDataStore, (name) -> connectionDetailsMap.getOrDefault(name, defaultConnectionDetails), new HashSet<>(Arrays.asList(new AggregateBeforeJoinOptimizer(metaDataStore))), new DefaultQueryPlanMerger(metaDataStore), new DefaultQueryValidator(metaDataStore.getMetadataDictionary()))).queryLogger(new Slf4jQueryLogger()).build();
    Consumer<EntityManager> txCancel = em -> em.unwrap(Session.class).cancelQuery();
    DataStore jpaStore = new JpaDataStore(() -> entityManagerFactory.createEntityManager(), em -> new NonJtaTransaction(em, txCancel));
    return new MultiplexManager(jpaStore, metaDataStore, aggregationDataStore);
}
Also used : SQLQueryEngine(com.yahoo.elide.datastores.aggregation.queryengines.sql.SQLQueryEngine) Arrays(java.util.Arrays) SQLQueryEngine(com.yahoo.elide.datastores.aggregation.queryengines.sql.SQLQueryEngine) Session(org.hibernate.Session) MultiplexManager(com.yahoo.elide.datastores.multiplex.MultiplexManager) NonJtaTransaction(com.yahoo.elide.datastores.jpa.transaction.NonJtaTransaction) HashSet(java.util.HashSet) ClassScanner(com.yahoo.elide.core.utils.ClassScanner) AggregateBeforeJoinOptimizer(com.yahoo.elide.datastores.aggregation.queryengines.sql.query.AggregateBeforeJoinOptimizer) Map(java.util.Map) DataSource(javax.sql.DataSource) AggregationDataStore(com.yahoo.elide.datastores.aggregation.AggregationDataStore) DefaultQueryPlanMerger(com.yahoo.elide.datastores.aggregation.query.DefaultQueryPlanMerger) JpaDataStore(com.yahoo.elide.datastores.jpa.JpaDataStore) Slf4jQueryLogger(com.yahoo.elide.datastores.aggregation.core.Slf4jQueryLogger) SQLDialectFactory(com.yahoo.elide.datastores.aggregation.queryengines.sql.dialects.SQLDialectFactory) DynamicConfigValidator(com.yahoo.elide.modelconfig.validator.DynamicConfigValidator) DefaultClassScanner(com.yahoo.elide.core.utils.DefaultClassScanner) DefaultQueryValidator(com.yahoo.elide.datastores.aggregation.DefaultQueryValidator) EntityManager(javax.persistence.EntityManager) DataStoreTestHarness(com.yahoo.elide.core.datastore.test.DataStoreTestHarness) ConnectionDetails(com.yahoo.elide.datastores.aggregation.queryengines.sql.ConnectionDetails) Consumer(java.util.function.Consumer) EntityManagerFactory(javax.persistence.EntityManagerFactory) DataStore(com.yahoo.elide.core.datastore.DataStore) MetaDataStore(com.yahoo.elide.datastores.aggregation.metadata.MetaDataStore) AllArgsConstructor(lombok.AllArgsConstructor) Collections(java.util.Collections) JpaDataStore(com.yahoo.elide.datastores.jpa.JpaDataStore) MetaDataStore(com.yahoo.elide.datastores.aggregation.metadata.MetaDataStore) DefaultQueryPlanMerger(com.yahoo.elide.datastores.aggregation.query.DefaultQueryPlanMerger) NonJtaTransaction(com.yahoo.elide.datastores.jpa.transaction.NonJtaTransaction) MultiplexManager(com.yahoo.elide.datastores.multiplex.MultiplexManager) DefaultQueryValidator(com.yahoo.elide.datastores.aggregation.DefaultQueryValidator) Slf4jQueryLogger(com.yahoo.elide.datastores.aggregation.core.Slf4jQueryLogger) EntityManager(javax.persistence.EntityManager) AggregateBeforeJoinOptimizer(com.yahoo.elide.datastores.aggregation.queryengines.sql.query.AggregateBeforeJoinOptimizer) ClassScanner(com.yahoo.elide.core.utils.ClassScanner) DefaultClassScanner(com.yahoo.elide.core.utils.DefaultClassScanner) AggregationDataStore(com.yahoo.elide.datastores.aggregation.AggregationDataStore) JpaDataStore(com.yahoo.elide.datastores.jpa.JpaDataStore) DataStore(com.yahoo.elide.core.datastore.DataStore) MetaDataStore(com.yahoo.elide.datastores.aggregation.metadata.MetaDataStore) AggregationDataStore(com.yahoo.elide.datastores.aggregation.AggregationDataStore) HashSet(java.util.HashSet) Session(org.hibernate.Session)

Example 2 with Slf4jQueryLogger

use of com.yahoo.elide.datastores.aggregation.core.Slf4jQueryLogger in project elide by yahoo.

the class ElideStandaloneSettings method getAggregationDataStore.

/**
 * Gets the AggregationDataStore for elide.
 * @param queryEngine query engine object.
 * @return AggregationDataStore object initialized.
 */
default AggregationDataStore getAggregationDataStore(QueryEngine queryEngine) {
    AggregationDataStore.AggregationDataStoreBuilder aggregationDataStoreBuilder = AggregationDataStore.builder().queryEngine(queryEngine).queryLogger(new Slf4jQueryLogger());
    if (getAnalyticProperties().enableDynamicModelConfig()) {
        aggregationDataStoreBuilder.dynamicCompiledClasses(queryEngine.getMetaDataStore().getDynamicTypes());
    }
    aggregationDataStoreBuilder.cache(getQueryCache());
    return aggregationDataStoreBuilder.build();
}
Also used : Slf4jQueryLogger(com.yahoo.elide.datastores.aggregation.core.Slf4jQueryLogger) AggregationDataStore(com.yahoo.elide.datastores.aggregation.AggregationDataStore)

Aggregations

AggregationDataStore (com.yahoo.elide.datastores.aggregation.AggregationDataStore)2 Slf4jQueryLogger (com.yahoo.elide.datastores.aggregation.core.Slf4jQueryLogger)2 DataStore (com.yahoo.elide.core.datastore.DataStore)1 DataStoreTestHarness (com.yahoo.elide.core.datastore.test.DataStoreTestHarness)1 ClassScanner (com.yahoo.elide.core.utils.ClassScanner)1 DefaultClassScanner (com.yahoo.elide.core.utils.DefaultClassScanner)1 DefaultQueryValidator (com.yahoo.elide.datastores.aggregation.DefaultQueryValidator)1 MetaDataStore (com.yahoo.elide.datastores.aggregation.metadata.MetaDataStore)1 DefaultQueryPlanMerger (com.yahoo.elide.datastores.aggregation.query.DefaultQueryPlanMerger)1 ConnectionDetails (com.yahoo.elide.datastores.aggregation.queryengines.sql.ConnectionDetails)1 SQLQueryEngine (com.yahoo.elide.datastores.aggregation.queryengines.sql.SQLQueryEngine)1 SQLDialectFactory (com.yahoo.elide.datastores.aggregation.queryengines.sql.dialects.SQLDialectFactory)1 AggregateBeforeJoinOptimizer (com.yahoo.elide.datastores.aggregation.queryengines.sql.query.AggregateBeforeJoinOptimizer)1 JpaDataStore (com.yahoo.elide.datastores.jpa.JpaDataStore)1 NonJtaTransaction (com.yahoo.elide.datastores.jpa.transaction.NonJtaTransaction)1 MultiplexManager (com.yahoo.elide.datastores.multiplex.MultiplexManager)1 DynamicConfigValidator (com.yahoo.elide.modelconfig.validator.DynamicConfigValidator)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1