Search in sources :

Example 1 with JoinMatcher

use of org.apache.druid.segment.join.JoinMatcher in project druid by druid-io.

the class IndexedTableJoinableTest method makeJoinMatcherWithDimensionSelectorOnString.

@Test
public void makeJoinMatcherWithDimensionSelectorOnString() {
    final JoinConditionAnalysis condition = JoinConditionAnalysis.forExpression("x == \"j.str\"", PREFIX, ExprMacroTable.nil());
    final JoinMatcher joinMatcher = target.makeJoinMatcher(dummyColumnSelectorFactory, condition, false, false, Closer.create());
    final DimensionSelector selector = joinMatcher.getColumnSelectorFactory().makeDimensionSelector(DefaultDimensionSpec.of("str"));
    // getValueCardinality
    Assert.assertEquals(4, selector.getValueCardinality());
    // nameLookupPossibleInAdvance
    Assert.assertTrue(selector.nameLookupPossibleInAdvance());
    // lookupName
    Assert.assertEquals("foo", selector.lookupName(0));
    Assert.assertEquals("bar", selector.lookupName(1));
    Assert.assertEquals("baz", selector.lookupName(2));
    Assert.assertNull(selector.lookupName(3));
    // lookupId
    Assert.assertNull(selector.idLookup());
}
Also used : DimensionSelector(org.apache.druid.segment.DimensionSelector) ConstantDimensionSelector(org.apache.druid.segment.ConstantDimensionSelector) JoinMatcher(org.apache.druid.segment.join.JoinMatcher) JoinConditionAnalysis(org.apache.druid.segment.join.JoinConditionAnalysis) Test(org.junit.Test)

Aggregations

ConstantDimensionSelector (org.apache.druid.segment.ConstantDimensionSelector)1 DimensionSelector (org.apache.druid.segment.DimensionSelector)1 JoinConditionAnalysis (org.apache.druid.segment.join.JoinConditionAnalysis)1 JoinMatcher (org.apache.druid.segment.join.JoinMatcher)1 Test (org.junit.Test)1