use of io.crate.metadata.RelationName in project crate by crate.
the class FetchMarkerTest method test_fetch_marker_streams_as_if_it_is_a_fetchId_reference.
@Test
public void test_fetch_marker_streams_as_if_it_is_a_fetchId_reference() throws Exception {
RelationName relationName = new RelationName("doc", "tbl");
FetchMarker fetchMarker = new FetchMarker(relationName, List.of());
BytesStreamOutput out = new BytesStreamOutput();
Symbols.toStream(fetchMarker, out);
StreamInput in = out.bytes().streamInput();
Symbol symbol = Symbols.fromStream(in);
assertThat(symbol, isReference(is(new ColumnIdent("_fetchid")), is(relationName), is(DataTypes.LONG)));
}
use of io.crate.metadata.RelationName in project crate by crate.
the class SymbolPrinterTest method testDocReference.
@Test
public void testDocReference() throws Exception {
Reference r = new Reference(new ReferenceIdent(new RelationName("doc", "table"), new ColumnIdent("column", Arrays.asList("path", "nested"))), RowGranularity.DOC, DataTypes.STRING, 0, null);
assertPrint(r, "doc.\"table\".\"column\"['path']['nested']");
}
use of io.crate.metadata.RelationName in project crate by crate.
the class SymbolPrinterTest method prepare.
@Before
public void prepare() throws Exception {
String createTableStmt = "create table doc.formatter (" + " foo text," + " bar bigint," + " \"CraZy\" ip," + " \"1a\" int," + " \"select\" char," + " idx int," + " s_arr array(text)" + ")";
RelationName name = new RelationName(DocSchemaInfo.NAME, TABLE_NAME);
DocTableInfo tableInfo = SQLExecutor.tableInfo(name, createTableStmt, clusterService);
Map<RelationName, AnalyzedRelation> sources = Map.of(name, new TableRelation(tableInfo));
sqlExpressions = new SqlExpressions(sources);
}
use of io.crate.metadata.RelationName in project crate by crate.
the class DocTableInfoBuilderTest method testNoTableInfoFromOrphanedPartition.
@Test
public void testNoTableInfoFromOrphanedPartition() throws Exception {
String schemaName = randomSchema();
PartitionName partitionName = new PartitionName(new RelationName(schemaName, "test"), Collections.singletonList("boo"));
IndexMetadata.Builder indexMetadataBuilder = IndexMetadata.builder(partitionName.asIndexName()).settings(Settings.builder().put("index.version.created", Version.CURRENT).build()).numberOfReplicas(0).numberOfShards(5).putMapping(Constants.DEFAULT_MAPPING_TYPE, "{" + " \"default\": {" + " \"properties\":{" + " \"id\": {" + " \"type\": \"integer\"," + " \"index\": \"not_analyzed\"" + " }" + " }" + " }" + "}");
Metadata metadata = Metadata.builder().put(indexMetadataBuilder).build();
ClusterState state = ClusterState.builder(ClusterName.DEFAULT).metadata(metadata).build();
DocTableInfoBuilder builder = new DocTableInfoBuilder(nodeCtx, new RelationName(schemaName, "test"), state, new IndexNameExpressionResolver());
expectedException.expect(RelationUnknown.class);
expectedException.expectMessage(String.format(Locale.ENGLISH, "Relation '%s.test' unknown", schemaName));
builder.build();
}
use of io.crate.metadata.RelationName in project crate by crate.
the class MetadataIndexUpgraderTest method test_mappingMetadata_set_to_null.
@Test
public void test_mappingMetadata_set_to_null() throws Throwable {
IndexMetadata indexMetadata = IndexMetadata.builder(new RelationName("blob", "b1").indexNameOrAlias()).settings(Settings.builder().put("index.version.created", Version.V_4_7_0)).numberOfShards(1).numberOfReplicas(0).putMapping(// here
null).build();
MetadataIndexUpgrader metadataIndexUpgrader = new MetadataIndexUpgrader();
IndexMetadata updatedMetadata = metadataIndexUpgrader.apply(indexMetadata);
assertThat(updatedMetadata.mapping(), is(nullValue()));
}
Aggregations