本文整理汇总了Java中org.apache.kylin.metadata.filter.ColumnTupleFilter类的典型用法代码示例。如果您正苦于以下问题:Java ColumnTupleFilter类的具体用法?Java ColumnTupleFilter怎么用?Java ColumnTupleFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ColumnTupleFilter类属于org.apache.kylin.metadata.filter包,在下文中一共展示了ColumnTupleFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildInFilter
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
private static TupleFilter buildInFilter(TblColRef[] hostCols, Set<Array<String>> satisfyingHostRecords) {
if (satisfyingHostRecords.size() == 0) {
return ConstantTupleFilter.FALSE;
}
int hn = hostCols.length;
if (hn == 1) {
CompareTupleFilter in = new CompareTupleFilter(FilterOperatorEnum.IN);
in.addChild(new ColumnTupleFilter(hostCols[0]));
in.addChild(new ConstantTupleFilter(asValues(satisfyingHostRecords)));
return in;
} else {
LogicalTupleFilter or = new LogicalTupleFilter(FilterOperatorEnum.OR);
for (Array<String> rec : satisfyingHostRecords) {
LogicalTupleFilter and = new LogicalTupleFilter(FilterOperatorEnum.AND);
for (int i = 0; i < hn; i++) {
CompareTupleFilter eq = new CompareTupleFilter(FilterOperatorEnum.EQ);
eq.addChild(new ColumnTupleFilter(hostCols[i]));
eq.addChild(new ConstantTupleFilter(rec.data[i]));
and.addChild(eq);
}
or.addChild(and);
}
return or;
}
}
示例2: buildRangeFilter
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
private static LogicalTupleFilter buildRangeFilter(TblColRef[] hostCols, Set<Array<String>> satisfyingHostRecords) {
int hn = hostCols.length;
String[] min = new String[hn];
String[] max = new String[hn];
findMinMax(satisfyingHostRecords, hostCols, min, max);
LogicalTupleFilter and = new LogicalTupleFilter(FilterOperatorEnum.AND);
for (int i = 0; i < hn; i++) {
CompareTupleFilter compMin = new CompareTupleFilter(FilterOperatorEnum.GTE);
compMin.addChild(new ColumnTupleFilter(hostCols[i]));
compMin.addChild(new ConstantTupleFilter(min[i]));
and.addChild(compMin);
CompareTupleFilter compMax = new CompareTupleFilter(FilterOperatorEnum.LTE);
compMax.addChild(new ColumnTupleFilter(hostCols[i]));
compMax.addChild(new ConstantTupleFilter(max[i]));
and.addChild(compMax);
}
return and;
}
示例3: buildINCompareFilter
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
protected CompareTupleFilter buildINCompareFilter(TblColRef dateColumn) throws ParseException {
CompareTupleFilter compareFilter = new CompareTupleFilter(FilterOperatorEnum.IN);
ColumnTupleFilter columnFilter = new ColumnTupleFilter(dateColumn);
compareFilter.addChild(columnFilter);
List<String> inValues = Lists.newArrayList();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date startDate = simpleDateFormat.parse("1970-01-01");
Date endDate = simpleDateFormat.parse("2100-01-01");
Calendar start = Calendar.getInstance();
start.setTime(startDate);
Calendar end = Calendar.getInstance();
end.setTime(endDate);
for (Date date = start.getTime(); start.before(end); start.add(Calendar.DATE, 1), date = start.getTime()) {
inValues.add(simpleDateFormat.format(date));
}
ConstantTupleFilter constantFilter = new ConstantTupleFilter(inValues);
compareFilter.addChild(constantFilter);
return compareFilter;
}
示例4: setup
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
@Before
public void setup() throws IOException {
this.createTestMetadata();
this.ii = IIManager.getInstance(getTestConfig()).getII("test_kylin_ii");
this.tableRecordInfo = new TableRecordInfo(ii.getFirstSegment());
factTableDesc = MetadataManager.getInstance(getTestConfig()).getTableDesc("DEFAULT.TEST_KYLIN_FACT");
TblColRef formatName = this.ii.getDescriptor().findColumnRef("DEFAULT.TEST_KYLIN_FACT", "LSTG_FORMAT_NAME");
TblColRef siteId = this.ii.getDescriptor().findColumnRef("DEFAULT.TEST_KYLIN_FACT", "LSTG_SITE_ID");
Collection<TblColRef> dims = new HashSet<>();
dims.add(formatName);
projector = CoprocessorProjector.makeForEndpoint(tableRecordInfo, dims);
aggregators = EndpointAggregators.fromFunctions(tableRecordInfo, buildAggregations());
CompareTupleFilter rawFilter = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.EQ);
rawFilter.addChild(new ColumnTupleFilter(siteId));
rawFilter.addChild(new ConstantTupleFilter("0"));
filter = CoprocessorFilter.fromFilter(this.ii.getFirstSegment(), rawFilter);
aggCache = new EndpointAggregationCache(aggregators);
tableData = mockTable();
}
示例5: mergeToInClause
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
CompareTupleFilter mergeToInClause(TupleFilter filter) {
List<? extends TupleFilter> children = filter.getChildren();
TblColRef inColumn = null;
List<Object> inValues = new LinkedList<Object>();
Map<String, Object> dynamicVariables = new HashMap<>();
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());
dynamicVariables.putAll(compFilter.getVariables());
} else {
return null;
}
}
children.clear();
CompareTupleFilter inFilter = new CompareTupleFilter(FilterOperatorEnum.IN);
inFilter.addChild(new ColumnTupleFilter(inColumn));
inFilter.addChild(new ConstantTupleFilter(inValues));
inFilter.getVariables().putAll(dynamicVariables);
return inFilter;
}
示例6: addChild
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
@Override
public void addChild(TupleFilter child) {
if (child instanceof ColumnTupleFilter) {
super.addChild(child);
ColumnTupleFilter columnFilter = (ColumnTupleFilter) child;
if (this.column != null) {
throw new IllegalStateException("Duplicate columns! old is " + column.getName() + " and new is " + columnFilter.getColumn().getName());
}
this.column = columnFilter.getColumn();
} else if (child instanceof ConstantTupleFilter) {
// super.addChild(child) is omitted because the filter table name is useless at storage side,
// we'll extract the useful filterTableResourceIdentifier,filterTableType etc and save it at the MassInTupleFilter itself
if (filterTableName == null) {
filterTableName = (String) child.getValues().iterator().next();
ExternalFilterDesc externalFilterDesc = TableMetadataManager.getInstance(KylinConfig.getInstanceFromEnv()).getExtFilterDesc(filterTableName);
if (externalFilterDesc == null) {
throw new IllegalArgumentException("External filter named " + filterTableName + " is not found");
}
filterTableType = externalFilterDesc.getFilterTableType();
filterTableResourceIdentifier = externalFilterDesc.getFilterResourceIdentifier();
}
} else {
throw new IllegalStateException("MassInTupleFilter only has two children: one ColumnTupleFilter and one ConstantTupleFilter");
}
}
示例7: translateFunctionTupleFilter
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
private TupleFilter translateFunctionTupleFilter(BuiltInFunctionTupleFilter builtInFunctionTupleFilter) {
if (!builtInFunctionTupleFilter.isValid())
return null;
TblColRef columnRef = builtInFunctionTupleFilter.getColumn();
Dictionary<?> dict = dimEncMap.getDictionary(columnRef);
if (dict == null)
return null;
CompareTupleFilter translated = new CompareTupleFilter(builtInFunctionTupleFilter.isReversed() ? FilterOperatorEnum.NOTIN : FilterOperatorEnum.IN);
translated.addChild(new ColumnTupleFilter(columnRef));
try {
int translatedInClauseMaxSize = KylinConfig.getInstanceFromEnv().getTranslatedInClauseMaxSize();
for (int i = dict.getMinId(); i <= dict.getMaxId(); i++) {
Object dictVal = dict.getValueFromId(i);
if ((Boolean) builtInFunctionTupleFilter.invokeFunction(dictVal)) {
translated.addChild(new ConstantTupleFilter(dictVal));
if (translated.getChildren().size() > translatedInClauseMaxSize) {
return null;
}
}
}
logger.debug("getting a in clause with {} children", translated.getChildren().size());
} catch (Exception e) {
logger.debug(e.getMessage());
return null;
}
return translated;
}
示例8: collectColumnsRecursively
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
private void collectColumnsRecursively(TupleFilter filter, Set<TblColRef> collector) {
if (filter == null)
return;
if (filter instanceof ColumnTupleFilter) {
collector.add(((ColumnTupleFilter) filter).getColumn());
}
for (TupleFilter child : filter.getChildren()) {
collectColumnsRecursively(child, collector);
}
}
示例9: buildTs2010Filter
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
public CompareTupleFilter buildTs2010Filter(TblColRef column) {
CompareTupleFilter compareFilter = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.GT);
ColumnTupleFilter columnFilter1 = new ColumnTupleFilter(column);
compareFilter.addChild(columnFilter1);
ConstantTupleFilter constantFilter1 = new ConstantTupleFilter("2010-01-01");
compareFilter.addChild(constantFilter1);
return compareFilter;
}
示例10: buildTs2011Filter
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
public CompareTupleFilter buildTs2011Filter(TblColRef column) {
CompareTupleFilter compareFilter = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.GT);
ColumnTupleFilter columnFilter1 = new ColumnTupleFilter(column);
compareFilter.addChild(columnFilter1);
ConstantTupleFilter constantFilter1 = new ConstantTupleFilter("2011-01-01");
compareFilter.addChild(constantFilter1);
return compareFilter;
}
示例11: buildFilter1
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
public CompareTupleFilter buildFilter1(TblColRef column) {
CompareTupleFilter compareFilter = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.LTE);
ColumnTupleFilter columnFilter1 = new ColumnTupleFilter(column);
compareFilter.addChild(columnFilter1);
ConstantTupleFilter constantFilter1 = new ConstantTupleFilter("2012-05-23");
compareFilter.addChild(constantFilter1);
return compareFilter;
}
示例12: buildFilter2
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
public CompareTupleFilter buildFilter2(TblColRef column) {
CompareTupleFilter compareFilter = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.EQ);
ColumnTupleFilter columnFilter2 = new ColumnTupleFilter(column);
compareFilter.addChild(columnFilter2);
ConstantTupleFilter constantFilter2 = new ConstantTupleFilter("ClothinShoes & Accessories");
compareFilter.addChild(constantFilter2);
return compareFilter;
}
示例13: buildFilter3
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
public CompareTupleFilter buildFilter3(TblColRef column) {
CompareTupleFilter compareFilter = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.EQ);
ColumnTupleFilter columnFilter1 = new ColumnTupleFilter(column);
compareFilter.addChild(columnFilter1);
ConstantTupleFilter constantFilter1 = new ConstantTupleFilter("2012-05-23");
compareFilter.addChild(constantFilter1);
return compareFilter;
}
示例14: buildCompareDynamicFilter
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
protected CompareTupleFilter buildCompareDynamicFilter(List<TblColRef> groups, FilterOperatorEnum operator) {
CompareTupleFilter compareFilter = new CompareTupleFilter(operator);
compareFilter.addChild(new ColumnTupleFilter(groups.get(0)));
compareFilter.addChild(new DynamicTupleFilter("?0"));
compareFilter.bindVariable("?0", "abc");
return compareFilter;
}
示例15: gt
import org.apache.kylin.metadata.filter.ColumnTupleFilter; //导入依赖的package包/类
private CompareTupleFilter gt(ColumnTupleFilter col, int v) {
CompareTupleFilter r = new CompareTupleFilter(FilterOperatorEnum.GT);
r.addChild(col);
int c = col.getColumn().getColumnDesc().getZeroBasedIndex();
int len = info.getCodeSystem().maxCodeLength(c);
ByteArray bytes = new ByteArray(len);
BytesUtil.writeLong(v, bytes.array(), bytes.offset(), len);
r.addChild(new ConstantTupleFilter(bytes));
return r;
}