Java Code Examples for io.airlift.units.DataSize#valueOf()
The following examples show how to use
io.airlift.units.DataSize#valueOf() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KafkaConfig.java From presto with Apache License 2.0 | 5 votes |
@Config("kafka.buffer-size") @ConfigDescription("Kafka message consumer buffer size") public KafkaConfig setKafkaBufferSize(String kafkaBufferSize) { this.kafkaBufferSize = DataSize.valueOf(kafkaBufferSize); return this; }
Example 2
Source File: TestClusterMemoryLeakDetector.java From presto with Apache License 2.0 | 5 votes |
private static BasicQueryInfo createQueryInfo(String queryId, QueryState state) { return new BasicQueryInfo( new QueryId(queryId), TEST_SESSION.toSessionRepresentation(), Optional.of(new ResourceGroupId("global")), state, GENERAL_POOL, true, URI.create("1"), "", Optional.empty(), Optional.empty(), new BasicQueryStats( DateTime.parse("1991-09-06T05:00-05:30"), DateTime.parse("1991-09-06T05:01-05:30"), Duration.valueOf("8m"), Duration.valueOf("7m"), Duration.valueOf("34m"), 13, 14, 15, 100, DataSize.valueOf("21GB"), 22, 23, DataSize.valueOf("23GB"), DataSize.valueOf("24GB"), DataSize.valueOf("25GB"), DataSize.valueOf("26GB"), Duration.valueOf("23m"), Duration.valueOf("24m"), true, ImmutableSet.of(WAITING_FOR_MEMORY), OptionalDouble.of(20)), null, null); }
Example 3
Source File: PropertyMetadataUtil.java From presto with Apache License 2.0 | 5 votes |
public static PropertyMetadata<DataSize> dataSizeProperty(String name, String description, DataSize defaultValue, boolean hidden) { return new PropertyMetadata<>( name, description, VARCHAR, DataSize.class, defaultValue, hidden, value -> DataSize.valueOf((String) value), DataSize::toString); }
Example 4
Source File: MockExchangeRequestProcessor.java From presto with Apache License 2.0 | 4 votes |
@Override public Response handle(Request request) { if (request.getMethod().equalsIgnoreCase("DELETE")) { return new TestingResponse(HttpStatus.NO_CONTENT, ImmutableListMultimap.of(), new byte[0]); } // verify we got a data size and it parses correctly assertTrue(!request.getHeaders().get(PrestoHeaders.PRESTO_MAX_SIZE).isEmpty()); DataSize maxSize = DataSize.valueOf(request.getHeader(PrestoHeaders.PRESTO_MAX_SIZE)); assertEquals(maxSize, expectedMaxSize); RequestLocation requestLocation = new RequestLocation(request.getUri()); URI location = requestLocation.getLocation(); BufferResult result = buffers.getUnchecked(location).getPages(requestLocation.getSequenceId(), maxSize); byte[] bytes = new byte[0]; HttpStatus status; if (!result.getSerializedPages().isEmpty()) { DynamicSliceOutput sliceOutput = new DynamicSliceOutput(64); sliceOutput.writeInt(SERIALIZED_PAGES_MAGIC); sliceOutput.writeLong(calculateChecksum(result.getSerializedPages())); sliceOutput.writeInt(result.getSerializedPages().size()); writeSerializedPages(sliceOutput, result.getSerializedPages()); bytes = sliceOutput.slice().getBytes(); status = HttpStatus.OK; } else { status = HttpStatus.NO_CONTENT; } return new TestingResponse( status, ImmutableListMultimap.of( CONTENT_TYPE, PRESTO_PAGES, PRESTO_TASK_INSTANCE_ID, String.valueOf(result.getTaskInstanceId()), PRESTO_PAGE_TOKEN, String.valueOf(result.getToken()), PRESTO_PAGE_NEXT_TOKEN, String.valueOf(result.getNextToken()), PRESTO_BUFFER_COMPLETE, String.valueOf(result.isBufferComplete())), bytes); }
Example 5
Source File: TestQueryStateInfo.java From presto with Apache License 2.0 | 4 votes |
private QueryInfo createQueryInfo(String queryId, QueryState state, String query) { return new QueryInfo( new QueryId(queryId), TEST_SESSION.toSessionRepresentation(), state, new MemoryPoolId("reserved"), true, URI.create("1"), ImmutableList.of("2", "3"), query, Optional.empty(), new QueryStats( DateTime.parse("1991-09-06T05:00-05:30"), DateTime.parse("1991-09-06T05:01-05:30"), DateTime.parse("1991-09-06T05:02-05:30"), DateTime.parse("1991-09-06T06:00-05:30"), Duration.valueOf("10s"), Duration.valueOf("8m"), Duration.valueOf("7m"), Duration.valueOf("34m"), Duration.valueOf("9m"), Duration.valueOf("10m"), Duration.valueOf("11m"), Duration.valueOf("12m"), 13, 14, 15, 100, 17, 18, 34, 19, 20.0, DataSize.valueOf("21GB"), DataSize.valueOf("22GB"), DataSize.valueOf("23GB"), DataSize.valueOf("24GB"), DataSize.valueOf("25GB"), DataSize.valueOf("30GB"), DataSize.valueOf("26GB"), DataSize.valueOf("27GB"), DataSize.valueOf("28GB"), DataSize.valueOf("29GB"), true, Duration.valueOf("23m"), Duration.valueOf("24m"), Duration.valueOf("26m"), true, ImmutableSet.of(WAITING_FOR_MEMORY), DataSize.valueOf("271GB"), 281, Duration.valueOf("26m"), DataSize.valueOf("272GB"), 282, DataSize.valueOf("27GB"), 28, DataSize.valueOf("29GB"), 30, DataSize.valueOf("31GB"), 32, DataSize.valueOf("33GB"), ImmutableList.of(), ImmutableList.of()), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of(), ImmutableSet.of(), ImmutableMap.of(), ImmutableMap.of(), ImmutableSet.of(), Optional.empty(), false, "33", Optional.empty(), null, null, ImmutableList.of(), ImmutableSet.of(), Optional.empty(), ImmutableList.of(), ImmutableList.of(), false, Optional.empty()); }