Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ public void remove(
public void externalSegmentCreated(
SegmentHeader header,
Context<?> context ) {
if ( context.getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class) ) {
if ( !context.isCashEnabled(header.cubeName) ) {
// Ignore cache requests.
return;
}
Expand All @@ -544,7 +544,7 @@ public void externalSegmentCreated(
public void externalSegmentDeleted(
SegmentHeader header,
Context<?> context ) {
if ( context.getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class) ) {
if ( !context.isCashEnabled( header.cubeName ) ) {
// Ignore cache requests.
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,20 @@ public SegmentLoader( SegmentCacheManager cacheMgr ) {
*/
public void load( int cellRequestCount, List<GroupingSet> groupingSets, List<StarPredicate> compoundPredicateList,
List<Future<Map<Segment, SegmentWithData>>> segmentFutures ) {
if ( !cacheMgr.getContext().getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class) ) {
//if ( !cacheMgr.getContext().getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class) ) {
for ( GroupingSet groupingSet : groupingSets ) {
for ( Segment segment : groupingSet.getSegments() ) {
final SegmentCacheIndex index = ((SegmentCacheIndexRegistry)cacheMgr.getIndexRegistry()).getIndex( segment.star );
index.add( segment.getHeader(), new SegmentBuilder.StarSegmentConverter( segment.measure,
compoundPredicateList ), true );
// Make sure that we are registered as a client of
// the segment by invoking getFuture.
index.getFuture( ExecutionContext.current().getExecution(), segment.getHeader() ) ;
if ( cacheMgr.getContext().isCashEnabled(segment.star.getCube().getName()) ) {
final SegmentCacheIndex index = ((SegmentCacheIndexRegistry)cacheMgr.getIndexRegistry()).getIndex( segment.star );
index.add( segment.getHeader(), new SegmentBuilder.StarSegmentConverter( segment.measure,
compoundPredicateList ), true );
// Make sure that we are registered as a client of
// the segment by invoking getFuture.
index.getFuture( ExecutionContext.current().getExecution(), segment.getHeader() ) ;
}
}
}
}
//}
try {
segmentFutures.add( cacheMgr.sqlExecutor.submit( new SegmentLoadCommand( ExecutionContext.current(), this, cellRequestCount,
groupingSets, compoundPredicateList ) ) );
Expand Down Expand Up @@ -263,7 +265,7 @@ private void cacheSegment( RolapStar star, SegmentHeader header, SegmentBody bod
// Also note that we push the segments to external cache after we have
// called cacheMgr.loadSucceeded. That call will allow the current
// query to proceed.
if ( !cacheMgr.getContext().getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class) ) {
if ( cacheMgr.getContext().isCashEnabled(header.cubeName) ) {
cacheMgr.compositeCache.put( header, body );
cacheMgr.loadSucceeded( star, header, body );
}
Expand Down Expand Up @@ -546,7 +548,7 @@ public void accept(final Statement stmt) {
return RolapUtil.executeQuery( star.getContext(), pair.left, pair.right, 0, 0, executionContext, -1, -1,
// Only one of the two callbacks are required, depending if we
// cache the segments or not.
cacheMgr.getContext().getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class) ? callbackNoCaching : callbackWithCaching );
!star.getContext().isCashEnabled(star.getCube().getName()) ? callbackNoCaching : callbackWithCaching );
} catch ( Throwable t ) {
if ( Util.getMatchingCause( t, AbortException.class ) != null ) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.eclipse.daanse.olap.api.calc.ResultStyle;
import org.eclipse.daanse.olap.api.calc.tuple.TupleList;
import org.eclipse.daanse.olap.api.catalog.CatalogReader;
import org.eclipse.daanse.olap.api.element.Cube;
import org.eclipse.daanse.olap.api.element.Hierarchy;
import org.eclipse.daanse.olap.api.element.Level;
import org.eclipse.daanse.olap.api.element.Member;
Expand Down Expand Up @@ -229,15 +230,15 @@ public void setCompleteWithNullValues( boolean completeWithNullValues ) {
public Object execute( ResultStyle desiredResultStyle ) {
return switch (desiredResultStyle) {
case ITERABLE -> executeList(
new SqlTupleReader( constraint ) );
case MUTABLE_LIST, LIST -> executeList( new SqlTupleReader( constraint ) );
new SqlTupleReader( constraint), constraint.getEvaluator().getCube() );
case MUTABLE_LIST, LIST -> executeList( new SqlTupleReader( constraint ), constraint.getEvaluator().getCube() );
default -> throw ResultStyleException.generate(
ResultStyle.ITERABLE_MUTABLELIST_LIST,
Collections.singletonList( desiredResultStyle ) );
};
}

protected TupleList executeList( final SqlTupleReader tr ) {
protected TupleList executeList( final SqlTupleReader tr, Cube cube ) {
tr.setMaxRows( maxRows );
for ( CrossJoinArg arg : args ) {
addLevel( tr, arg );
Expand Down Expand Up @@ -328,7 +329,7 @@ protected TupleList executeList( final SqlTupleReader tr ) {
context, null, new ArrayList<>() ) );
}

if ( !schemaReader.getContext().getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class) ) {
if ( schemaReader.getContext().isCashEnabled(cube.getName()) ) {
if ( hasEnumTargets ) {
if ( newPartialResult != null ) {
cache.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private boolean loadFromCaches(
final AggregationKey key,
final SegmentBuilder.SegmentConverterImpl converter)
{
if (cacheMgr.getContext().getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class)) {
if (!cacheMgr.getContext().isCashEnabled(request.getMeasure().getCubeName())) {
// Caching is disabled. Return always false.
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public FastBatchingCellReader(
this.aggMgr = (AggregationManager)aggMgr;
cacheMgr = (SegmentCacheManager)aggMgr.getCacheMgr(execution.getDaanseStatement().getDaanseConnection());
pinnedSegments = this.aggMgr.createPinSet();
cacheEnabled = !cube.getCatalog().getInternalConnection().getContext().getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class);
cacheEnabled = cube.getCatalog().getInternalConnection().getContext().isCashEnabled(cube.getName());
Integer cellBatchSize = cube.getCatalog().getInternalConnection().getContext()
.getConfigValue(ConfigConstants.CELL_BATCH_SIZE, ConfigConstants.CELL_BATCH_SIZE_DEFAULT_VALUE ,Integer.class);
cellRequestLimit =
Expand Down Expand Up @@ -376,7 +376,7 @@ public boolean loadAggregations() {
// Then we insert the segment body into the SlotFuture.
// This has to be done on the SegmentCacheManager's
// Actor thread to ensure thread safety.
if (!cacheMgr.getContext().getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class)) {
if (cacheMgr.getContext().isCashEnabled(header.cubeName)) {
final ExecutionContext executionContext = ExecutionContext.current();
cacheMgr.execute(
new CacheCommand<Void>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import org.eclipse.daanse.olap.api.Context;
import org.eclipse.daanse.olap.api.aggregator.Aggregator;
import org.eclipse.daanse.olap.api.cache.OlapSegmentCacheManager;
import org.eclipse.daanse.olap.api.element.Cube;
import org.eclipse.daanse.olap.api.element.Member;
import org.eclipse.daanse.olap.api.exception.OlapRuntimeException;
import org.eclipse.daanse.olap.api.execution.ExecutionContext;
Expand Down Expand Up @@ -122,6 +123,7 @@ public class RolapStar {

private final Table factTable;

private final Cube cube;
/**
* Number of columns (column and columnName).
*/
Expand Down Expand Up @@ -165,10 +167,12 @@ public class RolapStar {
protected RolapStar(
final RolapCatalog catalog,
final Context context,
final Cube cube,
final org.eclipse.daanse.rolap.mapping.model.RelationalQuery fact)
{
this.cacheAggregations = true;
this.catalog = catalog;
this.cube = cube;
this.context = context;
this.factTable = new RolapStar.Table(this, fact, null, null);

Expand Down Expand Up @@ -631,7 +635,7 @@ public boolean isCacheAggregations() {
}

boolean isCacheDisabled() {
return context.getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class);
return !context.isCashEnabled(cube.getName());
}

/**
Expand Down Expand Up @@ -2218,4 +2222,8 @@ public int compare(Column o1, Column o2) {
return result;
}
}

public Cube getCube() {
return cube;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.eclipse.daanse.olap.api.Context;
import org.eclipse.daanse.olap.api.cache.OlapSegmentCacheManager;
import org.eclipse.daanse.olap.api.connection.Connection;
import org.eclipse.daanse.olap.api.element.Cube;
import org.eclipse.daanse.olap.core.AbstractBasicContext;
import org.eclipse.daanse.rolap.common.RolapUtil;
import org.eclipse.daanse.rolap.common.agg.SegmentCacheManager;
Expand All @@ -59,11 +60,11 @@ public RolapStarRegistry(RolapCatalog schema, Context context) {
*
* {@link RolapStar.Table#addJoin} works in a similar way.
*/
public synchronized RolapStar getOrCreateStar(final org.eclipse.daanse.rolap.mapping.model.RelationalQuery fact) {
public synchronized RolapStar getOrCreateStar(final org.eclipse.daanse.rolap.mapping.model.RelationalQuery fact, Cube cube) {
final List<String> rolapStarKey = RolapUtil.makeRolapStarKey(fact);
RolapStar star = stars.get(rolapStarKey);
if (star == null) {
star = makeRolapStar(fact);
star = makeRolapStar(fact, cube);
stars.put(rolapStarKey, star);
// let cache manager load pending segments
// from external cache if needed
Expand All @@ -79,8 +80,8 @@ public RolapStar getStar(final String factTableName) {
return getStar(makeRolapStarKey(factTableName));
}

public RolapStar makeRolapStar(final org.eclipse.daanse.rolap.mapping.model.RelationalQuery fact) {
return new RolapStar(schema, context, fact);
public RolapStar makeRolapStar(final org.eclipse.daanse.rolap.mapping.model.RelationalQuery fact, Cube cube) {
return new RolapStar(schema, context, cube, fact);
}

public synchronized RolapStar getStar(List<String> starKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -946,13 +946,13 @@ public Parameter[] getParameters() {
*
* Synchronization: thread safe
*/
synchronized MemberReader createMemberReader(final org.eclipse.daanse.rolap.mapping.model.Dimension xmlDimension, final RolapHierarchy hierarchy,
synchronized MemberReader createMemberReader(final org.eclipse.daanse.rolap.mapping.model.Dimension xmlDimension, final RolapHierarchy hierarchy, final Cube cube,
final String memberReaderClass) {
MemberReader reader;
if (xmlDimension != null) {
reader = mapSharedHierarchyToReader.get(xmlDimension);
if (reader == null) {
reader = createMemberReader(hierarchy, memberReaderClass);
reader = createMemberReader(hierarchy, memberReaderClass, cube);
// share, for other uses of the same shared hierarchy
if (false) {
mapSharedHierarchyToReader.put(xmlDimension, reader);
Expand All @@ -972,15 +972,15 @@ synchronized MemberReader createMemberReader(final org.eclipse.daanse.rolap.mapp
// sharedDimension.getGlobalOrdinal());
}
} else {
reader = createMemberReader(hierarchy, memberReaderClass);
reader = createMemberReader(hierarchy, memberReaderClass, cube);
}
return reader;
}

/**
* Creates a {@link MemberReader} with which to Read a hierarchy.
*/
private MemberReader createMemberReader(final RolapHierarchy hierarchy, final String memberReaderClass) {
private MemberReader createMemberReader(final RolapHierarchy hierarchy, final String memberReaderClass, Cube cube) {
if (memberReaderClass != null) {
Exception e2;
try {
Expand All @@ -1004,7 +1004,7 @@ private MemberReader createMemberReader(final RolapHierarchy hierarchy, final St
SqlMemberSource source = new SqlMemberSource(hierarchy);

LOGGER.debug("Normal cardinality for {}", hierarchy.getDimension());
if (internalConnection.getContext().getConfigValue(ConfigConstants.DISABLE_CACHING, ConfigConstants.DISABLE_CACHING_DEFAULT_VALUE, Boolean.class)) {
if (!internalConnection.getContext().isCashEnabled(cube.getName())) {
// If the cell cache is disabled, we can't cache
// the members or else we get undefined results,
// depending on the functions used and all.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ private RolapCube(
this.context = context;

if (getFact() != null && this instanceof RolapPhysicalCube) {
this.star = catalog.getRolapStarRegistry().getOrCreateStar(getFact());
this.star = catalog.getRolapStarRegistry().getOrCreateStar(getFact(), this);
// only set if different from default (so that if two cubes share
// the same fact table, either can turn off caching and both are
// effected).
Expand Down Expand Up @@ -1017,10 +1017,10 @@ private org.eclipse.daanse.rolap.mapping.model.DimensionConnector lookup(
return null;
}

protected void init(List<? extends org.eclipse.daanse.rolap.mapping.model.DimensionConnector> mappingDimensions) {
protected void init(List<? extends org.eclipse.daanse.rolap.mapping.model.DimensionConnector> mappingDimensions, Cube cube) {
for (Dimension dimension1 : dimensions) {
final RolapDimension dimension = (RolapDimension) dimension1;
dimension.init(lookup(mappingDimensions, dimension.getName()));
dimension.init(lookup(mappingDimensions, dimension.getName()), cube);
}
register();
}
Expand Down Expand Up @@ -1105,7 +1105,7 @@ public RolapStar getStar() {
if (star != null && star.getFactTable().getRelation().equals(getFact())) {
return star;
}
star = catalog.getRolapStarRegistry().makeRolapStar(getFact());
star = catalog.getRolapStarRegistry().makeRolapStar(getFact(), this);
}
return star;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.util.Optional;

import org.eclipse.daanse.olap.api.access.AccessMember;
import org.eclipse.daanse.olap.api.element.Cube;
import org.eclipse.daanse.olap.api.element.Level;
import org.eclipse.daanse.olap.api.element.Member;
import org.eclipse.daanse.olap.api.query.component.Formula;
Expand Down Expand Up @@ -513,11 +514,11 @@ public void setDefaultMember(Member defaultMeasure) {
}

@Override
void init(org.eclipse.daanse.rolap.mapping.model.DimensionConnector xmlDimension) {
void init(org.eclipse.daanse.rolap.mapping.model.DimensionConnector xmlDimension, Cube cube) {
// first init shared hierarchy
rolapHierarchy.init(xmlDimension);
rolapHierarchy.init(xmlDimension, cube);
// second init cube hierarchy
super.init(xmlDimension);
super.init(xmlDimension, cube);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void init(org.eclipse.daanse.rolap.mapping.model.DimensionConnector xmlDimension
(RolapCubeHierarchy) cubeDimensionInner.getHierarchies().getFirst(),
xmlDimension);
}
cubeDimensionInner.init(xmlDimension);
cubeDimensionInner.init(xmlDimension, cube);
getCube().registerDimension(cubeDimensionInner);
closedPeerCubeLevel = (RolapCubeLevel)
cubeDimensionInner.getHierarchies().getFirst().getLevels().get(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@ protected Logger getLogger() {
/**
* Initializes a dimension within the context of a cube.
*/
void init(org.eclipse.daanse.rolap.mapping.model.DimensionConnector mappingDimension) {
void init(org.eclipse.daanse.rolap.mapping.model.DimensionConnector mappingDimension, Cube cube) {
for (Hierarchy h : hierarchies) {
if (h != null) {
((RolapHierarchy) h).init(mappingDimension);
((RolapHierarchy) h).init(mappingDimension, cube);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.eclipse.daanse.olap.api.calc.tuple.TupleList;
import org.eclipse.daanse.olap.api.calc.tuple.TupleListCalc;
import org.eclipse.daanse.olap.api.catalog.CatalogReader;
import org.eclipse.daanse.olap.api.element.Cube;
import org.eclipse.daanse.olap.api.element.Dimension;
import org.eclipse.daanse.olap.api.element.DimensionType;
import org.eclipse.daanse.olap.api.element.Hierarchy;
Expand Down Expand Up @@ -429,7 +430,7 @@ public RolapHierarchy(
RolapLevel l = new RolapLevel(sb.toString(), LevelUtil.getParentExp(pch), pch.getNullParentValue(), pch.getParentChildLink(), this, i,
pch.isParentAsLeafEnable(), pch.getParentAsLeafNameFormat(), xmlLevel);
levels.add(l);
Map<Integer, Set<RolapMember>> childMap = getChildMap((RolapLevel)l);
Map<Integer, Set<RolapMember>> childMap = getChildMap((RolapLevel)l, cube);
for (Map.Entry<Integer, Set<RolapMember>> e : childMap.entrySet()) {
if (e.getKey() != 0) {
i++;
Expand All @@ -448,7 +449,7 @@ public RolapHierarchy(
RolapLevel l = new RolapLevel(sb.toString(), LevelUtil.getParentExp(pch), pch.getNullParentValue(), pch.getParentChildLink(), this, i,
pch.isParentAsLeafEnable(), pch.getParentAsLeafNameFormat(), xmlLevel);
levels.add(l);
Map<Integer, Set<RolapMember>> childMap = getChildMap((RolapLevel)l);
Map<Integer, Set<RolapMember>> childMap = getChildMap((RolapLevel)l, cube);
for (Map.Entry<Integer, Set<RolapMember>> e : childMap.entrySet()) {
if (e.getKey() != 0) {
i++;
Expand Down Expand Up @@ -491,10 +492,10 @@ public RolapHierarchy(
defaultMemberName = xmlHierarchy.getDefaultMember();
}

private Map<Integer, Set<RolapMember>> getChildMap(RolapLevel l) {
private Map<Integer, Set<RolapMember>> getChildMap(RolapLevel l, Cube cube) {
if (this.memberReader == null) {
this.memberReader = getRolapCatalog().createMemberReader(
null, this, memberReaderClass);
null, this, cube, memberReaderClass);
}
List<RolapMember> members = this.memberReader.getMembers();
Map<Integer, Set<RolapMember>> childMap = new HashMap<>();
Expand Down Expand Up @@ -561,11 +562,11 @@ protected int computeHashCode() {
/**
* Initializes a hierarchy within the context of a cube.
*/
void init(org.eclipse.daanse.rolap.mapping.model.DimensionConnector xmlDimension) {
void init(org.eclipse.daanse.rolap.mapping.model.DimensionConnector xmlDimension, Cube cube) {
// first create memberReader
if (this.memberReader == null) {
this.memberReader = getRolapCatalog().createMemberReader(
xmlDimension != null ? xmlDimension.getDimension() : null, this, memberReaderClass);
xmlDimension != null ? xmlDimension.getDimension() : null, this, cube, memberReaderClass);
}
for (Level level : levels) {
((RolapLevel) level).init(xmlDimension);
Expand Down
Loading
Loading