org.apache.kylin.metadata.model.TblColRef.InnerDataTypeEnum Java Examples
The following examples show how to use
org.apache.kylin.metadata.model.TblColRef.InnerDataTypeEnum.
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: TupleFilterTest.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@Test public void testMustTrueTupleFilter() { TupleFilter andFilter = new LogicalTupleFilter(TupleFilter.FilterOperatorEnum.AND); TupleFilter andFilter2 = new LogicalTupleFilter(TupleFilter.FilterOperatorEnum.AND); TupleFilter orFilter = new LogicalTupleFilter(TupleFilter.FilterOperatorEnum.OR); andFilter.addChild(andFilter2); andFilter.addChild(orFilter); Set<CompareTupleFilter> trueTupleFilters = andFilter.findMustTrueCompareFilters(); Assert.assertTrue(trueTupleFilters.isEmpty()); TupleFilter compFilter = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.GT); compFilter.addChild(new ColumnTupleFilter(TblColRef.newInnerColumn("test1", TblColRef.InnerDataTypeEnum.LITERAL))); TupleFilter compFilter2 = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.GT); compFilter2.addChild(new ColumnTupleFilter(TblColRef.newInnerColumn("test2", TblColRef.InnerDataTypeEnum.LITERAL))); andFilter2.addChild(compFilter); orFilter.addChild(compFilter2); Assert.assertEquals(Sets.newHashSet(compFilter), andFilter.findMustTrueCompareFilters()); Assert.assertEquals(Sets.newHashSet(compFilter2), compFilter2.findMustTrueCompareFilters()); }
Example #2
Source File: OLAPProjectRel.java From kylin with Apache License 2.0 | 6 votes |
private TblColRef translateRexNode(RexNode rexNode, ColumnRowType inputColumnRowType, TupleExpression tupleExpr, String fieldName) { if (tupleExpr instanceof ColumnTupleExpression) { return ((ColumnTupleExpression) tupleExpr).getColumn(); } else if (tupleExpr instanceof ConstantTupleExpression) { Object value = ((ConstantTupleExpression) tupleExpr).getValue(); return TblColRef.newInnerColumn(value == null ? "null" : value.toString(), InnerDataTypeEnum.LITERAL); } else if (tupleExpr instanceof RexCallTupleExpression && rexNode instanceof RexInputRef) { RexInputRef inputRef = (RexInputRef) rexNode; int index = inputRef.getIndex(); if (index < inputColumnRowType.size()) { return inputColumnRowType.getColumnByIndex(index); } } return TblColRef.newInnerColumn(fieldName, InnerDataTypeEnum.LITERAL, tupleExpr.getDigest()); }
Example #3
Source File: TupleFilterTest.java From kylin with Apache License 2.0 | 6 votes |
@Test public void testMustTrueTupleFilter() { TupleFilter andFilter = new LogicalTupleFilter(TupleFilter.FilterOperatorEnum.AND); TupleFilter andFilter2 = new LogicalTupleFilter(TupleFilter.FilterOperatorEnum.AND); TupleFilter orFilter = new LogicalTupleFilter(TupleFilter.FilterOperatorEnum.OR); andFilter.addChild(andFilter2); andFilter.addChild(orFilter); Set<CompareTupleFilter> trueTupleFilters = andFilter.findMustTrueCompareFilters(); Assert.assertTrue(trueTupleFilters.isEmpty()); TupleFilter compFilter = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.GT); compFilter.addChild(new ColumnTupleFilter(TblColRef.newInnerColumn("test1", TblColRef.InnerDataTypeEnum.LITERAL))); TupleFilter compFilter2 = new CompareTupleFilter(TupleFilter.FilterOperatorEnum.GT); compFilter2.addChild(new ColumnTupleFilter(TblColRef.newInnerColumn("test2", TblColRef.InnerDataTypeEnum.LITERAL))); andFilter2.addChild(compFilter); orFilter.addChild(compFilter2); Assert.assertEquals(Sets.newHashSet(compFilter), andFilter.findMustTrueCompareFilters()); Assert.assertEquals(Sets.newHashSet(compFilter2), compFilter2.findMustTrueCompareFilters()); }
Example #4
Source File: TupleFilterTest.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
private TupleFilter createEQFilter(String colName, String colVal) { CompareTupleFilter compareTupleFilter = new CompareTupleFilter(FilterOperatorEnum.EQ); compareTupleFilter .addChild(new ColumnTupleFilter(TblColRef.newInnerColumn(colName, InnerDataTypeEnum.LITERAL))); compareTupleFilter.addChild(new ConstantTupleFilter(colVal)); return compareTupleFilter; }
Example #5
Source File: DictGridTableTest.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@Test public void verifyAggregateAndHavingFilter() throws IOException { GTInfo info = table.getInfo(); TblColRef havingCol = TblColRef.newInnerColumn("SUM_OF_BIGDECIMAL", InnerDataTypeEnum.LITERAL); havingCol.getColumnDesc().setId("1"); // point to the first aggregated measure CompareTupleFilter havingFilter = compare(havingCol, FilterOperatorEnum.GT, "20"); GTScanRequest req = new GTScanRequestBuilder().setInfo(info).setRanges(null).setDimensions(null) .setAggrGroupBy(setOf(1)).setAggrMetrics(setOf(4)).setAggrMetricsFuncs(new String[] { "sum" }) .setHavingFilterPushDown(havingFilter).createGTScanRequest(); doScanAndVerify(table, useDeserializedGTScanRequest(req), "[null, 20, null, null, 42.0]", "[null, 30, null, null, 52.5]"); }
Example #6
Source File: TupleFilterTest.java From kylin with Apache License 2.0 | 5 votes |
private TupleFilter createEQFilter(String colName, String colVal) { CompareTupleFilter compareTupleFilter = new CompareTupleFilter(FilterOperatorEnum.EQ); compareTupleFilter .addChild(new ColumnTupleFilter(TblColRef.newInnerColumn(colName, InnerDataTypeEnum.LITERAL))); compareTupleFilter.addChild(new ConstantTupleFilter(colVal)); return compareTupleFilter; }
Example #7
Source File: DictGridTableTest.java From kylin with Apache License 2.0 | 5 votes |
@Test public void verifyAggregateAndHavingFilter() throws IOException { GTInfo info = table.getInfo(); TblColRef havingCol = TblColRef.newInnerColumn("SUM_OF_BIGDECIMAL", InnerDataTypeEnum.LITERAL); havingCol.getColumnDesc().setId("1"); // point to the first aggregated measure CompareTupleFilter havingFilter = compare(havingCol, FilterOperatorEnum.GT, "20"); GTScanRequest req = new GTScanRequestBuilder().setInfo(info).setRanges(null).setDimensions(null) .setAggrGroupBy(setOf(1)).setAggrMetrics(setOf(4)).setAggrMetricsFuncs(new String[] { "sum" }) .setHavingFilterPushDown(havingFilter).createGTScanRequest(); doScanAndVerify(table, useDeserializedGTScanRequest(req), "[null, 20, null, null, 42.0]", "[null, 30, null, null, 52.5]"); }
Example #8
Source File: OLAPProjectRel.java From Kylin with Apache License 2.0 | 5 votes |
private TblColRef translateRexLiteral(RexLiteral literal) { if (RexLiteral.isNullLiteral(literal)) { return TblColRef.newInnerColumn("null", InnerDataTypeEnum.LITERAL); } else { return TblColRef.newInnerColumn(literal.getValue().toString(), InnerDataTypeEnum.LITERAL); } }