method2testcases
stringlengths
118
6.63k
### Question: ThreadsStatsCollector extends Thread implements AutoCloseable { public Integer getCpuTrailingAverage(long id, int seconds) { return cpuStat.getTrailingAverage(id, seconds); } ThreadsStatsCollector(Set<Long> slicingThreadIds); ThreadsStatsCollector(long collectionIntervalInMilliSeconds, Set<Long> slicingT...
### Question: MatchBitSet implements AutoCloseable { public void set(final int index) { final int wordNum = index >>> LONG_TO_BITS_SHIFT; final int bit = index & BIT_OFFSET_MUSK; final long bitMask = 1L << bit; final long wordAddr = bufferAddr + wordNum * BYTES_PER_WORD; PlatformDependent.putLong(wordAddr, PlatformDepe...
### Question: LBlockHashTableEight implements AutoCloseable { public Optional<BloomFilter> prepareBloomFilter(final boolean sizeDynamically) throws Exception { final long bloomFilterSize = sizeDynamically ? Math.min(BloomFilter.getOptimalSize(size()), BLOOMFILTER_MAX_SIZE) : BLOOMFILTER_MAX_SIZE; try (ArrowBuf keyHolde...
### Question: AbstractDataCollector implements DataCollector { @Override public synchronized void close() throws Exception { if(!closed){ final List<AutoCloseable> closeables = new ArrayList<>(); closeables.addAll(Arrays.asList(buffers)); closeables.add(new AutoCloseable() { @Override public void close() throws Excepti...
### Question: BoundedPivots { public static int pivot(PivotDef pivot, int start, int count, FixedBlockVector fixedBlock, VariableBlockVector variable) { if (pivot.getVariableCount() > 0) { int updatedCount = pivotVariableLengths(pivot.getVariablePivots(), fixedBlock, variable, start, count); Preconditions.checkState(up...
### Question: ScanOperator implements ProducerOperator { @Override public void workOnOOB(OutOfBandMessage message) { final ArrowBuf msgBuf = message.getBuffer(); final String senderInfo = String.format("Frag %d:%d, OpId %d", message.getSendingMajorFragmentId(), message.getSendingMinorFragmentId(), message.getSendingOpe...
### Question: RpcCompatibilityEncoder extends MessageToMessageEncoder<OutboundRpcMessage> { @Override protected void encode(ChannelHandlerContext context, OutboundRpcMessage message, List<Object> out) throws Exception { if (message.mode != RpcMode.RESPONSE_FAILURE) { out.add(message); return; } final MessageLite pBody ...
### Question: FragmentTracker implements AutoCloseable { public void populate(List<PlanFragmentFull> fragments, ResourceSchedulingDecisionInfo decisionInfo) { for (PlanFragmentFull fragment : fragments) { final NodeEndpoint assignment = fragment.getMinor().getAssignment(); pendingNodes.add(assignment); } executorSet = ...
### Question: RexToExpr { public static LogicalExpression toExpr(ParseContext context, RelDataType rowType, RexBuilder rexBuilder, RexNode expr) { return toExpr(context, rowType, rexBuilder, expr, true); } static LogicalExpression toExpr(ParseContext context, RelDataType rowType, RexBuilder rexBuilder, RexNode expr); ...
### Question: EndpointsIndex { public MinorFragmentEndpoint getFragmentEndpoint(MinorFragmentIndexEndpoint ep) { return fragmentsEndpointMap.computeIfAbsent(ep, k -> new MinorFragmentEndpoint(k.getMinorFragmentId(), endpoints.get(k.getEndpointIndex()))); } EndpointsIndex(List<NodeEndpoint> endpoints); EndpointsIndex()...
### Question: MinorDataReader { public ByteString readProtoEntry(OpProps props, String key) throws Exception { return attrsMap.getAttrValue(props, key); } MinorDataReader( FragmentHandle handle, MinorDataSerDe serDe, PlanFragmentsIndex index, MinorAttrsMap attrsMap); FragmentHandle getHandle(); MinorFra...
### Question: MaterializationList implements MaterializationProvider { @VisibleForTesting protected List<DremioMaterialization> build(final MaterializationDescriptorProvider provider) { final Set<String> exclusions = Sets.newHashSet(session.getSubstitutionSettings().getExclusions()); final Set<String> inclusions = Sets...
### Question: JSONElementLocator { public static JsonPath parsePath(String path) { if (path.startsWith(VALUE_PLACEHOLDER)) { return new JsonPath(path.substring(VALUE_PLACEHOLDER.length())); } throw new IllegalArgumentException(path + " must start with 'value'"); } JSONElementLocator(String text); static JsonPath parseP...
### Question: MetadataProviderConditions { public static Predicate<String> getTableTypePredicate(List<String> tableTypeFilter) { return tableTypeFilter.isEmpty() ? ALWAYS_TRUE : ImmutableSet.copyOf(tableTypeFilter)::contains; } private MetadataProviderConditions(); static Predicate<String> getTableTypePredicate(List<S...
### Question: MetadataProviderConditions { public static Predicate<String> getCatalogNamePredicate(LikeFilter filter) { if (filter == null || !filter.hasPattern() || SQL_LIKE_ANY_STRING_PATTERN.equals(filter.getPattern())) { return ALWAYS_TRUE; } final String patternString = RegexpUtil.sqlToRegexLike(filter.getPattern(...
### Question: MetadataProviderConditions { public static Optional<SearchQuery> createConjunctiveQuery( LikeFilter schemaNameFilter, LikeFilter tableNameFilter ) { final Optional<SearchQuery> schemaNameQuery = createLikeQuery(DatasetIndexKeys.UNQUOTED_SCHEMA.getIndexFieldName(), schemaNameFilter); final Optional<SearchQ...
### Question: SQLAnalyzerFactory { public static SQLAnalyzer createSQLAnalyzer(final String username, final SabotContext sabotContext, final List<String> context, final boolean createForSqlSuggestions, ProjectOptionManager projectOptionManager) { final ViewExpansionContext viewExpansionContext = new ViewExpansionContex...
### Question: SqlConverter { @VisibleForTesting static SqlNode parseSingleStatementImpl(String sql, ParserConfig parserConfig, boolean isInnerQuery) { SqlNodeList list = parseMultipleStatementsImpl(sql, parserConfig, isInnerQuery); if (list.size() > 1) { SqlParserPos pos = list.get(1).getParserPosition(); int col = pos...
### Question: SQLAnalyzer { public List<SqlMoniker> suggest(String sql, int cursorPosition) { SqlAdvisor sqlAdvisor = new SqlAdvisor(validator); String[] replaced = {null}; return sqlAdvisor.getCompletionHints(sql, cursorPosition , replaced); } protected SQLAnalyzer(final SqlValidatorWithHints validator); List<SqlMoni...
### Question: SQLAnalyzer { public List<SqlAdvisor.ValidateErrorInfo> validate(String sql) { SqlAdvisor sqlAdvisor = new SqlAdvisor(validator); return sqlAdvisor.validate(sql); } protected SQLAnalyzer(final SqlValidatorWithHints validator); List<SqlMoniker> suggest(String sql, int cursorPosition); List<SqlAdvisor.Vali...
### Question: SimpleLimitExchangeRemover { public static Prel apply(PlannerSettings settings, Prel input){ if(!settings.isTrivialSingularOptimized() || settings.isLeafLimitsEnabled()) { return input; } if(input.accept(new Identifier(), false)){ return input.accept(new AllExchangeRemover(), null); } return input; } sta...
### Question: PushLimitToPruneableScan extends Prule { @Override public boolean matches(RelOptRuleCall call) { return !((ScanPrelBase) call.rel(1)).hasFilter() && call.rel(1) instanceof PruneableScan; } private PushLimitToPruneableScan(); @Override boolean matches(RelOptRuleCall call); @Override void onMatch(RelOptRul...
### Question: KeyFairSliceCalculator { public int getTotalSize() { return totalSize; } KeyFairSliceCalculator(Map<String, Integer> originalKeySizes, int maxTotalSize); Integer getKeySlice(String key); int getTotalSize(); boolean keysTrimmed(); int numValidityBytes(); }### Answer: @Test public void testUnderflowSize() ...
### Question: GlobalDictionaryBuilder { public static String dictionaryFileName(String columnFullPath) { return format("_%s.%s", columnFullPath, DICTIONARY_FILES_EXTENSION); } static String dictionaryFileName(String columnFullPath); static String dictionaryFileName(ColumnDescriptor columnDescriptor); static Path dicti...
### Question: GlobalDictionaryBuilder { public static String getColumnFullPath(String dictionaryFileName) { final Matcher matcher = DICTIONARY_FILES_PATTERN.matcher(dictionaryFileName); if (matcher.find()) { return matcher.group(1); } return null; } static String dictionaryFileName(String columnFullPath); static Strin...
### Question: RuntimeFilterProbeTarget { public static List<RuntimeFilterProbeTarget> getProbeTargets(RuntimeFilterInfo runtimeFilterInfo) { final List<RuntimeFilterProbeTarget> targets = new ArrayList<>(); try { if (runtimeFilterInfo==null) { return targets; } for (RuntimeFilterEntry entry : runtimeFilterInfo.getParti...
### Question: BloomFilter implements AutoCloseable { public void setup() { checkNotNull(this.allocator, "Setup not required for deserialized objects."); this.dataBuffer = this.allocator.buffer(this.sizeInBytes + META_BYTES_CNT); setup(dataBuffer); dataBuffer.writerIndex(0); for (int i = 0; i < sizeInBytes; i += 8) { da...
### Question: BloomFilter implements AutoCloseable { public boolean isCrossingMaxFPP() { return getExpectedFPP() > (5 * FPP); } BloomFilter(BufferAllocator bufferAllocator, String name, long minSizeBytes); private BloomFilter(ArrowBuf dataBuffer); void setup(); String getName(); long getSizeInBytes(); static BloomFilt...
### Question: BloomFilter implements AutoCloseable { public static long getOptimalSize(long expectedInsertions) { checkArgument(expectedInsertions > 0); long optimalSize = (long) (-expectedInsertions * Math.log(FPP) / (Math.log(2) * Math.log(2))) / 8; optimalSize = ((optimalSize + 8) / 8) * 8; return optimalSize + META...
### Question: BloomFilter implements AutoCloseable { @Override public void close() { logger.debug("Closing bloomfilter {}'s data buffer. RefCount {}", this.name, dataBuffer.refCnt()); try { dataBuffer.close(); } catch (Exception e) { logger.error("Error while closing bloomfilter " + this.name, e); } } BloomFilter(Buffe...
### Question: StringFunctionUtil { public static int copyUtf8(ByteBuf in, final int start, final int end, ArrowBuf out) { int i = 0; int errBytes = 0; while (start + i < end) { byte b = in.getByte(start + i); if (b >= 0) { out.setByte(i - errBytes, b); i++; continue; } int seqLen = utf8CharLenNoThrow(in, start + i); if...
### Question: StringFunctionUtil { public static int copyReplaceUtf8(ByteBuf in, final int start, final int end, ByteBuf out, byte replacement) { int i = 0; while (start + i < end) { byte b = in.getByte(start + i); if (b >= 0) { out.setByte(i, b); i++; continue; } int seqLen = utf8CharLenNoThrow(in, start + i); if (seq...
### Question: IcebergPartitionData implements StructLike, Serializable { public void setInteger(int position, Integer value) { set(position, value); } IcebergPartitionData(Types.StructType partitionType); private IcebergPartitionData(IcebergPartitionData toCopy); Type getType(int pos); void clear(); @Override int size...
### Question: IcebergPartitionData implements StructLike, Serializable { public void setString(int position, String value) { set(position, value); } IcebergPartitionData(Types.StructType partitionType); private IcebergPartitionData(IcebergPartitionData toCopy); Type getType(int pos); void clear(); @Override int size()...
### Question: IcebergPartitionData implements StructLike, Serializable { public void setLong(int position, Long value) { set(position, value); } IcebergPartitionData(Types.StructType partitionType); private IcebergPartitionData(IcebergPartitionData toCopy); Type getType(int pos); void clear(); @Override int size(); @O...
### Question: IcebergPartitionData implements StructLike, Serializable { public void setBigDecimal(int position, BigDecimal value) { set(position, value); } IcebergPartitionData(Types.StructType partitionType); private IcebergPartitionData(IcebergPartitionData toCopy); Type getType(int pos); void clear(); @Override in...
### Question: IcebergPartitionData implements StructLike, Serializable { public void setFloat(int position, Float value) { set(position, value); } IcebergPartitionData(Types.StructType partitionType); private IcebergPartitionData(IcebergPartitionData toCopy); Type getType(int pos); void clear(); @Override int size(); ...
### Question: IcebergPartitionData implements StructLike, Serializable { public void setDouble(int position, Double value) { set(position, value); } IcebergPartitionData(Types.StructType partitionType); private IcebergPartitionData(IcebergPartitionData toCopy); Type getType(int pos); void clear(); @Override int size()...
### Question: IcebergPartitionData implements StructLike, Serializable { public void setBoolean(int position, Boolean value) { set(position, value); } IcebergPartitionData(Types.StructType partitionType); private IcebergPartitionData(IcebergPartitionData toCopy); Type getType(int pos); void clear(); @Override int size...
### Question: IcebergPartitionData implements StructLike, Serializable { public void setBytes(int position, byte[] value) { set(position, value); } IcebergPartitionData(Types.StructType partitionType); private IcebergPartitionData(IcebergPartitionData toCopy); Type getType(int pos); void clear(); @Override int size();...
### Question: IcebergFormatMatcher extends FormatMatcher { @Override public boolean matches(FileSystem fs, FileSelection fileSelection, CompressionCodecFactory codecFactory) throws IOException { Path rootDir = Path.of(fileSelection.getSelectionRoot()); Path metaDir = rootDir.resolve(METADATA_DIR_NAME); if (!fs.isDirect...
### Question: SchemaConverter { public BatchSchema fromIceberg(org.apache.iceberg.Schema icebergSchema) { return new BatchSchema(icebergSchema .columns() .stream() .map(SchemaConverter::fromIcebergColumn) .filter(Objects::nonNull) .collect(Collectors.toList())); } SchemaConverter(); BatchSchema fromIceberg(org.apache.i...
### Question: StoragePluginUtils { public static String generateSourceErrorMessage(final String storagePluginName, String errorMessage) { return String.format("Source '%s' returned error '%s'", storagePluginName, errorMessage); } private StoragePluginUtils(); static String generateSourceErrorMessage(final String stora...
### Question: StoragePluginUtils { public static UserException.Builder message(UserException.Builder builder, String sourceName, String errorMessage, Object... args) { return builder.message(generateSourceErrorMessage(sourceName, errorMessage), args) .addContext("plugin", sourceName); } private StoragePluginUtils(); s...
### Question: ManagedSchemaField { public boolean isTextField() { return isTextFieldType(type); } private ManagedSchemaField(final String name, final String type, final int length, final int scale, final boolean isUnbounded); static ManagedSchemaField newUnboundedLenField(final String name, final String type); static ...
### Question: ImpersonationUtil { public static UserGroupInformation createProxyUgi(String proxyUserName) { try { if (Strings.isNullOrEmpty(proxyUserName)) { throw new IllegalArgumentException("Invalid value for proxy user name"); } if (proxyUserName.equals(getProcessUserName()) || SYSTEM_USERNAME.equals(proxyUserName)...
### Question: FormatPluginOptionExtractor { @VisibleForTesting Collection<FormatPluginOptionsDescriptor> getOptions() { return optionsByTypeName.values(); } FormatPluginOptionExtractor(ScanResult scanResult); FormatPluginConfig createConfigForTable(TableInstance t); List<Function> getFunctions(final List<String> tableS...
### Question: EasyScanOperatorCreator implements ProducerOperator.Creator<EasySubScan> { static boolean selectsAllColumns(final BatchSchema datasetSchema, final List<SchemaPath> projectedColumns) { final Set<String> columnsInTable = FluentIterable.from(datasetSchema) .transform( new Function<Field, String>() { @Overrid...
### Question: DremioFileSystemCache { public FileSystem get(URI uri, Configuration conf, List<String> uniqueConnectionProps) throws IOException{ final Key key = new Key(uri, conf, uniqueConnectionProps); FileSystem fs; synchronized (this) { fs = map.get(key); } if (fs != null) { return fs; } final String disableCacheNa...
### Question: DataJsonOutput { public static final boolean isNumberAsString(DatabindContext context) { Object attr = context.getAttribute(DataJsonOutput.DREMIO_JOB_DATA_NUMBERS_AS_STRINGS_ATTRIBUTE); return attr instanceof Boolean && ((Boolean)attr).booleanValue(); } DataJsonOutput(JsonGenerator gen, boolean convertNum...
### Question: TimedRunnable implements Runnable { @Override public final void run() { long start = System.nanoTime(); threadStart=start; try{ value = runInner(); }catch(Exception e){ this.e = e; }finally{ timeNanos = System.nanoTime() - start; } } @Override final void run(); long getThreadStart(); long getTimeSpentNan...
### Question: QueryContext implements AutoCloseable, ResourceSchedulingContext, OptimizerRulesContext { public OptionManager getOptions() { return optionManager; } QueryContext( final UserSession session, final SabotContext sabotContext, QueryId queryId ); QueryContext( final UserSession sess...
### Question: OptionManagerWrapper extends BaseOptionManager { @Override public OptionList getNonDefaultOptions() { final OptionList optionList = new OptionList(); for (OptionManager optionManager : optionManagers) { OptionList nonDefaultOptions = optionManager.getNonDefaultOptions(); optionList.merge(nonDefaultOptions...
### Question: OptionManagerWrapper extends BaseOptionManager { @Override public OptionList getDefaultOptions() { final OptionList optionList = new OptionList(); for (OptionManager optionManager : optionManagers) { OptionList defaultOptions = optionManager.getDefaultOptions(); optionList.merge(defaultOptions); } return ...
### Question: OptionManagerWrapper extends BaseOptionManager { @Override public Iterator<OptionValue> iterator() { final OptionList resultList = new OptionList(); final Map<String, OptionValue> optionsMap = CaseInsensitiveMap.newHashMap(); final OptionList defaultOptions = getDefaultOptions(); defaultOptions.forEach(op...
### Question: TransformBase { public Transform wrap() { return acceptor.wrap(this); } final T accept(TransformVisitor<T> visitor); Transform wrap(); @Override String toString(); static TransformBase unwrap(Transform t); static Converter<TransformBase, Transform> converter(); static final Acceptor<TransformBase, Transf...
### Question: OptionValueProtoUtils { public static OptionValueProto toOptionValueProto(OptionValue optionValue) { checkArgument(optionValue.getType() == OptionValue.OptionType.SYSTEM, String.format("Invalid OptionType. OptionType must be 'SYSTEM', was given '%s'", optionValue.getType())); final OptionValue.Kind kind =...
### Question: OptionValueProtoUtils { public static OptionValue toOptionValue(OptionValueProto value) { switch (value.getOptionValCase()) { case NUM_VAL: return OptionValue.createLong( OptionValue.OptionType.SYSTEM, value.getName(), value.getNumVal() ); case STRING_VAL: return OptionValue.createString( OptionValue.Opti...
### Question: SystemOptionManager extends BaseOptionManager implements Service, ProjectOptionManager { @Override public OptionValue getOption(final String name) { final OptionValueProto value = getOptionProto(name); return value == null ? null : OptionValueProtoUtils.toOptionValue(value); } SystemOptionManager(OptionVa...
### Question: SystemOptionManager extends BaseOptionManager implements Service, ProjectOptionManager { @Override public boolean setOption(final OptionValue value) { checkArgument(value.getType() == OptionType.SYSTEM, "OptionType must be SYSTEM."); final String name = value.getName().toLowerCase(Locale.ROOT); final Opti...
### Question: TransformBase { public final <T> T accept(TransformVisitor<T> visitor) throws VisitorException { return acceptor.accept(visitor, this); } final T accept(TransformVisitor<T> visitor); Transform wrap(); @Override String toString(); static TransformBase unwrap(Transform t); static Converter<TransformBase, T...
### Question: SystemOptionManager extends BaseOptionManager implements Service, ProjectOptionManager { @Override public boolean deleteOption(final String rawName, OptionType type) { checkArgument(type == OptionType.SYSTEM, "OptionType must be SYSTEM."); final String name = rawName.toLowerCase(Locale.ROOT); optionValida...
### Question: SystemOptionManager extends BaseOptionManager implements Service, ProjectOptionManager { @Override public boolean deleteAllOptions(OptionType type) { checkArgument(type == OptionType.SYSTEM, "OptionType must be SYSTEM."); options.put(OPTIONS_KEY, OptionValueProtoList.newBuilder().build()); notifyListeners...
### Question: SystemOptionManager extends BaseOptionManager implements Service, ProjectOptionManager { @Override public OptionList getNonDefaultOptions() { final OptionList nonDefaultOptions = new OptionList(); getOptionProtoList().forEach( entry -> nonDefaultOptions.add(OptionValueProtoUtils.toOptionValue(entry)) ); r...
### Question: SystemOptionManager extends BaseOptionManager implements Service, ProjectOptionManager { @Override public Iterator<OptionValue> iterator() { return getOptionProtoList().stream() .map(OptionValueProtoUtils::toOptionValue) .iterator(); } SystemOptionManager(OptionValidatorListing optionValidatorListing, ...
### Question: SystemOptionManager extends BaseOptionManager implements Service, ProjectOptionManager { @Override public boolean isSet(String name){ return getOptionProto(name) != null; } SystemOptionManager(OptionValidatorListing optionValidatorListing, LogicalPlanPersistence lpPersistence,...
### Question: SystemOptionManager extends BaseOptionManager implements Service, ProjectOptionManager { @Override public boolean isValid(String name){ return optionValidatorListing.isValid(name); } SystemOptionManager(OptionValidatorListing optionValidatorListing, LogicalPlanPersistence lpPe...
### Question: EagerCachingOptionManager extends InMemoryOptionManager { @Override public double getOption(DoubleValidator validator) { return getOption(validator.getOptionName()).getFloatVal(); } EagerCachingOptionManager(OptionManager delegate); @Override boolean setOption(OptionValue value); @Override boolean deleteO...
### Question: EagerCachingOptionManager extends InMemoryOptionManager { @Override public boolean setOption(OptionValue value) { return super.setOption(value) && delegate.setOption(value); } EagerCachingOptionManager(OptionManager delegate); @Override boolean setOption(OptionValue value); @Override boolean deleteOption(...
### Question: EagerCachingOptionManager extends InMemoryOptionManager { @Override public boolean deleteOption(String name, OptionType type) { return super.deleteOption(name, type) && delegate.deleteOption(name, type); } EagerCachingOptionManager(OptionManager delegate); @Override boolean setOption(OptionValue value); @...
### Question: EagerCachingOptionManager extends InMemoryOptionManager { @Override public boolean deleteAllOptions(OptionType type) { return super.deleteAllOptions(type) && delegate.deleteAllOptions(type); } EagerCachingOptionManager(OptionManager delegate); @Override boolean setOption(OptionValue value); @Override bool...
### Question: FieldTransformationBase { public final <T> T accept(FieldTransformationVisitor<T> visitor) throws VisitorException { return acceptor.accept(visitor, this); } final T accept(FieldTransformationVisitor<T> visitor); FieldTransformation wrap(); @Override String toString(); static FieldTransformationBase unwr...
### Question: FSDataInputStreamWrapper extends FSInputStream { public static FSInputStream of(FSDataInputStream in) throws IOException { if (in.getWrappedStream() instanceof ByteBufferReadable) { return new FSDataInputStreamWrapper(in); } return new ByteArrayFSInputStream(in); } private FSDataInputStreamWrapper(FSData...
### Question: PermissionCheckCache { public boolean hasAccess(final String username, final NamespaceKey namespaceKey, final DatasetConfig config, final MetadataStatsCollector metadataStatsCollector, final SourceConfig sourceConfig) { final Stopwatch permissionCheck = Stopwatch.createStarted(); if (authTtlMs.get() == 0)...
### Question: ExpressionBase { public final <T> T accept(ExpressionVisitor<T> visitor) throws VisitorException { return acceptor.accept(visitor, this); } final T accept(ExpressionVisitor<T> visitor); Expression wrap(); @Override String toString(); static ExpressionBase unwrap(Expression t); static Converter<Expression...
### Question: NamespaceListing implements DatasetHandleListing { @VisibleForTesting Iterator<DatasetHandle> newIterator(Iterator<NamespaceKey> keyIterator) { return new TransformingIterator(keyIterator); } NamespaceListing( NamespaceService namespaceService, NamespaceKey sourceKey, SourceMetadata sour...
### Question: DayOfWeekFromSundayDateTimeField extends PreciseDurationDateTimeField { @Override public int get(long instant) { return map(chronology.dayOfWeek().get(instant)); } DayOfWeekFromSundayDateTimeField(Chronology chronology, DurationField days); @Override int get(long instant); @Override String getAsText(int f...
### Question: DayOfWeekFromSundayDateTimeField extends PreciseDurationDateTimeField { @Override public String getAsText(int fieldValue, Locale locale) { return chronology.dayOfWeek().getAsText(reverse(fieldValue), locale); } DayOfWeekFromSundayDateTimeField(Chronology chronology, DurationField days); @Override int get(...
### Question: DayOfWeekFromSundayDateTimeField extends PreciseDurationDateTimeField { @Override public String getAsShortText(int fieldValue, Locale locale) { return chronology.dayOfWeek().getAsShortText(reverse(fieldValue), locale); } DayOfWeekFromSundayDateTimeField(Chronology chronology, DurationField days); @Overrid...
### Question: ExtractListRecommender extends Recommender<ExtractListRule, Selection> { @Override public List<ExtractListRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.LIST, "Extract list items is supported only on LIST type columns"); JsonSelection jsonSelection; try { j...
### Question: MorePosixFilePermissions { public static Set<PosixFilePermission> fromOctalMode(int mode) { Preconditions.checkArgument(0 <= mode && mode <= MAX_MODE, "mode should be between 0 and 0777"); final Set<PosixFilePermission> result = EnumSet.noneOf(PosixFilePermission.class); int mask = 1 << (PERMISSIONS_LENGT...
### Question: Path implements Comparable<Path> { public static Path of(URI uri) { return new Path(uri); } private Path(URI uri); static Path of(URI uri); static Path of(String path); static Path mergePaths(Path path1, Path path2); static Path withoutSchemeAndAuthority(Path path); String getName(); Path getParent(); Pa...
### Question: Path implements Comparable<Path> { public static Path mergePaths(Path path1, Path path2) { final String path1Path = path1.uri.getPath(); final String path2Path = path2.uri.getPath(); if (path2Path.isEmpty()) { return path1; } final StringBuilder finalPath = new StringBuilder(path1Path.length() + path2Path...
### Question: Path implements Comparable<Path> { public String getName() { final String path = uri.getPath(); int index = path.lastIndexOf(SEPARATOR_CHAR); return path.substring(index + 1); } private Path(URI uri); static Path of(URI uri); static Path of(String path); static Path mergePaths(Path path1, Path path2); st...
### Question: Path implements Comparable<Path> { public boolean isAbsolute() { return uri.getPath().startsWith(SEPARATOR); } private Path(URI uri); static Path of(URI uri); static Path of(String path); static Path mergePaths(Path path1, Path path2); static Path withoutSchemeAndAuthority(Path path); String getName(); P...
### Question: Path implements Comparable<Path> { public int depth() { final String path = uri.getPath(); if (path.charAt(0) == SEPARATOR_CHAR && path.length() == 1) { return 0; } int depth = 0; for (int i = 0 ; i < path.length(); i++) { if (path.charAt(i) == SEPARATOR_CHAR) { depth++; } } return depth; } private Path(...
### Question: ServiceRegistry implements Service { public <T extends Service> T replace(@Nullable T service) { if (service == null) { return null; } final Service toReplace = wrapService(service); for(ListIterator<Service> it = services.listIterator(); it.hasNext(); ) { Service s = it.next(); if (toReplace.equals(s)) {...
### Question: DremioFutures { public static <T, X extends Exception> T getChecked( Future<T> future, Class<X> exceptionClass, Function<? super Throwable, ? extends X> mapper ) throws X { try { return Futures.getChecked(future, ExecutionException.class); } catch (ExecutionException e) { try { handleException(e, exceptio...
### Question: DremioVersionUtils { public static Collection<NodeEndpoint> getCompatibleNodeEndpoints(Collection<NodeEndpoint> nodeEndpoints) { List<NodeEndpoint> compatibleNodeEndpoints = new ArrayList<>(); if (nodeEndpoints != null && !nodeEndpoints.isEmpty()) { compatibleNodeEndpoints = nodeEndpoints.stream() .filter...
### Question: BackwardCompatibleSchemaDe extends StdDeserializer<Schema> { public static Schema fromJSON(String json) throws IOException { return mapper.readValue(checkNotNull(json), Schema.class); } protected BackwardCompatibleSchemaDe(); protected BackwardCompatibleSchemaDe(Class<?> vc); static Schema fromJSON(Stri...
### Question: JsonAdditionalExceptionContext implements AdditionalExceptionContext { protected static <T extends AdditionalExceptionContext> T fromUserException(Class<T> clazz, UserException ex) { if (ex.getRawAdditionalExceptionContext() == null) { logger.debug("missing additional context in UserException"); return nu...
### Question: AutoCloseables { public static void close(Throwable t, AutoCloseable... autoCloseables) { close(t, Arrays.asList(autoCloseables)); } private AutoCloseables(); static AutoCloseable all(final Collection<? extends AutoCloseable> autoCloseables); static void close(Throwable t, AutoCloseable... autoCloseables...
### Question: ReplaceRecommender extends Recommender<ReplacePatternRule, Selection> { public static ReplaceMatcher getMatcher(ReplacePatternRule rule) { final String pattern = rule.getSelectionPattern(); ReplaceSelectionType selectionType = rule.getSelectionType(); if (rule.getIgnoreCase() != null && rule.getIgnoreCase...
### Question: TracingUtils { public static <R> R trace(Function<Span, R> work, Tracer tracer, String operation, String... tags) { Span span = TracingUtils.buildChildSpan(tracer, operation, tags); try (Scope s = tracer.activateSpan(span)) { return work.apply(span); } finally { span.finish(); } } private TracingUtils();...
### Question: ContextMigratingExecutorService implements ExecutorService { @Override public <T> Future<T> submit(Callable<T> task) { return delegate.submit(decorate(task)); } ContextMigratingExecutorService(E delegate, Tracer tracer); @Override void shutdown(); @Override List<Runnable> shutdownNow(); @Override boolean ...
### Question: GuiceServiceModule extends AbstractModule { public void close(Injector injector) throws Exception { serviceList.forEach((clazz) -> { final Object instance = injector.getInstance(clazz); if (instance instanceof Service) { try { logger.debug("stopping {}", instance.getClass().toString()); ((Service) instanc...
### Question: BlackListOutput implements Output { @Override public void writeInt32(int fieldNumber, int value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeInt32(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, int[]...
### Question: BlackListOutput implements Output { @Override public void writeUInt32(int fieldNumber, int value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeUInt32(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, int...
### Question: BlackListOutput implements Output { @Override public void writeSInt32(int fieldNumber, int value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeSInt32(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, int...
### Question: BlackListOutput implements Output { @Override public void writeFixed32(int fieldNumber, int value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeFixed32(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, i...