use of io.crate.expression.NestableInput in project crate by crate.
the class SysShardsExpressionsTest method testPartitionIdentOfNonPartition.
@Test
public void testPartitionIdentOfNonPartition() throws Exception {
// expression should return NULL on non partitioned tables
Reference refInfo = refInfo("sys.shards.partition_ident", DataTypes.STRING, RowGranularity.SHARD);
NestableInput<String> shardExpression = (NestableInput<String>) resolver.getImplementation(refInfo);
assertEquals("", shardExpression.value());
}
use of io.crate.expression.NestableInput in project crate by crate.
the class SysShardsExpressionsTest method testSize.
@Test
public void testSize() throws Exception {
Reference refInfo = refInfo("sys.shards.size", DataTypes.LONG, RowGranularity.SHARD);
NestableInput<Long> shardExpression = (NestableInput<Long>) resolver.getImplementation(refInfo);
assertEquals(Long.valueOf(123456), shardExpression.value());
}
use of io.crate.expression.NestableInput in project crate by crate.
the class SysShardsExpressionsTest method testPartitionIdent.
@Test
public void testPartitionIdent() throws Exception {
indexName = IndexParts.toIndexName("doc", "wikipedia_d1", "foo");
prepare();
Reference refInfo = refInfo("sys.shards.partition_ident", DataTypes.STRING, RowGranularity.SHARD);
NestableInput<String> shardExpression = (NestableInput<String>) resolver.getImplementation(refInfo);
assertEquals("foo", shardExpression.value());
// reset indexName
indexName = "wikipedia_de";
}
use of io.crate.expression.NestableInput in project crate by crate.
the class SysShardsExpressionsTest method test_retention_lease_is_null_on_index_shard_closed_exception.
@Test
public void test_retention_lease_is_null_on_index_shard_closed_exception() throws Exception {
IndexShard mock = mockIndexShard();
var shardId = mock.shardId();
doThrow(new IndexShardClosedException(shardId)).when(mock).getRetentionLeaseStats();
ShardReferenceResolver resolver = new ShardReferenceResolver(schemas, new ShardRowContext(mock, clusterService));
Reference refInfo = refInfo("sys.shards.retention_leases", DataTypes.LONG, RowGranularity.SHARD, "version");
NestableInput<Long> input = (NestableInput<Long>) resolver.getImplementation(refInfo);
assertThat(input.value(), Matchers.nullValue());
}
use of io.crate.expression.NestableInput in project crate by crate.
the class SysShardsExpressionsTest method testOrphanPartition.
@Test
public void testOrphanPartition() throws Exception {
indexName = IndexParts.toIndexName("doc", "wikipedia_d1", "foo");
prepare();
Reference refInfo = refInfo("sys.shards.orphan_partition", DataTypes.STRING, RowGranularity.SHARD);
NestableInput<Boolean> shardExpression = (NestableInput<Boolean>) resolver.getImplementation(refInfo);
assertEquals(true, shardExpression.value());
// reset indexName
indexName = "wikipedia_de";
}
Aggregations