/** * Helper method to generate QueryId * @return generated QueryId */ private static QueryId queryIdGenerator() { ThreadLocalRandom r = ThreadLocalRandom.current(); // create a new queryid where the first four bytes are a growing time (each new value comes earlier in sequence). Last 12 bytes are random. final long time = (int) (System.currentTimeMillis()/1000); final long p1 = ((Integer.MAX_VALUE - time) << 32) + r.nextInt(); final long p2 = r.nextLong(); final QueryId id = QueryId.newBuilder().setPart1(p1).setPart2(p2).build(); return id; }
public static QueryId getQueryIdFromString(final String queryId) { final UUID uuid = UUID.fromString(queryId); return QueryId.newBuilder().setPart1(uuid.getMostSignificantBits()).setPart2(uuid.getLeastSignificantBits()).build(); }
public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.exec.proto.UserBitShared.QueryId.Builder builder) throws java.io.IOException { for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) { switch(number) { case 0: return; case 1: builder.setPart1(input.readSFixed64()); break; case 2: builder.setPart2(input.readSFixed64()); break; default: input.handleUnknownField(number, this); } } } public boolean isInitialized(org.apache.drill.exec.proto.UserBitShared.QueryId.Builder builder)
public Builder mergeFrom(org.apache.drill.exec.proto.UserBitShared.QueryId other) { if (other == org.apache.drill.exec.proto.UserBitShared.QueryId.getDefaultInstance()) return this; if (other.hasPart1()) { setPart1(other.getPart1()); } if (other.hasPart2()) { setPart2(other.getPart2()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }
public void mergeFrom(com.dyuproject.protostuff.Input input, org.apache.drill.exec.proto.UserBitShared.QueryId.Builder builder) throws java.io.IOException { for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this)) { switch(number) { case 0: return; case 1: builder.setPart1(input.readSFixed64()); break; case 2: builder.setPart2(input.readSFixed64()); break; default: input.handleUnknownField(number, this); } } } public boolean isInitialized(org.apache.drill.exec.proto.UserBitShared.QueryId.Builder builder)
public Builder mergeFrom(org.apache.drill.exec.proto.UserBitShared.QueryId other) { if (other == org.apache.drill.exec.proto.UserBitShared.QueryId.getDefaultInstance()) return this; if (other.hasPart1()) { setPart1(other.getPart1()); } if (other.hasPart2()) { setPart2(other.getPart2()); } this.mergeUnknownFields(other.getUnknownFields()); return this; }