Java Code Examples for org.apache.kylin.metadata.model.TblColRef#equals()
The following examples show how to use
org.apache.kylin.metadata.model.TblColRef#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TsConditionEraser.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
/** * replace filter on timestamp column to null, so that two tuple filter trees can * be compared regardless of the filter condition on timestamp column (In top level where conditions concatenated by ANDs) * @param filter * @return */ @Override public TupleFilter onSerialize(TupleFilter filter) { if (filter == null) return null; //we just need reference equal if (root == filter) { isInTopLevelANDs.put(filter, true); } if (isInTopLevelANDs.containsKey(filter)) { classifyChildrenByMarking(filter); if (filter instanceof CompareTupleFilter) { TblColRef c = ((CompareTupleFilter) filter).getColumn(); if (c != null && c.equals(tsColumn)) { return null; } } } return filter; }
Example 2
Source File: TopNMeasureType.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
private boolean isTopNCompatibleSum(FunctionDesc topN, FunctionDesc sum) { if (sum == null) return false; if (!isTopN(topN)) return false; TblColRef topnNumCol = getTopNNumericColumn(topN); if (topnNumCol == null) { if (sum.isCount()) return true; return false; } if (sum.isSum() == false) return false; if (sum.getParameter() == null || sum.getParameter().getColRefs() == null || sum.getParameter().getColRefs().size() == 0) return false; TblColRef sumCol = sum.getParameter().getColRefs().get(0); return sumCol.equals(topnNumCol); }
Example 3
Source File: SegmentPruner.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
public static DimensionRangeInfo tryDeduceRangeFromPartitionCol(CubeSegment seg, TblColRef col) { DataModelDesc model = seg.getModel(); PartitionDesc part = model.getPartitionDesc(); if (!part.isPartitioned()) return null; if (!col.equals(part.getPartitionDateColumnRef())) return null; // deduce the dim range from TSRange TSRange tsRange = seg.getTSRange(); if (tsRange.start.isMin || tsRange.end.isMax) return null; // DimensionRangeInfo cannot express infinite String min = tsRangeToStr(tsRange.start.v, part); String max = tsRangeToStr(tsRange.end.v - 1, part); // note the -1, end side is exclusive return new DimensionRangeInfo(min, max); }
Example 4
Source File: TopNMeasureType.java From kylin with Apache License 2.0 | 6 votes |
private boolean isTopNCompatibleSum(FunctionDesc topN, FunctionDesc sum) { if (sum == null) return false; if (!isTopN(topN)) return false; TblColRef topnNumCol = getTopNNumericColumn(topN); if (topnNumCol == null) { if (sum.isCount()) return true; return false; } if (sum.isSum() == false) return false; if (sum.getParameter() == null || sum.getParameter().getColRefs() == null || sum.getParameter().getColRefs().size() == 0) return false; TblColRef sumCol = sum.getParameter().getColRefs().get(0); return sumCol.equals(topnNumCol); }
Example 5
Source File: TsConditionEraser.java From kylin with Apache License 2.0 | 6 votes |
/** * replace filter on timestamp column to null, so that two tuple filter trees can * be compared regardless of the filter condition on timestamp column (In top level where conditions concatenated by ANDs) * @param filter * @return */ @Override public TupleFilter onSerialize(TupleFilter filter) { if (filter == null) return null; //we just need reference equal if (root == filter) { isInTopLevelANDs.put(filter, true); } if (isInTopLevelANDs.containsKey(filter)) { classifyChildrenByMarking(filter); if (filter instanceof CompareTupleFilter) { TblColRef c = ((CompareTupleFilter) filter).getColumn(); if (c != null && c.equals(tsColumn)) { return null; } } } return filter; }
Example 6
Source File: SegmentPruner.java From kylin with Apache License 2.0 | 6 votes |
public static DimensionRangeInfo tryDeduceRangeFromPartitionCol(CubeSegment seg, TblColRef col) { DataModelDesc model = seg.getModel(); PartitionDesc part = model.getPartitionDesc(); if (!part.isPartitioned()) return null; if (!col.equals(part.getPartitionDateColumnRef())) return null; // deduce the dim range from TSRange TSRange tsRange = seg.getTSRange(); if (tsRange.start.isMin || tsRange.end.isMax) return null; // DimensionRangeInfo cannot express infinite String min = tsRangeToStr(tsRange.start.v, part); String max = tsRangeToStr(tsRange.end.v - 1, part); // note the -1, end side is exclusive return new DimensionRangeInfo(min, max); }
Example 7
Source File: BitMapFilterEvaluatorTest.java From Kylin with Apache License 2.0 | 5 votes |
public ConciseSet getBitMap(TblColRef col, int valueId) { if (!col.equals(colA)) return null; // i-th record has value ID i, and last record has value null ConciseSet bitMap = new ConciseSet(); if (valueId < 0 || valueId > getMaxValueId(col)) // null bitMap.add(getRecordCount() - 1); else bitMap.add(valueId); return bitMap; }
Example 8
Source File: BitMapFilterEvaluatorTest.java From Kylin with Apache License 2.0 | 5 votes |
@Override public ConciseSet getBitMap(TblColRef col, Integer startId, Integer endId) { if (!col.equals(colA)) return null; // i-th record has value ID i, and last record has value null if (startId == null && endId == null) { //entry for getting null value ConciseSet s = new ConciseSet(); s.add(getRecordCount() - 1); return s; } int start = 0; int end = MAX_ID; if (startId != null) { start = startId; } if (endId != null) { end = endId; } ConciseSet ret = new ConciseSet(); for (int i = start; i <= end; ++i) { ConciseSet temp = getBitMap(col, i); ret.addAll(temp); } return ret; }
Example 9
Source File: HBaseKeyRange.java From Kylin with Apache License 2.0 | 5 votes |
private void init(Collection<ColumnValueRange> andDimensionRanges) { int size = andDimensionRanges.size(); Map<TblColRef, String> startValues = Maps.newHashMapWithExpectedSize(size); Map<TblColRef, String> stopValues = Maps.newHashMapWithExpectedSize(size); Map<TblColRef, Set<String>> fuzzyValues = Maps.newHashMapWithExpectedSize(size); for (ColumnValueRange dimRange : andDimensionRanges) { TblColRef column = dimRange.getColumn(); startValues.put(column, dimRange.getBeginValue()); stopValues.put(column, dimRange.getEndValue()); fuzzyValues.put(column, dimRange.getEqualValues()); TblColRef partitionDateColumnRef = cubeSeg.getCubeDesc().getModel().getPartitionDesc().getPartitionDateColumnRef(); if (column.equals(partitionDateColumnRef)) { initPartitionRange(dimRange); } } AbstractRowKeyEncoder encoder = AbstractRowKeyEncoder.createInstance(cubeSeg, cuboid); encoder.setBlankByte(RowConstants.ROWKEY_LOWER_BYTE); this.startKey = encoder.encode(startValues); encoder.setBlankByte(RowConstants.ROWKEY_UPPER_BYTE); // In order to make stopRow inclusive add a trailing 0 byte. #See // Scan.setStopRow(byte [] stopRow) this.stopKey = Bytes.add(encoder.encode(stopValues), ZERO_TAIL_BYTES); // restore encoder defaults for later reuse (note // AbstractRowKeyEncoder.createInstance() caches instances) encoder.setBlankByte(AbstractRowKeyEncoder.DEFAULT_BLANK_BYTE); // always fuzzy match cuboid ID to lock on the selected cuboid this.fuzzyKeys = buildFuzzyKeys(fuzzyValues); }
Example 10
Source File: RowKeyEncoder.java From Kylin with Apache License 2.0 | 5 votes |
public int getColumnOffset(TblColRef col) { int offset = RowConstants.ROWKEY_CUBOIDID_LEN; for (TblColRef dimCol : cuboid.getColumns()) { if (col.equals(dimCol)) return offset; offset += colIO.getColumnLength(dimCol); } throw new IllegalArgumentException("Column " + col + " not found on cuboid " + cuboid); }
Example 11
Source File: OLAPFilterRel.java From Kylin with Apache License 2.0 | 5 votes |
private CompareTupleFilter mergeToInClause(TupleFilter filter) { List<? extends TupleFilter> children = filter.getChildren(); TblColRef inColumn = null; List<String> inValues = new LinkedList<String>(); for (TupleFilter child : children) { if (child.getOperator() == FilterOperatorEnum.EQ) { CompareTupleFilter compFilter = (CompareTupleFilter) child; TblColRef column = compFilter.getColumn(); if (inColumn == null) { inColumn = column; } if (column == null || !column.equals(inColumn)) { return null; } inValues.addAll(compFilter.getValues()); } else { return null; } } children.clear(); CompareTupleFilter inFilter = new CompareTupleFilter(FilterOperatorEnum.IN); inFilter.addChild(new ColumnTupleFilter(inColumn)); inFilter.addChild(new ConstantTupleFilter(inValues)); return inFilter; }
Example 12
Source File: CubeDesc.java From kylin with Apache License 2.0 | 5 votes |
public String getDictionaryBuilderClass(TblColRef col) { if (dictionaries == null) return null; for (DictionaryDesc desc : dictionaries) { if (desc.getBuilderClass() != null) { // column that reuses other's dict need not be built, thus should not reach here if (col.equals(desc.getColumnRef())) { return desc.getBuilderClass(); } } } return null; }
Example 13
Source File: StreamingCubeRule.java From kylin with Apache License 2.0 | 5 votes |
@Override public void validate(CubeDesc cube, ValidateContext context) { DataModelDesc model = cube.getModel(); if (model.getRootFactTable().getTableDesc().getSourceType() != ISourceAware.ID_STREAMING && !model.getRootFactTable().getTableDesc().isStreamingTable()) { return; } if (model.getPartitionDesc() == null || model.getPartitionDesc().getPartitionDateColumn() == null) { context.addResult(ResultLevel.ERROR, "Must define a partition column."); return; } final TblColRef partitionCol = model.getPartitionDesc().getPartitionDateColumnRef(); boolean found = false; for (DimensionDesc dimensionDesc : cube.getDimensions()) { for (TblColRef dimCol : dimensionDesc.getColumnRefs()) { if (dimCol.equals(partitionCol)) { found = true; break; } } } if (found == false) { context.addResult(ResultLevel.ERROR, "Partition column '" + partitionCol + "' isn't in dimension list."); return; } }
Example 14
Source File: CubeDesc.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
public String getDictionaryBuilderClass(TblColRef col) { if (dictionaries == null) return null; for (DictionaryDesc desc : dictionaries) { if (desc.getBuilderClass() != null) { // column that reuses other's dict need not be built, thus should not reach here if (col.equals(desc.getColumnRef())) { return desc.getBuilderClass(); } } } return null; }
Example 15
Source File: StreamingCubeRule.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@Override public void validate(CubeDesc cube, ValidateContext context) { DataModelDesc model = cube.getModel(); if (model.getRootFactTable().getTableDesc().getSourceType() != ISourceAware.ID_STREAMING && !model.getRootFactTable().getTableDesc().isStreamingTable()) { return; } if (model.getPartitionDesc() == null || model.getPartitionDesc().getPartitionDateColumn() == null) { context.addResult(ResultLevel.ERROR, "Must define a partition column."); return; } final TblColRef partitionCol = model.getPartitionDesc().getPartitionDateColumnRef(); boolean found = false; for (DimensionDesc dimensionDesc : cube.getDimensions()) { for (TblColRef dimCol : dimensionDesc.getColumnRefs()) { if (dimCol.equals(partitionCol)) { found = true; break; } } } if (found == false) { context.addResult(ResultLevel.ERROR, "Partition column '" + partitionCol + "' isn't in dimension list."); return; } }
Example 16
Source File: GTInfo.java From kylin with Apache License 2.0 | 4 votes |
public void validateColRef(TblColRef ref) { TblColRef expected = colRef(ref.getColumnDesc().getZeroBasedIndex()); if (!expected.equals(ref)) throw new IllegalArgumentException(); }
Example 17
Source File: GTInfo.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
public void validateColRef(TblColRef ref) { TblColRef expected = colRef(ref.getColumnDesc().getZeroBasedIndex()); if (!expected.equals(ref)) throw new IllegalArgumentException(); }