@Override public byte[] encode(Long l) { return super.encode(l ^ 0x8000000000000000L); }
@Override public byte[] encode(Double d) { long l = Double.doubleToRawLongBits(d); if (l < 0) l = ~l; else l = l ^ 0x8000000000000000L; return longEncoder.encode(l); }
/** * Creates the Mutation for the Order section for the given file and time * * @param file * Filename * @param timeInMillis * Time in millis that the file was closed * @return Mutation for the Order section */ public static Mutation createMutation(String file, long timeInMillis) { requireNonNull(file); checkArgument(timeInMillis >= 0, "timeInMillis must be greater than zero"); // Encode the time so it sorts properly byte[] rowPrefix = longEncoder.encode(timeInMillis); Text row = new Text(rowPrefix); // Normalize the file using Path Path p = new Path(file); String pathString = p.toUri().toString(); log.trace("Normalized {} into {}", file, pathString); // Append the file as a suffix to the row row.append((ROW_SEPARATOR + pathString).getBytes(UTF_8), 0, pathString.length() + ROW_SEPARATOR.getLength()); // Make the mutation and add the column update return new Mutation(row); }
@Override public byte[] encode(Long l) { return super.encode(l ^ 0x8000000000000000l); }
@Override public byte[] encode(Double d) { long l = Double.doubleToRawLongBits(d); if (l < 0) l = ~l; else l = l ^ 0x8000000000000000l; return longEncoder.encode(l); }
/** * Creates the Mutation for the Order section for the given file and time * * @param file * Filename * @param timeInMillis * Time in millis that the file was closed * @return Mutation for the Order section */ public static Mutation createMutation(String file, long timeInMillis) { requireNonNull(file); checkArgument(timeInMillis >= 0, "timeInMillis must be greater than zero"); // Encode the time so it sorts properly byte[] rowPrefix = longEncoder.encode(timeInMillis); Text row = new Text(rowPrefix); // Normalize the file using Path Path p = new Path(file); String pathString = p.toUri().toString(); log.trace("Normalized {} into {}", file, pathString); // Append the file as a suffix to the row row.append((ROW_SEPARATOR + pathString).getBytes(UTF_8), 0, pathString.length() + ROW_SEPARATOR.getLength()); // Make the mutation and add the column update return new Mutation(row); }