use of io.crate.expression.NestableInput 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);
}
use of io.crate.expression.NestableInput in project crate by crate.
the class MapBackedRefResolverTest method testGetImplementation.
@Test
public void testGetImplementation() throws Exception {
ReferenceResolver<NestableInput<?>> refResolver = new MapBackedRefResolver(Collections.singletonMap(new ColumnIdent("obj"), mock(NestableInput.class)));
NestableInput implementation = refResolver.getImplementation(new Reference(new ReferenceIdent(USERS_TI, new ColumnIdent("obj", Arrays.asList("x", "z"))), RowGranularity.DOC, DataTypes.STRING, 0, null));
assertThat(implementation, Matchers.nullValue());
}
use of io.crate.expression.NestableInput in project crate by crate.
the class SysShardsExpressionsTest method testId.
@Test
public void testId() throws Exception {
Reference refInfo = refInfo("sys.shards.id", DataTypes.INTEGER, RowGranularity.SHARD);
NestableInput<Integer> shardExpression = (NestableInput<Integer>) resolver.getImplementation(refInfo);
assertEquals(Integer.valueOf(1), shardExpression.value());
}
use of io.crate.expression.NestableInput in project crate by crate.
the class SysShardsExpressionsTest method testPathExpression.
@Test
public void testPathExpression() throws Exception {
Reference refInfo = refInfo("sys.shards.path", DataTypes.STRING, RowGranularity.SHARD);
NestableInput<String> shardPathExpression = (NestableInput<String>) resolver.getImplementation(refInfo);
assertThat(shardPathExpression.value(), is(resolveCanonicalString("/dummy/" + indexUUID + "/1")));
}
use of io.crate.expression.NestableInput in project crate by crate.
the class SysShardsExpressionsTest method testTableName.
@Test
public void testTableName() throws Exception {
Reference refInfo = refInfo("sys.shards.table_name", DataTypes.STRING, RowGranularity.SHARD);
NestableInput<String> shardExpression = (NestableInput<String>) resolver.getImplementation(refInfo);
assertEquals("wikipedia_de", shardExpression.value());
}
Aggregations