use of io.crate.metadata.ReferenceIdent in project crate by crate.
the class SymbolPrinterTest method testReference.
@Test
public void testReference() throws Exception {
Reference r = new Reference(new ReferenceIdent(new RelationName("sys", "table"), new ColumnIdent("column", Arrays.asList("path", "nested"))), RowGranularity.DOC, DataTypes.STRING, 1, null);
assertPrint(r, "sys.\"table\".\"column\"['path']['nested']");
}
use of io.crate.metadata.ReferenceIdent in project crate by crate.
the class SymbolPrinterTest method testReferenceEscaped.
@Test
public void testReferenceEscaped() throws Exception {
Reference r = new Reference(new ReferenceIdent(new RelationName("doc", "table"), new ColumnIdent("colum\"n")), RowGranularity.DOC, DataTypes.STRING, 0, null);
assertPrint(r, "doc.\"table\".\"colum\"\"n\"");
}
use of io.crate.metadata.ReferenceIdent in project crate by crate.
the class SymbolPrinterTest method testVoidReference.
@Test
public void testVoidReference() throws Exception {
Reference r = new VoidReference(new ReferenceIdent(new RelationName("schema", "table"), new ColumnIdent("column", Arrays.asList("path", "nested"))), RowGranularity.DOC, 0);
assertPrint(r, "schema.\"table\".\"column\"['path']['nested']");
}
use of io.crate.metadata.ReferenceIdent in project crate by crate.
the class SymbolPrinterTest method testDynamicReference.
@Test
public void testDynamicReference() throws Exception {
Reference r = new DynamicReference(new ReferenceIdent(new RelationName("schema", "table"), new ColumnIdent("column", Arrays.asList("path", "nested"))), RowGranularity.DOC, 0);
assertPrint(r, "schema.\"table\".\"column\"['path']['nested']");
}
use of io.crate.metadata.ReferenceIdent in project crate by crate.
the class FetchPhaseTest method testStreaming.
@Test
public void testStreaming() throws Exception {
RelationName t1 = new RelationName(Schemas.DOC_SCHEMA_NAME, "t1");
TreeMap<String, Integer> bases = new TreeMap<>();
bases.put(t1.name(), 0);
bases.put("i2", 1);
HashMap<RelationName, Collection<String>> tableIndices = new HashMap<>();
tableIndices.put(t1, List.of(t1.name()));
tableIndices.put(new RelationName(Schemas.DOC_SCHEMA_NAME, "i2"), List.of("i2_s1", "i2_s2"));
ReferenceIdent nameIdent = new ReferenceIdent(t1, "name");
Reference name = new Reference(nameIdent, RowGranularity.DOC, DataTypes.STRING, 0, null);
FetchPhase orig = new FetchPhase(1, Set.of("node1", "node2"), bases, tableIndices, List.of(name));
BytesStreamOutput out = new BytesStreamOutput();
ExecutionPhases.toStream(out, orig);
StreamInput in = out.bytes().streamInput();
FetchPhase streamed = (FetchPhase) ExecutionPhases.fromStream(in);
assertThat(orig.phaseId(), is(streamed.phaseId()));
assertThat(orig.nodeIds(), is(streamed.nodeIds()));
assertThat(orig.fetchRefs(), is(streamed.fetchRefs()));
assertThat(orig.bases(), is(streamed.bases()));
assertThat(orig.tableIndices(), is(streamed.tableIndices()));
}
Aggregations