Search in sources :

Example 1 with Value

use of io.crate.analyze.symbol.Value in project crate by crate.

the class TopNProjectionTest method testStreaming.

@Test
public void testStreaming() throws Exception {
    ImmutableList<Symbol> outputs = ImmutableList.of(new Value(DataTypes.BOOLEAN), new Value(DataTypes.INTEGER));
    TopNProjection p = new TopNProjection(5, 10, outputs);
    BytesStreamOutput out = new BytesStreamOutput();
    Projection.toStream(p, out);
    StreamInput in = StreamInput.wrap(out.bytes());
    TopNProjection p2 = (TopNProjection) Projection.fromStream(in);
    assertEquals(p, p2);
}
Also used : Symbol(io.crate.analyze.symbol.Symbol) Value(io.crate.analyze.symbol.Value) StreamInput(org.elasticsearch.common.io.stream.StreamInput) BytesStreamOutput(org.elasticsearch.common.io.stream.BytesStreamOutput) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Example 2 with Value

use of io.crate.analyze.symbol.Value in project crate by crate.

the class SymbolSerializerTest method testValueSymbol.

@Test
public void testValueSymbol() throws Exception {
    Value v = new Value(DataTypes.STRING);
    BytesStreamOutput out = new BytesStreamOutput();
    Symbols.toStream(v, out);
    StreamInput in = StreamInput.wrap(out.bytes());
    Value v2 = (Value) Symbols.fromStream(in);
    assertEquals(v2.valueType(), DataTypes.STRING);
}
Also used : Value(io.crate.analyze.symbol.Value) StreamInput(org.elasticsearch.common.io.stream.StreamInput) BytesStreamOutput(org.elasticsearch.common.io.stream.BytesStreamOutput) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

Value (io.crate.analyze.symbol.Value)2 CrateUnitTest (io.crate.test.integration.CrateUnitTest)2 BytesStreamOutput (org.elasticsearch.common.io.stream.BytesStreamOutput)2 StreamInput (org.elasticsearch.common.io.stream.StreamInput)2 Test (org.junit.Test)2 Symbol (io.crate.analyze.symbol.Symbol)1