use of org.apache.druid.query.filter.SearchQueryDimFilter in project druid by druid-io.
the class ExpressionsTest method testContainsAsFilter.
@Test
public void testContainsAsFilter() {
testHelper.testFilter(ContainsOperatorConversion.caseSensitive().calciteOperator(), ImmutableList.of(testHelper.makeInputRef("spacey"), testHelper.makeLiteral("there")), Collections.emptyList(), new SearchQueryDimFilter("spacey", new ContainsSearchQuerySpec("there", true), null), true);
testHelper.testFilter(ContainsOperatorConversion.caseSensitive().calciteOperator(), ImmutableList.of(testHelper.makeInputRef("spacey"), testHelper.makeLiteral("There")), Collections.emptyList(), new SearchQueryDimFilter("spacey", new ContainsSearchQuerySpec("There", true), null), false);
testHelper.testFilter(ContainsOperatorConversion.caseInsensitive().calciteOperator(), ImmutableList.of(testHelper.makeInputRef("spacey"), testHelper.makeLiteral("There")), Collections.emptyList(), new SearchQueryDimFilter("spacey", new ContainsSearchQuerySpec("There", false), null), true);
testHelper.testFilter(ContainsOperatorConversion.caseSensitive().calciteOperator(), ImmutableList.of(testHelper.makeCall(SqlStdOperatorTable.CONCAT, testHelper.makeLiteral("what is"), testHelper.makeInputRef("spacey")), testHelper.makeLiteral("what")), ImmutableList.of(new ExpressionVirtualColumn("v0", "concat('what is',\"spacey\")", ColumnType.STRING, TestExprMacroTable.INSTANCE)), new SearchQueryDimFilter("v0", new ContainsSearchQuerySpec("what", true), null), true);
testHelper.testFilter(ContainsOperatorConversion.caseSensitive().calciteOperator(), ImmutableList.of(testHelper.makeCall(SqlStdOperatorTable.CONCAT, testHelper.makeLiteral("what is"), testHelper.makeInputRef("spacey")), testHelper.makeLiteral("there")), ImmutableList.of(new ExpressionVirtualColumn("v0", "concat('what is',\"spacey\")", ColumnType.STRING, TestExprMacroTable.INSTANCE)), new SearchQueryDimFilter("v0", new ContainsSearchQuerySpec("there", true), null), true);
testHelper.testFilter(ContainsOperatorConversion.caseInsensitive().calciteOperator(), ImmutableList.of(testHelper.makeCall(SqlStdOperatorTable.CONCAT, testHelper.makeLiteral("what is"), testHelper.makeInputRef("spacey")), testHelper.makeLiteral("What")), ImmutableList.of(new ExpressionVirtualColumn("v0", "concat('what is',\"spacey\")", ColumnType.STRING, TestExprMacroTable.INSTANCE)), new SearchQueryDimFilter("v0", new ContainsSearchQuerySpec("What", false), null), true);
testHelper.testFilter(ContainsOperatorConversion.caseSensitive().calciteOperator(), ImmutableList.of(testHelper.makeInputRef("spacey"), testHelper.makeLiteral("")), Collections.emptyList(), new SearchQueryDimFilter("spacey", new ContainsSearchQuerySpec("", true), null), true);
}
Aggregations