Package org.apache.accumulo.core.data

Examples of org.apache.accumulo.core.data.ArrayByteSequence


    if (options.containsKey(indexFamilyOptionName))
      indexColf = new Text(options.get(indexFamilyOptionName));
    if (options.containsKey(docFamilyOptionName))
      docColf = new Text(options.get(docFamilyOptionName));
    docSource = source.deepCopy(env);
    indexColfSet = Collections.singleton((ByteSequence) new ArrayByteSequence(indexColf.getBytes(), 0, indexColf.getLength()));
   
    for (TermSource ts : this.sources) {
      ts.seekColfams = indexColfSet;
    }
  }
View Full Code Here


    if (zeroIndex < 0)
      throw new IllegalArgumentException("bad current docID");
    Text colf = new Text(docColf);
    colf.append(nullByte, 0, 1);
    colf.append(currentDocID.getBytes(), 0, zeroIndex);
    docColfSet = Collections.singleton((ByteSequence) new ArrayByteSequence(colf.getBytes(), 0, colf.getLength()));
    if (log.isTraceEnabled())
      log.trace(zeroIndex + " " + currentDocID.getLength());
    Text colq = new Text();
    colq.set(currentDocID.getBytes(), zeroIndex + 1, currentDocID.getLength() - zeroIndex - 1);
    Key k = new Key(currentPartition, colf, colq);
View Full Code Here

  }
 
  @Test
  public void testCommonPrefix() {
    // exact matches
    ArrayByteSequence exact = new ArrayByteSequence("abc");
    assertEquals(-1, RelativeKey.getCommonPrefix(exact, exact));
    assertEquals(-1, commonPrefixHelper("", ""));
    assertEquals(-1, commonPrefixHelper("a", "a"));
    assertEquals(-1, commonPrefixHelper("aa", "aa"));
    assertEquals(-1, commonPrefixHelper("aaa", "aaa"));
    assertEquals(-1, commonPrefixHelper("abab", "abab"));
    assertEquals(-1, commonPrefixHelper(new String("aaa"), new ArrayByteSequence("aaa").toString()));
    assertEquals(-1, commonPrefixHelper("abababababab".substring(3, 6), "ccababababcc".substring(3, 6)));
   
    // no common prefix
    assertEquals(0, commonPrefixHelper("", "a"));
    assertEquals(0, commonPrefixHelper("a", ""));
View Full Code Here

    assertEquals(2, commonPrefixHelper("aa", "aaaa"));
    assertEquals(4, commonPrefixHelper("aaaaa", "aaaab"));
  }
 
  private int commonPrefixHelper(String a, String b) {
    return RelativeKey.getCommonPrefix(new ArrayByteSequence(a), new ArrayByteSequence(b));
  }
View Full Code Here

    try {
      Map<String,Set<ByteSequence>> groups = LocalityGroupUtil.getLocalityGroups(conf);
      assertEquals(1, groups.size());
      assertNotNull(groups.get("lg1"));
      assertEquals(2, groups.get("lg1").size());
      assertTrue(groups.get("lg1").contains(new ArrayByteSequence("cf1")));
    } catch (LocalityGroupConfigurationError err) {
      fail();
    }
    try {
      conf.set("table.group.lg2", "cf1");
View Full Code Here

    for (int i = 0; i < 256; i++) {
      test1[i] = (byte) (0xff & i);
      test2[i] = (byte) (0xff & (255 - i));
    }
   
    ArrayByteSequence bs1 = new ArrayByteSequence(test1);
   
    String ecf = LocalityGroupUtil.encodeColumnFamily(bs1);
   
    // System.out.println(ecf);
   
    ByteSequence bs2 = LocalityGroupUtil.decodeColumnFamily(ecf);
   
    assertEquals(bs1, bs2);
    assertEquals(ecf, LocalityGroupUtil.encodeColumnFamily(bs2));
   
    // test encoding multiple column fams containing binary data
    HashSet<Text> in = new HashSet<Text>();
    HashSet<ByteSequence> in2 = new HashSet<ByteSequence>();
    in.add(new Text(test1));
    in2.add(new ArrayByteSequence(test1));
    in.add(new Text(test2));
    in2.add(new ArrayByteSequence(test2));
    Set<ByteSequence> out = LocalityGroupUtil.decodeColumnFamilies(LocalityGroupUtil.encodeColumnFamilies(in));
   
    assertEquals(in2, out);
  }
View Full Code Here

       
        Boolean wasChecked = (Boolean) validVisibilities.get(key.getColumnVisibilityData());
        if (wasChecked == null) {
          byte[] cv = key.getColumnVisibilityData().toArray();
          new ColumnVisibility(cv);
          validVisibilities.put(new ArrayByteSequence(Arrays.copyOf(cv, cv.length)), Boolean.TRUE);
        }
       
        if (out == null) {
          out = FileOperations.getInstance().openWriter(file.toString(), file.getFileSystem(conf), conf, acuConf);
          out.startDefaultLocalityGroup();
View Full Code Here

  public static final Set<ByteSequence> EMPTY_CF_SET = Collections.emptySet();
 
  public static Set<ByteSequence> families(Collection<Column> columns) {
    Set<ByteSequence> result = new HashSet<ByteSequence>(columns.size());
    for (Column col : columns) {
      result.add(new ArrayByteSequence(col.getColumnFamily()));
    }
    return result;
  }
View Full Code Here

        output[pos++] = (byte) (0xff & c);
      }
     
    }
   
    return new ArrayByteSequence(output, 0, pos);
   
  }
View Full Code Here

 
  public static Set<ByteSequence> ncfs(String... colFams) {
    HashSet<ByteSequence> cfs = new HashSet<ByteSequence>();
   
    for (String cf : colFams) {
      cfs.add(new ArrayByteSequence(cf));
    }
   
    return cfs;
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.data.ArrayByteSequence

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.