Codota Logo
StorageContext
Code IndexAdd Codota to your IDE (free)

How to use
StorageContext
in
org.apache.kylin.storage

Best Java code snippets using org.apache.kylin.storage.StorageContext (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ScheduledThreadPoolExecutor s =
  • Codota Iconnew ScheduledThreadPoolExecutor(corePoolSize)
  • Codota IconThreadFactory threadFactory;new ScheduledThreadPoolExecutor(corePoolSize, threadFactory)
  • Codota IconString str;new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(str).build())
  • Smart code suggestions by Codota
}
origin: apache/kylin

public OLAPContext(int seq) {
  this.id = seq;
  this.storageContext = new StorageContext(seq);
  this.sortColumns = Lists.newArrayList();
  this.sortOrders = Lists.newArrayList();
  Map<String, String> parameters = _localPrarameters.get();
  if (parameters != null) {
    String acceptPartialResult = parameters.get(PRM_ACCEPT_PARTIAL_RESULT);
    if (acceptPartialResult != null) {
      this.storageContext.setAcceptPartialResult(Boolean.parseBoolean(acceptPartialResult));
    }
    String acceptUserInfo = parameters.get(PRM_USER_AUTHEN_INFO);
    if (null != acceptUserInfo)
      this.olapAuthen.parseUserInfo(acceptUserInfo);
  }
}
origin: apache/kylin

Cuboid cuboid = ctx.storageContext.getCuboid();
if (cuboid != null) {
origin: apache/kylin

public void applyLimitPushDown(IRealization realization, StorageLimitLevel storageLimitLevel) {
  if (storageLimitLevel == StorageLimitLevel.NO_LIMIT) {
    return;
  }
  if (!realization.supportsLimitPushDown()) {
    logger.warn("Not enabling limit push down because cube storage type not supported");
    return;
  }
  long temp = this.getOffset() + this.getLimit();
  if (!isValidPushDownLimit(temp)) {
    logger.warn("Not enabling limit push down because current limit is invalid: " + this.getLimit());
    return;
  }
  this.finalPushDownLimit = (int) temp;
  this.storageLimitLevel = storageLimitLevel;
  logger.info("Enabling limit push down: {} at level: {}", temp, storageLimitLevel);
}
origin: apache/kylin

if (context.hasSort()) {
  storageLimitLevel = StorageLimitLevel.NO_LIMIT;
  logger.debug("storageLimitLevel set to NO_LIMIT because the query has order by");
context.applyLimitPushDown(cubeInstance, storageLimitLevel);
origin: apache/kylin

public GTCubeStorageQueryRequest getStorageQueryRequest(StorageContext context, SQLDigest sqlDigest,
    TupleInfo returnTupleInfo) {
  context.setStorageQuery(this);
  dimensionsD.addAll(otherDimsD);
  Cuboid cuboid = findCuboid(cubeInstance, dimensionsD, metrics);
  context.setCuboid(cuboid);
  context.setMapping(mapping);
  context.setNeedStorageAggregation(isNeedStorageAggregation(cuboid, groupsD, singleValuesD));
  context.setExactAggregation(exactAggregation);
  groupsD.addAll(loosenedColumnD);
  TupleFilter.collectColumns(filterD, filterColumnD);
  context.setFilterMask(getQueryFilterMask(filterColumnD));
      cubeInstance.getName(), cuboid.getId(), groupsD, filterColumnD, context.getFinalPushDownLimit(),
      context.getStorageLimitLevel(), context.isNeedStorageAggregation());
origin: KylinOLAP/Kylin

private void setLimit(TupleFilter filter, StorageContext context) {
  boolean goodAggr = context.isExactAggregation();
  boolean goodFilter = filter == null || (TupleFilter.isEvaluableRecursively(filter) && context.isCoprocessorEnabled());
  boolean goodSort = context.hasSort() == false;
  if (goodAggr && goodFilter && goodSort) {
    logger.info("Enable limit " + context.getLimit());
    context.enableLimit();
  }
}
origin: KylinOLAP/Kylin

@Override
public boolean hasNext() {
  // 1. check limit
  if (context.isLimitEnabled() && scanCount >= context.getLimit()) {
    return false;
  }
  // 2. check partial result
  if (context.isAcceptPartialResult() && scanCount > partialResultLimit) {
    context.setPartialResultReturned(true);
    return false;
  }
  // 3. check threshold
  if (scanCount >= context.getThreshold()) {
    throw new ScanOutOfLimitException("Scan row count exceeded threshold: " + context.getThreshold() + ", please add filter condition to narrow down backend scan range, like where clause.");
  }
  // 4. check cube segments
  return segmentIteratorIterator.hasNext() || segmentIterator.hasNext();
}
origin: KylinOLAP/Kylin

  private void setConnectionProperties() {
    OptiqConnection conn = (OptiqConnection) optiqContext.getQueryProvider();
    Properties connProps = conn.getProperties();

    String propThreshold = connProps.getProperty(OLAPQuery.PROP_SCAN_THRESHOLD);
    int threshold = Integer.valueOf(propThreshold);
    olapContext.storageContext.setThreshold(threshold);
  }
}
origin: KylinOLAP/Kylin

dimensionsD.addAll(othersD);
Cuboid cuboid = identifyCuboid(dimensionsD);
context.setCuboid(cuboid);
context.setExactAggregation(isExactAggregation);
HConnection conn = HBaseConnection.get(context.getConnUrl());
return new SerializedHBaseTupleIterator(conn, scans, cubeInstance, dimensionsD, filterD, groupsCopD, valueDecoders, context);
origin: apache/kylin

IGTStore store = new HBaseReadonlyStore(cellListIterator, scanRequest, rawScans.get(0).hbaseColumns, hbaseColumnsToGT, cubeSeg.getRowKeyPreambleSize(), false, storageContext.isExactAggregation());
IGTScanner rawScanner = store.scan(scanRequest);
origin: KylinOLAP/Kylin

private static boolean isCoprocessorBeneficial(CubeInstance cube, Collection<TblColRef> groupBy, Collection<RowValueDecoder> rowValueDecoders, StorageContext context) {
  String forceFlag = System.getProperty(FORCE_COPROCESSOR);
  if (forceFlag != null) {
    return Boolean.parseBoolean(forceFlag);
  }
  Boolean cubeOverride = CUBE_OVERRIDES.get(cube.getName());
  if (cubeOverride != null) {
    return cubeOverride.booleanValue();
  }
  if (RowValueDecoder.hasMemHungryCountDistinct(rowValueDecoders)) {
    logger.info("Coprocessor is disabled because there is memory hungry count distinct");
    return false;
  }
  if (context.isExactAggregation()) {
    logger.info("Coprocessor is disabled because exactAggregation is true");
    return false;
  }
  Cuboid cuboid = context.getCuboid();
  Set<TblColRef> toAggr = Sets.newHashSet(cuboid.getAggregationColumns());
  toAggr.removeAll(groupBy);
  if (toAggr.isEmpty()) {
    logger.info("Coprocessor is disabled because no additional columns to aggregate");
    return false;
  }
  logger.info("Coprocessor is enabled to aggregate " + toAggr + ", returning " + groupBy);
  return true;
}
origin: KylinOLAP/Kylin

@Before
public void setUp() throws Exception {
  this.createTestMetadata();
  CubeManager cubeMgr = CubeManager.getInstance(getTestConfig());
  cube = cubeMgr.getCube("TEST_KYLIN_CUBE_WITHOUT_SLR_EMPTY");
  Assert.assertNotNull(cube);
  storageEngine = StorageEngineFactory.getStorageEngine(cube);
  String url = KylinConfig.getInstanceFromEnv().getStorageUrl();
  context = new StorageContext();
  context.setConnUrl(url);
}
origin: apache/kylin

@Override
public void implementOLAP(OLAPImplementor implementor) {
  Preconditions.checkState(columnRowType == null, "OLAPTableScan MUST NOT be shared by more than one prent");
  // create context in case of non-join
  if (implementor.getContext() == null || !(implementor.getParentNode() instanceof OLAPJoinRel)
      || implementor.isNewOLAPContextRequired()) {
    implementor.allocateContext();
  }
  context = implementor.getContext();
  context.allTableScans.add(this);
  columnRowType = buildColumnRowType();
  if (context.olapSchema == null) {
    OLAPSchema schema = olapTable.getSchema();
    context.olapSchema = schema;
    context.storageContext.setConnUrl(schema.getStorageUrl());
  }
  if (context.firstTableScan == null) {
    context.firstTableScan = this;
  }
  if (needCollectionColumns(implementor)) {
    // OLAPToEnumerableConverter on top of table scan, should be a select * from table
    for (TblColRef tblColRef : columnRowType.getAllColumns()) {
      if (!tblColRef.getName().startsWith("_KY_")) {
        context.allColumns.add(tblColRef);
      }
    }
  }
}
origin: KylinOLAP/Kylin

public SerializedHBaseTupleIterator(HConnection conn, List<HBaseKeyRange> segmentKeyRanges, CubeInstance cube, Collection<TblColRef> dimensions, TupleFilter filter, Collection<TblColRef> groupBy, Collection<RowValueDecoder> rowValueDecoders, StorageContext context) {
  this.context = context;
  int limit = context.getLimit();
  this.partialResultLimit = Math.max(limit, PARTIAL_DEFAULT_LIMIT);
  this.segmentIteratorList = new ArrayList<CubeSegmentTupleIterator>(segmentKeyRanges.size());
  Map<CubeSegment, List<HBaseKeyRange>> rangesMap = makeRangesMap(segmentKeyRanges);
  for (Map.Entry<CubeSegment, List<HBaseKeyRange>> entry : rangesMap.entrySet()) {
    CubeSegmentTupleIterator segIter = new CubeSegmentTupleIterator(entry.getKey(), entry.getValue(), conn, dimensions, filter, groupBy, rowValueDecoders, context);
    this.segmentIteratorList.add(segIter);
  }
  this.segmentIteratorIterator = this.segmentIteratorList.iterator();
  if (this.segmentIteratorIterator.hasNext()) {
    this.segmentIterator = this.segmentIteratorIterator.next();
  } else {
    this.segmentIterator = ITupleIterator.EMPTY_TUPLE_ITERATOR;
  }
}
origin: KylinOLAP/Kylin

private void assertLimitWasEnabled() {
  OLAPContext context = getFirstOLAPContext();
  assertTrue(context.storageContext.isLimitEnabled());
}
origin: org.apache.kylin/kylin-core-storage

public GTCubeStorageQueryRequest getStorageQueryRequest(StorageContext context, SQLDigest sqlDigest,
    TupleInfo returnTupleInfo) {
  context.setStorageQuery(this);
  dimensionsD.addAll(otherDimsD);
  Cuboid cuboid = findCuboid(cubeInstance, dimensionsD, metrics);
  context.setCuboid(cuboid);
  context.setMapping(mapping);
  context.setNeedStorageAggregation(isNeedStorageAggregation(cuboid, groupsD, singleValuesD));
  context.setExactAggregation(exactAggregation);
  groupsD.addAll(loosenedColumnD);
  TupleFilter.collectColumns(filterD, filterColumnD);
  context.setFilterMask(getQueryFilterMask(filterColumnD));
      cubeInstance.getName(), cuboid.getId(), groupsD, filterColumnD, context.getFinalPushDownLimit(),
      context.getStorageLimitLevel(), context.isNeedStorageAggregation());
origin: KylinOLAP/Kylin

private void setThreshold(Collection<TblColRef> dimensions, List<RowValueDecoder> valueDecoders, StorageContext context) {
  if (RowValueDecoder.hasMemHungryCountDistinct(valueDecoders) == false) {
    return;
  }
  int rowSizeEst = dimensions.size() * 3;
  for (RowValueDecoder decoder : valueDecoders) {
    MeasureDesc[] measures = decoder.getMeasures();
    BitSet projectionIndex = decoder.getProjectionIndex();
    for (int i = projectionIndex.nextSetBit(0); i >= 0; i = projectionIndex.nextSetBit(i + 1)) {
      FunctionDesc func = measures[i].getFunction();
      rowSizeEst += func.getReturnDataType().getSpaceEstimate();
    }
  }
  long rowEst = MEM_BUDGET_PER_QUERY / rowSizeEst;
  context.setThreshold((int) rowEst);
}
origin: apache/kylin

builder.setIsExactAggregate(storageContext.isExactAggregation());
origin: org.apache.kylin/kylin-core-storage

if (context.hasSort()) {
  storageLimitLevel = StorageLimitLevel.NO_LIMIT;
  logger.debug("storageLimitLevel set to NO_LIMIT because the query has order by");
context.applyLimitPushDown(cubeInstance, storageLimitLevel);
origin: org.apache.kylin/kylin-query

@Override
public void implementOLAP(OLAPImplementor implementor) {
  Preconditions.checkState(columnRowType == null, "OLAPTableScan MUST NOT be shared by more than one prent");
  // create context in case of non-join
  if (implementor.getContext() == null || !(implementor.getParentNode() instanceof OLAPJoinRel)
      || implementor.isNewOLAPContextRequired()) {
    implementor.allocateContext();
  }
  context = implementor.getContext();
  context.allTableScans.add(this);
  columnRowType = buildColumnRowType();
  if (context.olapSchema == null) {
    OLAPSchema schema = olapTable.getSchema();
    context.olapSchema = schema;
    context.storageContext.setConnUrl(schema.getStorageUrl());
  }
  if (context.firstTableScan == null) {
    context.firstTableScan = this;
  }
  if (needCollectionColumns(implementor)) {
    // OLAPToEnumerableConverter on top of table scan, should be a select * from table
    for (TblColRef tblColRef : columnRowType.getAllColumns()) {
      if (!tblColRef.getName().startsWith("_KY_")) {
        context.allColumns.add(tblColRef);
      }
    }
  }
}
org.apache.kylin.storageStorageContext

Most used methods

  • setThreshold
  • <init>
  • getCuboid
  • getLimit
  • hasSort
  • isExactAggregation
  • isLimitEnabled
  • setConnUrl
  • setCuboid
  • setExactAggregation
  • applyLimitPushDown
  • enableCoprocessor
  • applyLimitPushDown,
  • enableCoprocessor,
  • enableLimit,
  • enableStreamAggregate,
  • getAliasMap,
  • getConnUrl,
  • getFinalPushDownLimit,
  • getMapping,
  • getOffset,
  • getProcessedRowCount

Popular in Java

  • Updating database using SQL prepared statement
  • getExternalFilesDir (Context)
  • runOnUiThread (Activity)
  • onRequestPermissionsResult (Fragment)
  • FileWriter (java.io)
    Convenience class for writing character files. The constructors of this class assume that the defaul
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now