use of io.crate.metadata.ReferenceIdent in project crate by crate.
the class GroupByAnalyzerTest method testNegateAliasRealColumnGroupByAlias.
@Test
public void testNegateAliasRealColumnGroupByAlias() {
QueriedSelectRelation relation = analyze("select age age, - age age from foo.users group by age;");
assertThat(relation.groupBy().isEmpty(), is(false));
List<Symbol> groupBySymbols = relation.groupBy();
ReferenceIdent groupByIdent = ((Reference) groupBySymbols.get(0)).ident();
assertThat(groupByIdent.columnIdent().fqn(), is("age"));
assertThat(groupByIdent.tableIdent().fqn(), is("foo.users"));
}
use of io.crate.metadata.ReferenceIdent in project crate by crate.
the class LuceneReferenceResolverTest method testGetImplementationWithColumnsOfTypeCollection.
@Test
public void testGetImplementationWithColumnsOfTypeCollection() {
Reference arrayRef = new Reference(new ReferenceIdent(name, "a"), RowGranularity.DOC, DataTypes.DOUBLE_ARRAY, 0, null);
assertThat(luceneReferenceResolver.getImplementation(arrayRef), instanceOf(DocCollectorExpression.ChildDocCollectorExpression.class));
}
use of io.crate.metadata.ReferenceIdent in project crate by crate.
the class LuceneReferenceResolverTest method testGetImplementationForSequenceNumber.
@Test
public void testGetImplementationForSequenceNumber() {
Reference seqNumberRef = new Reference(new ReferenceIdent(name, "_seq_no"), RowGranularity.DOC, DataTypes.LONG, 0, null);
assertThat(luceneReferenceResolver.getImplementation(seqNumberRef), instanceOf(SeqNoCollectorExpression.class));
}
use of io.crate.metadata.ReferenceIdent in project crate by crate.
the class LuceneReferenceResolverTest method test_ignored_dynamic_references_are_resolved_using_sourcelookup.
@Test
public void test_ignored_dynamic_references_are_resolved_using_sourcelookup() {
Reference ignored = new DynamicReference(new ReferenceIdent(name, "a", List.of("b")), RowGranularity.DOC, ColumnPolicy.IGNORED, 0);
assertThat(luceneReferenceResolver.getImplementation(ignored), instanceOf(DocCollectorExpression.ChildDocCollectorExpression.class));
}
use of io.crate.metadata.ReferenceIdent in project crate by crate.
the class EvaluatingNormalizerTest method prepare.
@Before
public void prepare() throws Exception {
Map<ColumnIdent, NestableInput> referenceImplementationMap = new HashMap<>(1, 1);
ReferenceIdent dummyLoadIdent = new ReferenceIdent(new RelationName("test", "dummy"), "load");
dummyLoadInfo = new Reference(dummyLoadIdent, RowGranularity.NODE, DataTypes.DOUBLE, 0, null);
referenceImplementationMap.put(dummyLoadIdent.columnIdent(), constant(0.08d));
nodeCtx = createNodeContext();
referenceResolver = new MapBackedRefResolver(referenceImplementationMap);
}
Aggregations