Package org.apache.flink.types

Examples of org.apache.flink.types.StringValue


    assertEquals(new StringValue("test"), testString);
  }
 
  @Test
  public void testReplaceNonWordChars() {
    StringValue testString = new StringValue("TEST123_@");
    SimpleStringUtils.replaceNonWordChars(testString, '!');
    assertEquals(new StringValue("TEST123_!"), testString);
  }
View Full Code Here


    assertEquals(new StringValue("TEST123_!"), testString);
  }
 
  @Test
  public void testTokenizerOnStringWithoutNexToken() {
    StringValue testString = new StringValue("test");
    SimpleStringUtils.WhitespaceTokenizer tokenizer = new WhitespaceTokenizer();
    tokenizer.setStringToTokenize(testString);
    //first token
    tokenizer.next(testString);
    //next token is not exist
View Full Code Here

    assertFalse(tokenizer.next(testString));
  }
 
  @Test
  public void testTokenizerOnStringWithNexToken() {
    StringValue testString = new StringValue("test test");
    SimpleStringUtils.WhitespaceTokenizer tokenizer = new WhitespaceTokenizer();
    tokenizer.setStringToTokenize(testString);
    assertTrue(tokenizer.next(testString));
  }
View Full Code Here

    assertTrue(tokenizer.next(testString));
  }
 
  @Test
  public void testTokenizerOnStringOnlyWithDelimiter() {
    StringValue testString = new StringValue("    ");
    SimpleStringUtils.WhitespaceTokenizer tokenizer = new WhitespaceTokenizer();
    tokenizer.setStringToTokenize(testString);
    assertFalse(tokenizer.next(testString));
  }
View Full Code Here

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

    return new StringValue();
  }

  @Override
  public StringValue copy(StringValue from) {
    return copy(from, new StringValue());
  }
View Full Code Here

    record.write(target);
  }

  @Override
  public StringValue deserialize(DataInputView source) throws IOException {
    return deserialize(new StringValue(), source);
  }
View Full Code Here

      record = new Record(this.origVal1, this.origVal2);
      record.addField(this.origVal3);
     
      assertTrue(record.getNumFields() == 3);
     
      StringValue recVal1 = record.getField(0, StringValue.class);
      DoubleValue recVal2 = record.getField(1, DoubleValue.class);
      IntValue recVal3 = record.getField(2, IntValue.class);
     
      assertTrue("The value of the first field has changed", recVal1.equals(this.origVal1));
      assertTrue("The value of the second field changed", recVal2.equals(this.origVal2));
      assertTrue("The value of the third field has changed", recVal3.equals(this.origVal3));
    } catch (Throwable t) {
      Assert.fail("Test failed due to an exception: " + t.getMessage());
    }
View Full Code Here

    record.addField(this.origVal3);
    record.removeField(1);

    assertTrue(record.getNumFields() == 2);

    StringValue recVal1 = record.getField(0, StringValue.class);
    IntValue recVal2 = record.getField(1, IntValue.class);

    assertTrue(recVal1.getValue().equals(this.origVal1.getValue()));
    assertTrue(recVal2.getValue() == this.origVal3.getValue());

    record = this.generateFilledDenseRecord(100);

    // Remove field from the first position of the record
View Full Code Here

        r.write(new OutputViewDataOutputStreamWrapper(out));
        r = new Record();
        r.read(new InputViewDataInputStreamWrapper(in));
 
        r.setField(1, new IntValue(10));
        r.setField(4, new StringValue("Some long value"));
        r.setField(5, new StringValue("An even longer value"));
        r.setField(10, new IntValue(10));
 
        r.write(new OutputViewDataOutputStreamWrapper(out));
        r = new Record();
        r.read(new InputViewDataInputStreamWrapper(in));
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.