private static List<RangePartition> getRangePartitionList(KuduTable table, long deadline) { List<RangePartition> rangePartitions = new ArrayList<>(); if (!table.getPartitionSchema().getRangeSchema().getColumns().isEmpty()) { try { Iterator var4 = table.getTabletsLocations(deadline).iterator(); while (var4.hasNext()) { LocatedTablet tablet = (LocatedTablet) var4.next(); Partition partition = tablet.getPartition(); if (Iterators.all(partition.getHashBuckets().iterator(), Predicates.equalTo(0))) { RangePartition rangePartition = buildRangePartition(table, partition); rangePartitions.add(rangePartition); } } } catch (Exception e) { throw new RuntimeException(e); } } return rangePartitions; }
GetTableSchemaRequest(KuduTable masterTable, String id, String name) { super(masterTable); Preconditions.checkArgument(id != null ^ name != null, "Only one of table ID or the table name should be provided"); this.id = id; this.name = name; }
/** * Convert a list of {@link HostAndPort} objects to a comma separate string. * The inverse of {@link #parseStrings(String, int)}. * * @param hostsAndPorts A list of {@link HostAndPort} objects. * @return Comma separate list of "host:port" pairs. */ public static String hostsAndPortsToString(List<HostAndPort> hostsAndPorts) { return Joiner.on(",").join(Lists.transform(hostsAndPorts, Functions.toStringFunction())); }
/** * Creates a new tracker, using the specified stopwatch, and starts it right now. * The stopwatch is reset if it was already running. * @param stopwatch Specific Stopwatch to use */ public DeadlineTracker(Stopwatch stopwatch) { if (stopwatch.isRunning()) { stopwatch.reset(); } this.stopwatch = stopwatch.start(); }
public Slice(byte[] data) { Preconditions.checkNotNull(data, "array is null"); this.data = data; this.offset = 0; this.length = data.length; }
@Override public int hashCode() { return Objects.hashCode(first, second); } }
/** * Sets the specified byte at the specified absolute {@code index} in this * buffer. The 24 high-order bits of the specified value are ignored. * * @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or * {@code index + 1} is greater than {@code this.capacity} */ public void setByte(int index, int value) { Preconditions.checkPositionIndexes(index, index + 1, this.length); index += offset; data[index] = (byte) value; }
/** * Creates a new tracker, which starts the stopwatch right now. */ public DeadlineTracker() { this(Stopwatch.createUnstarted()); }
@Override public String toString() { return MoreObjects.toStringHelper(this) .add("tablet", tablet) .add("operation", operation) .toString(); } }
/** * Set the maximum number of boss threads. * Optional. * If not provided, 1 is used. */ public AsyncKuduClientBuilder bossCount(int bossCount) { Preconditions.checkArgument(bossCount > 0, "bossCount should be greater than 0"); this.bossCount = bossCount; return this; }
public Slice(byte[] data, int offset, int length) { Preconditions.checkNotNull(data, "array is null"); this.data = data; this.offset = offset; this.length = length; }
@Override public int hashCode() { return Objects.hashCode(tableId, partition); } }
/** * Gets a 16-bit short integer at the specified absolute {@code index} in * this slice. * * @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or * {@code index + 2} is greater than {@code this.capacity} */ public short getShort(int index) { Preconditions.checkPositionIndexes(index, index + Shorts.BYTES, this.length); index += offset; return (short) ((data[index] & 0xFF) | (data[index + 1] << 8)); }
@Override public String toString() { return MoreObjects.toStringHelper(this) .add("operations", operations.size()) .add("flusherTask", flusherTask) .add("flushNotification", flushNotification) .toString(); } }
/** * Construct RpcProxy object. * * @param client top-level Kudu client object * @param connection the connection associated with the target Kudu server */ RpcProxy(AsyncKuduClient client, Connection connection) { this.client = Preconditions.checkNotNull(client); this.connection = Preconditions.checkNotNull(connection); }
@Override public int hashCode() { return Objects.hashCode(address); }
/** * Gets a byte at the specified absolute {@code index} in this buffer. * * @throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0} or * {@code index + 1} is greater than {@code this.capacity} */ public byte getByte(int index) { Preconditions.checkPositionIndexes(index, index + 1, this.length); index += offset; return data[index]; }