Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.Text


  }

  @Test(expected = IOException.class)
  public void testGetColumnForNullDelimiter() throws IOException {
    DelimitedLineRecordReader delimitedLineRecordReader = new DelimitedLineRecordReader();
    Text val = new Text("abd::cdd::efd::ghd::ijd::kld");
    Text key = delimitedLineRecordReader.getColumn(val, 5, null);
  }
View Full Code Here


  }

  @Test(expected = IOException.class)
  public void testGetColumnForEmptyDelimiter() throws IOException {
    DelimitedLineRecordReader delimitedLineRecordReader = new DelimitedLineRecordReader();
    Text val = new Text("abd::cdd::efd::ghd::ijd::kld");
    Text key = delimitedLineRecordReader.getColumn(val, 5, "");
  }
View Full Code Here

  }

  @Test
  public void testGetColumnHavingSpecialCharacterInValue() throws IOException {
    DelimitedLineRecordReader delimitedLineRecordReader = new DelimitedLineRecordReader();
    Text val = new Text("ab$d,cdd,efd,ghd,i%jd,kld");
    Text key = delimitedLineRecordReader.getColumn(val, 5, ",");
    System.out.println("key is: " + key);
    assertEquals(new Text("i%jd"), key);
    assertEquals(new Text("ab$d,cdd,efd,ghd,i%jd,kld"), val);
  }
View Full Code Here

  }

  @Test
  public void testGetColumnHavingQuotesInValue() throws IOException {
    DelimitedLineRecordReader delimitedLineRecordReader = new DelimitedLineRecordReader();
    Text val = new Text("ab\"d,cdd,efd,ghd,i'jd,kl~d");
    Text key = delimitedLineRecordReader.getColumn(val, 5, ",");
    System.out.println("key is: " + key);
    assertEquals(new Text("i'jd"), key);
    assertEquals(new Text("ab\"d,cdd,efd,ghd,i'jd,kl~d"), val);
  }
View Full Code Here

  }

  @Test
  public void testGetColumnHavingBackSlashInValue() throws IOException {
    DelimitedLineRecordReader delimitedLineRecordReader = new DelimitedLineRecordReader();
    Text val = new Text("ab\"d,cdd,efd,ghd,i\\'jd,kl~d");
    Text key = delimitedLineRecordReader.getColumn(val, 5, ",");
    System.out.println("key is: " + key);
    assertEquals(new Text("i\\'jd"), key);
    assertEquals(new Text("ab\"d,cdd,efd,ghd,i\\'jd,kl~d"), val);
  }
View Full Code Here

  @Test
  public void testGetColumnHavingSpecialCharacterDelimiterValue()
      throws IOException {
    DelimitedLineRecordReader delimitedLineRecordReader = new DelimitedLineRecordReader();
    Text val = new Text("abd$cdd$efd$ghd$ijd$kld");
    Text key = delimitedLineRecordReader.getColumn(val, 5, "$");
    System.out.println("key is: " + key);
    assertEquals(new Text("ijd"), key);
    assertEquals(new Text("abd$cdd$efd$ghd$ijd$kld"), val);
  }
View Full Code Here

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);
    mapper.map(key, val, context);

    Text outkey = new Text();
    Text outval = new Text();
    StringBuilder builder = new StringBuilder();
    builder.append(new Integer(12) + "," + new String("sam") + ","
        + new Date() + "," + new Long(26564l) + "," + true + ","
        + 1.235 + "," + 'a' + "," + new Time(new Date().getTime())
        + "," + new Time(new Date().getTime()) + "," + new Float(1.0f));

    outval.set(builder.toString());
    verify(context).write(outkey, outval);
  }
View Full Code Here

    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);
    mapper.map(key, val, context);

    Text outkey = new Text();
    Text outval = new Text();
    StringBuilder builder = new StringBuilder();
    builder.append(new Integer(12) + delimiter + new String("sam") + delimiter
        + new Date() + delimiter + new Long(26564l) + delimiter + true + delimiter
        + 1.235 + delimiter + 'a' + delimiter + new Time(new Date().getTime())
        + delimiter + new Time(new Date().getTime()) + delimiter + new Float(1.0f));

    outval.set(builder.toString());
    verify(context).write(outkey, outval);
  }
View Full Code Here

    ArrayList values = new ArrayList();
    GenericDBWritable val = new GenericDBWritable(columns, values);
    LongWritable key = new LongWritable(1);
    mapper.map(key, val, context);

    Text outkey = new Text();
    Text outval = new Text();
    verify(context).write(outkey, outval);
  }
View Full Code Here

public class TestHashUtility {

  @Test
  public void testMD5HashForTextValueValue() throws IOException {
    Text key = new Text("abc2hf123");
    MD5Hash md5HashKey1 = HashUtility.getMD5Hash(key);
    MD5Hash md5HashKey2 = HashUtility.getMD5Hash(key);
    assertEquals(md5HashKey1, md5HashKey2);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.Text

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.