@Override public <ContextType> ContextType getContextValue(String key, ContextType defaultValue) { return (ContextType) query.getContextValue(key, defaultValue); }
@Override public <ContextType> ContextType getContextValue(String key) { return (ContextType) query.getContextValue(key); }
@Deprecated public static <T> String getChunkPeriod(Query<T> query) { return query.getContextValue(CHUNK_PERIOD_KEY, "P0D"); }
static <T> int parseInt(Query<T> query, String key, int defaultValue) { final Object val = query.getContextValue(key); return val == null ? defaultValue : Numbers.parseInt(val); }
static <T> long parseLong(Query<T> query, String key, long defaultValue) { final Object val = query.getContextValue(key); return val == null ? defaultValue : Numbers.parseLong(val); }
static <T> boolean parseBoolean(Query<T> query, String key, boolean defaultValue) { final Object val = query.getContextValue(key); return val == null ? defaultValue : Numbers.parseBoolean(val); }
public static <T> Query<T> withMaxScatterGatherBytes(Query<T> query, long maxScatterGatherBytesLimit) { Object obj = query.getContextValue(MAX_SCATTER_GATHER_BYTES_KEY); if (obj == null) { return query.withOverriddenContext(ImmutableMap.of(MAX_SCATTER_GATHER_BYTES_KEY, maxScatterGatherBytesLimit)); } else { long curr = ((Number) obj).longValue(); if (curr > maxScatterGatherBytesLimit) { throw new IAE( "configured [%s = %s] is more than enforced limit of [%s].", MAX_SCATTER_GATHER_BYTES_KEY, curr, maxScatterGatherBytesLimit ); } else { return query; } } }
final long timeoutAt = query.getContextValue(QUERY_FAIL_TIME); final long maxScatterGatherBytes = QueryContexts.getMaxScatterGatherBytes(query); final AtomicLong totalBytesGathered = (AtomicLong) context.get(QUERY_TOTAL_BYTES_GATHERED);
query.<String>getContextValue("postProcessing"), new TypeReference<PostProcessingOperator<T>>()
); Assert.assertEquals(1, serdeQuery.getContextValue(QueryContexts.PRIORITY_KEY)); Assert.assertEquals(true, serdeQuery.getContextValue("useCache")); Assert.assertEquals("true", serdeQuery.getContextValue("populateCache")); Assert.assertEquals(true, serdeQuery.getContextValue("finalize")); Assert.assertEquals(true, serdeQuery.getContextBoolean("useCache", false)); Assert.assertEquals(true, serdeQuery.getContextBoolean("populateCache", false));
Query capturedQuery = capturedQueryPlus.getQuery(); if (expectBySegment) { Assert.assertEquals(true, capturedQuery.getContextValue("bySegment")); } else { Assert.assertTrue( capturedQuery.getContextValue("bySegment") == null || capturedQuery.getContextValue("bySegment").equals(false) );
final boolean skipIncrementalSegment = query.getContextValue(CONTEXT_SKIP_INCREMENTAL_SEGMENT, false); final AtomicLong cpuTimeAccumulator = new AtomicLong(0L);
public static <T> String getChunkPeriod(Query<T> query) { return query.getContextValue(CHUNK_PERIOD_KEY, "P0D"); }
static <T> int parseInt(Query<T> query, String key, int defaultValue) { final Object val = query.getContextValue(key); return val == null ? defaultValue : Numbers.parseInt(val); }
static <T> boolean parseBoolean(Query<T> query, String key, boolean defaultValue) { final Object val = query.getContextValue(key); return val == null ? defaultValue : Numbers.parseBoolean(val); }
static <T> long parseLong(Query<T> query, String key, long defaultValue) { final Object val = query.getContextValue(key); return val == null ? defaultValue : Numbers.parseLong(val); }
public static <T> Query<T> withMaxScatterGatherBytes(Query<T> query, long maxScatterGatherBytesLimit) { Object obj = query.getContextValue(MAX_SCATTER_GATHER_BYTES_KEY); if (obj == null) { return query.withOverriddenContext(ImmutableMap.of(MAX_SCATTER_GATHER_BYTES_KEY, maxScatterGatherBytesLimit)); } else { long curr = ((Number) obj).longValue(); if (curr > maxScatterGatherBytesLimit) { throw new IAE( "configured [%s = %s] is more than enforced limit of [%s].", MAX_SCATTER_GATHER_BYTES_KEY, curr, maxScatterGatherBytesLimit ); } else { return query; } } }
final long timeoutAt = query.getContextValue(QUERY_FAIL_TIME); final long maxScatterGatherBytes = QueryContexts.getMaxScatterGatherBytes(query); final AtomicLong totalBytesGathered = (AtomicLong) context.get(QUERY_TOTAL_BYTES_GATHERED);
query.<String>getContextValue("postProcessing"), new TypeReference<PostProcessingOperator<T>>()
final boolean skipIncrementalSegment = query.getContextValue(CONTEXT_SKIP_INCREMENTAL_SEGMENT, false); final AtomicLong cpuTimeAccumulator = new AtomicLong(0L);