use of io.crate.testing.DummyRelation in project crate by crate.
the class SymbolToTrueVisitorTest method prepare.
@Before
public void prepare() throws Exception {
visitor = new SymbolToTrueVisitor();
DummyRelation dummyRelation = new DummyRelation("clustered_by", "number_of_shards", "table_name", "number_of_replicas", "schema_name");
ImmutableMap<QualifiedName, AnalyzedRelation> sources = ImmutableMap.<QualifiedName, AnalyzedRelation>of(new QualifiedName("dummy"), dummyRelation);
expressions = new SqlExpressions(sources);
}
use of io.crate.testing.DummyRelation in project crate by crate.
the class ExpressionAnalyzerTest method prepare.
@Before
public void prepare() throws Exception {
paramTypeHints = ParamTypeHints.EMPTY;
DummyRelation dummyRelation = new DummyRelation("obj.x", "myObj.x", "myObj.x.AbC");
dummySources = ImmutableMap.of(new QualifiedName("foo"), dummyRelation);
context = new ExpressionAnalysisContext();
functions = getFunctions();
}
use of io.crate.testing.DummyRelation in project crate by crate.
the class FieldProviderTest method testMultipleSourcesWithDynamicReferenceAndReference.
@Test
public void testMultipleSourcesWithDynamicReferenceAndReference() throws Exception {
AnalyzedRelation barT = new DummyRelation("name");
AnalyzedRelation fooT = new DummyRelation("name");
AnalyzedRelation fooA = new DummyRelation("name");
AnalyzedRelation customT = new DummyRelation("tags");
FieldProvider<Field> resolver = new FullQualifedNameFieldProvider(ImmutableMap.of(newQN("bar.t"), barT, newQN("foo.t"), fooT, newQN("foo.a"), fooA, newQN("custom.t"), customT));
Field field = resolver.resolveField(newQN("foo.t.name"), Operation.READ);
assertThat(field.relation(), equalTo(fooT));
// reference > dynamicReference - not ambiguous
Field tags = resolver.resolveField(newQN("tags"), Operation.READ);
assertThat(tags.relation(), equalTo(customT));
field = resolver.resolveField(newQN("a.name"), Operation.READ);
assertThat(field.relation(), equalTo(fooA));
}
use of io.crate.testing.DummyRelation in project crate by crate.
the class FieldProviderTest method testAliasRelationNameResolver.
@Test
public void testAliasRelationNameResolver() throws Exception {
AnalyzedRelation barT = new DummyRelation("name");
FieldProvider<Field> resolver = new FullQualifedNameFieldProvider(ImmutableMap.of(newQN("\"Bar\""), barT));
Field field = resolver.resolveField(newQN("\"Bar\".name"), Operation.READ);
assertThat(field.relation(), equalTo(barT));
}
use of io.crate.testing.DummyRelation in project crate by crate.
the class FieldProviderTest method testSimpleResolverUnknownColumn.
@Test
public void testSimpleResolverUnknownColumn() throws Exception {
expectedException.expect(ColumnUnknownException.class);
expectedException.expectMessage("Column unknown unknown");
AnalyzedRelation relation = new DummyRelation("name");
FieldProvider<Field> resolver = new FullQualifedNameFieldProvider(ImmutableMap.of(newQN("doc.t"), relation));
resolver.resolveField(new QualifiedName(Arrays.asList("unknown")), Operation.READ);
}
Aggregations