Package org.apache.flink.types

Examples of org.apache.flink.types.StringValue


 
  @Test
  public void testDeSerialization()
  {
    try {
      StringValue origValue1 = new StringValue("Hello World!");
      IntValue origValue2 = new IntValue(1337);
      Record record1 = new Record(origValue1, origValue2);
      Record record2 = new Record();
      try {
        // De/Serialize the record
        record1.write(new OutputViewDataOutputStreamWrapper(this.out));
        record2.read(new InputViewDataInputStreamWrapper(this.in));
 
        assertTrue(record1.getNumFields() == record2.getNumFields());
 
        StringValue rec1Val1 = record1.getField(0, StringValue.class);
        IntValue rec1Val2 = record1.getField(1, IntValue.class);
        StringValue rec2Val1 = record2.getField(0, StringValue.class);
        IntValue rec2Val2 = record2.getField(1, IntValue.class);
 
        assertTrue(origValue1.equals(rec1Val1));
        assertTrue(origValue2.equals(rec1Val2));
        assertTrue(origValue1.equals(rec2Val1));
View Full Code Here


    try {
      final Value[][] values = new Value[][] {
        // empty
        {},
        // exactly 8 fields
        {new IntValue(55), new StringValue("Hi there!"), new LongValue(457354357357135L), new IntValue(345), new IntValue(-468), new StringValue("This is the message and the message is this!"), new LongValue(0L), new IntValue(465)},
        // exactly 16 fields
        {new IntValue(55), new StringValue("Hi there!"), new LongValue(457354357357135L), new IntValue(345), new IntValue(-468), new StringValue("This is the message and the message is this!"), new LongValue(0L), new IntValue(465), new IntValue(55), new StringValue("Hi there!"), new LongValue(457354357357135L), new IntValue(345), new IntValue(-468), new StringValue("This is the message and the message is this!"), new LongValue(0L), new IntValue(465)},
        // exactly 8 nulls
        {null, null, null, null, null, null, null, null},
        // exactly 16 nulls
        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
        // arbitrary example
        {new IntValue(56), null, new IntValue(-7628761), new StringValue("A test string")},
        // a very long field
        {new StringValue(createRandomString(this.rand, 15)), new StringValue(createRandomString(this.rand, 1015)), new StringValue(createRandomString(this.rand, 32))},
        // two very long fields
        {new StringValue(createRandomString(this.rand, 1265)), null, new StringValue(createRandomString(this.rand, 855))}
      };
     
      for (int i = 0; i < values.length; i++) {
        blackboxTestRecordWithValues(values[i], this.rand, this.in, this.out);
      }
View Full Code Here

  public void testUnionFields()
  {
    try {
      final Value[][] values = new Value[][] {
        {new IntValue(56), null, new IntValue(-7628761)},
        {null, new StringValue("Hellow Test!"), null},
       
        {null, null, null, null, null, null, null, null},
        {null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null},
       
        {new IntValue(56), new IntValue(56), new IntValue(56), new IntValue(56), null, null, null},
View Full Code Here

        break;
      case 3:
        values[i] = NullValue.getInstance();
        break;
      case 4:
        values[i] = new StringValue(createRandomString(rnd));
        break;
      default:
        values[i] = null;
      }
    }
View Full Code Here

  }
 
  @Override
  protected StringValue[] getTestData() {
    return new StringValue[] {
        new StringValue("a"),
        new StringValue(""),
        new StringValue("bcd"),
        new StringValue("jbmbmner8 jhk hj \n \t üäßß@µ"),
        new StringValue(""),
        new StringValue("non-empty")};
  }
View Full Code Here

    }
  }
 
  @Override
  public StringValue createValue() {
    return new StringValue();
  }
View Full Code Here

 

  @Test
  public void testStringValue() {
    StringValue string0 = new StringValue("This is a test");
    StringValue string1 = new StringValue("This is a test with some longer String");
    StringValue string2 = new StringValue("This is a tesa");
    StringValue string3 = new StringValue("This");
    StringValue string4 = new StringValue("Ünlaut ßtring µ avec é y ¢");
   
    for (int length = 5; length <= 15; length+=10) {
      assertNormalizableKey(string0, string1, length);
      assertNormalizableKey(string0, string2, length);
      assertNormalizableKey(string0, string3, length);
View Full Code Here

        proxy = RPC.getProxy(TestProtocol.class, new InetSocketAddress("localhost", port), NetUtils.getSocketFactory());
       
        // make a few calls with various types
//        proxy.methodWithNoParameters();
       
        assertEquals(19, proxy.methodWithPrimitives(16, new StringValue("abc")));
        assertEquals(new DoubleValue(17.0), proxy.methodWithWritables(new LongValue(17)));
      }
      finally {
        if (proxy != null) {
          RPC.stopProxy(proxy);
View Full Code Here

    Assert.assertEquals(0, deserialized.getAggregates(cl).length);
  }
 
  @Test
  public void testSerializationOfEventWithAggregateValues() {
    StringValue stringValue = new StringValue("test string");
    LongValue longValue = new LongValue(68743254);
   
    String stringValueName = "stringValue";
    String longValueName = "longValue";
   
View Full Code Here

    }
  }
 
  @SuppressWarnings("unchecked")
  private static final DataSet<Tuple3<Double, StringValue, LongValue>> getSourceDataSet(ExecutionEnvironment env) {
    return env.fromElements(new Tuple3<Double, StringValue, LongValue>(3.141592, new StringValue("foobar"), new LongValue(77)))
        .setParallelism(1);
  }
View Full Code Here

TOP

Related Classes of org.apache.flink.types.StringValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.