use of io.crate.expression.symbol.DynamicReference in project crate by crate.
the class DocTableInfoTest method testGetColumnInfo.
@Test
public void testGetColumnInfo() throws Exception {
RelationName relationName = new RelationName(Schemas.DOC_SCHEMA_NAME, "dummy");
DocTableInfo info = new DocTableInfo(relationName, List.of(new Reference(new ReferenceIdent(relationName, new ColumnIdent("o", List.of())), RowGranularity.DOC, DataTypes.UNTYPED_OBJECT, 1, null)), List.of(), List.of(), List.of(), Map.of(), Map.of(), Map.of(), List.of(), List.of(), null, true, new String[0], new String[0], new IndexNameExpressionResolver(), 5, "0", Settings.EMPTY, List.of(), List.of(), ColumnPolicy.DYNAMIC, Version.CURRENT, null, false, Operation.ALL);
final ColumnIdent col = new ColumnIdent("o", List.of("foobar"));
Reference foobar = info.getReference(col);
assertNull(foobar);
// forWrite: false, errorOnUnknownObjectKey: true, parentPolicy: dynamic
DynamicReference reference = info.getDynamic(col, false, true);
assertNull(reference);
// forWrite: true, errorOnUnknownObjectKey: true, parentPolicy: dynamic
reference = info.getDynamic(col, true, true);
assertNotNull(reference);
assertSame(reference.valueType(), DataTypes.UNDEFINED);
// forWrite: true, errorOnUnknownObjectKey: false, parentPolicy: dynamic
reference = info.getDynamic(col, true, false);
assertNotNull(reference);
assertSame(reference.valueType(), DataTypes.UNDEFINED);
// forWrite: false, errorOnUnknownObjectKey: false, parentPolicy: dynamic
reference = info.getDynamic(col, false, false);
assertNotNull(reference);
assertTrue(reference instanceof VoidReference);
assertSame(reference.valueType(), DataTypes.UNDEFINED);
}
Aggregations