method2testcases
stringlengths
118
6.63k
### Question: BlackListOutput implements Output { @Override public void writeSFixed32(int fieldNumber, int value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeSFixed32(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String,...
### Question: BlackListOutput implements Output { @Override public void writeInt64(int fieldNumber, long value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeInt64(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, int[...
### Question: BlackListOutput implements Output { @Override public void writeUInt64(int fieldNumber, long value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeUInt64(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, in...
### Question: BlackListOutput implements Output { @Override public void writeSInt64(int fieldNumber, long value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeSInt64(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, in...
### Question: BlackListOutput implements Output { @Override public void writeFixed64(int fieldNumber, long value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeFixed64(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, ...
### Question: BlackListOutput implements Output { @Override public void writeSFixed64(int fieldNumber, long value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeSFixed64(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String...
### Question: BlackListOutput implements Output { @Override public void writeFloat(int fieldNumber, float value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeFloat(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, int...
### Question: BlackListOutput implements Output { @Override public void writeDouble(int fieldNumber, double value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeDouble(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, ...
### Question: BlackListOutput implements Output { @Override public void writeBool(int fieldNumber, boolean value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeBool(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, int...
### Question: BlackListOutput implements Output { @Override public void writeEnum(int fieldNumber, int value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeEnum(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, int[]> ...
### Question: BlackListOutput implements Output { @Override public void writeString(int fieldNumber, String value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeString(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String, ...
### Question: BlackListOutput implements Output { @Override public void writeBytes(int fieldNumber, ByteString value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeBytes(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<String...
### Question: BlackListOutput implements Output { @Override public void writeByteArray(int fieldNumber, byte[] value, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeByteArray(fieldNumber, value, repeated); } @VisibleForTesting BlackListOutput( Output delegate, Map<St...
### Question: BlackListOutput implements Output { @Override public void writeByteRange(boolean utf8String, int fieldNumber, byte[] value, int offset, int length, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } delegate.writeByteRange(utf8String, fieldNumber, value, offset, length, repea...
### Question: BlackListOutput implements Output { @Override public <T> void writeObject(int fieldNumber, T value, Schema<T> schema, boolean repeated) throws IOException { if(isBlackListed(fieldNumber)){ return; } int[] parentBlackList = currentBlackList; try { String messageFullName = schema.messageFullName(); currentB...
### Question: HasherOutput implements Output { public Hasher getHasher() { return hasher; } HasherOutput(Hasher hasher); HasherOutput(); @Override void writeInt32(int fieldNumber, int value, boolean repeated); @Override void writeUInt32(int fieldNumber, int value, boolean repeated); @Override void writeSInt32(int fiel...
### Question: UUIDAdapter { public static byte[] getBytesFromUUID(UUID uuid) { byte[] result = new byte[16]; long msb = uuid.getMostSignificantBits(); long lsb = uuid.getLeastSignificantBits(); for (int i =15;i>=8;i--) { result[i] = (byte) (lsb & 0xFF); lsb >>= 8; } for (int i =7;i>=0;i--) { result[i] = (byte) (msb & 0...
### Question: SqlUtils { public static boolean isKeyword(String id) { Preconditions.checkState(RESERVED_SQL_KEYWORDS != null, "SQL reserved keyword list is not loaded. Please check the logs for error messages."); return RESERVED_SQL_KEYWORDS.contains(id.toUpperCase()); } static String quotedCompound(List<String> strin...
### Question: SqlUtils { public static String quoteIdentifier(final String id) { if (id.isEmpty()) { return id; } if (isKeyword(id)) { return quoteString(id); } if (Character.isAlphabetic(id.charAt(0)) && ALPHANUM_MATCHER.matchesAllOf(id)) { return id; } if (NEWLINE_MATCHER.matchesAnyOf(id)) { return quoteUnicodeString...
### Question: SqlUtils { public static List<String> parseSchemaPath(String schemaPath) { return new StrTokenizer(schemaPath, '.', SqlUtils.QUOTE) .setIgnoreEmptyTokens(true) .getTokenList(); } static String quotedCompound(List<String> strings); static String quoteIdentifier(final String id); static boolean isKeyword(S...
### Question: OptimisticByteOutput extends ByteOutput { @Override public void write(byte value) { checkArray(); arrayReference[arrayOffset++] = value; } OptimisticByteOutput(int payloadSize); @Override void write(byte value); @Override void write(byte[] value, int offset, int length); @Override void writeLazy(byte[] va...
### Question: OptimisticByteOutput extends ByteOutput { public byte[] toByteArray() { if (payloadSize == 0) { return arrayReference != null ? arrayReference : EMPTY; } Preconditions.checkState(arrayOffset == payloadSize, "Byte payload not fully received."); return arrayReference; } OptimisticByteOutput(int payloadSize)...
### Question: PathUtils { public static List<String> toPathComponents(String fsPath) { if (fsPath == null ) { return EMPTY_SCHEMA_PATHS; } final StrTokenizer tokenizer = new StrTokenizer(fsPath, SLASH_CHAR, SqlUtils.QUOTE).setIgnoreEmptyTokens(true); return tokenizer.getTokenList(); } static Path toFSPath(final List<S...
### Question: PathUtils { public static String toDottedPath(Path fsPath) { return constructFullPath(toPathComponents(fsPath)); } static Path toFSPath(final List<String> schemaPath); static String toFSPathString(final List<String> schemaPath); static Path toFSPathSkipRoot(final List<String> schemaPath, final String roo...
### Question: PathUtils { public static Path toFSPath(final List<String> schemaPath) { if (schemaPath == null || schemaPath.isEmpty()) { return ROOT_PATH; } return ROOT_PATH.resolve(PATH_JOINER.join(schemaPath)); } static Path toFSPath(final List<String> schemaPath); static String toFSPathString(final List<String> sch...
### Question: PathUtils { public static Path toFSPathSkipRoot(final List<String> schemaPath, final String root) { if (schemaPath == null || schemaPath.isEmpty()) { return ROOT_PATH; } if (root == null || !root.equals(schemaPath.get(0))) { return toFSPath(schemaPath); } else { return toFSPath(schemaPath.subList(1, schem...
### Question: PathUtils { public static String relativePath(Path absolutePath, Path basePath) { Preconditions.checkArgument(absolutePath.isAbsolute(), "absolutePath must be an absolute path"); Preconditions.checkArgument(basePath.isAbsolute(), "basePath must be an absolute path"); List<String> absolutePathComponents = ...
### Question: PathUtils { public static String removeLeadingSlash(String path) { if (path.length() > 0 && path.charAt(0) == '/') { String newPath = path.substring(1); return removeLeadingSlash(newPath); } else { return path; } } static Path toFSPath(final List<String> schemaPath); static String toFSPathString(final Li...
### Question: PathUtils { public static void verifyNoAccessOutsideBase(Path basePath, Path givenPath) { if (!checkNoAccessOutsideBase(basePath, givenPath)) { throw UserException.permissionError() .message("Not allowed to access files outside of the source root") .addContext("Source root", Path.withoutSchemeAndAuthority...
### Question: LocalValue { public void set(T value) { Preconditions.checkNotNull(value, "LocalValue cannot be set to null"); doSet(value); } LocalValue(); @SuppressWarnings("unchecked") Optional<T> get(); void set(T value); void clear(); static LocalValues save(); static void restore(LocalValues localValues); }### Ans...
### Question: LocalValue { public void clear() { doSet(null); } LocalValue(); @SuppressWarnings("unchecked") Optional<T> get(); void set(T value); void clear(); static LocalValues save(); static void restore(LocalValues localValues); }### Answer: @Test public void testClear() { stringLocalValue.set("value1"); intLocal...
### Question: VM { private static final long maxDirectMemory() { try { return invokeMaxDirectMemory("sun.misc.VM"); } catch (ReflectiveOperationException ignored) { } try { return invokeMaxDirectMemory("jdk.internal.misc.VM"); } catch (ReflectiveOperationException ignored) { } final List<String> inputArguments = Manage...
### Question: VM { public static boolean isDebugEnabled() { return IS_DEBUG; } private VM(); static boolean isDebugEnabled(); static int availableProcessors(); static long getMaxDirectMemory(); static long getMaxHeapMemory(); static boolean isMacOSHost(); static boolean isWindowsHost(); static final String DREMIO_CPU_...
### Question: TimeMilliAccessor extends AbstractSqlAccessor { @Override public boolean isNull(int index) { return ac.isNull(index); } TimeMilliAccessor(TimeMilliVector vector, TimeZone defaultTZ); @Override MajorType getType(); @Override boolean isNull(int index); @Override Class<?> getObjectClass(); @Override Object g...
### Question: TimeMilliAccessor extends AbstractSqlAccessor { @Override public Object getObject(int index) { return getTime(index, defaultTimeZone); } TimeMilliAccessor(TimeMilliVector vector, TimeZone defaultTZ); @Override MajorType getType(); @Override boolean isNull(int index); @Override Class<?> getObjectClass(); @...
### Question: TimeMilliAccessor extends AbstractSqlAccessor { @Override public Time getTime(int index, Calendar calendar) { Preconditions.checkNotNull(calendar, "Invalid calendar used when attempting to retrieve time."); return getTime(index, calendar.getTimeZone()); } TimeMilliAccessor(TimeMilliVector vector, TimeZone...
### Question: DateMilliAccessor extends AbstractSqlAccessor { @Override public boolean isNull(int index) { return ac.isNull(index); } DateMilliAccessor(DateMilliVector vector, TimeZone defaultTZ); @Override MajorType getType(); @Override boolean isNull(int index); @Override Class<?> getObjectClass(); @Override Object g...
### Question: DateMilliAccessor extends AbstractSqlAccessor { @Override public Object getObject(int index) { return getDate(index, defaultTimeZone); } DateMilliAccessor(DateMilliVector vector, TimeZone defaultTZ); @Override MajorType getType(); @Override boolean isNull(int index); @Override Class<?> getObjectClass(); @...
### Question: DateMilliAccessor extends AbstractSqlAccessor { @Override public Date getDate(int index, Calendar calendar) { Preconditions.checkNotNull(calendar, "Invalid calendar used when attempting to retrieve date."); return getDate(index, calendar.getTimeZone()); } DateMilliAccessor(DateMilliVector vector, TimeZone...
### Question: GenericAccessor extends AbstractSqlAccessor { @Override public boolean isNull(int index) { return v.isNull(index); } GenericAccessor(ValueVector v); @Override Class<?> getObjectClass(); @Override boolean isNull(int index); @Override Object getObject(int index); @Override MajorType getType(); }### Answer:...
### Question: GenericAccessor extends AbstractSqlAccessor { @Override public Object getObject(int index) throws InvalidAccessException { return v.getObject(index); } GenericAccessor(ValueVector v); @Override Class<?> getObjectClass(); @Override boolean isNull(int index); @Override Object getObject(int index); @Override...
### Question: GenericAccessor extends AbstractSqlAccessor { @Override public MajorType getType() { return getMajorTypeForField(v.getField()); } GenericAccessor(ValueVector v); @Override Class<?> getObjectClass(); @Override boolean isNull(int index); @Override Object getObject(int index); @Override MajorType getType(); ...
### Question: TimeStampMilliAccessor extends AbstractSqlAccessor { @Override public boolean isNull(int index) { return ac.isNull(index); } TimeStampMilliAccessor(TimeStampMilliVector vector, TimeZone defaultTZ); @Override MajorType getType(); @Override boolean isNull(int index); @Override Class<?> getObjectClass(); @Ov...
### Question: TimeStampMilliAccessor extends AbstractSqlAccessor { @Override public Object getObject(int index) { return getTimestamp(index, defaultTimeZone); } TimeStampMilliAccessor(TimeStampMilliVector vector, TimeZone defaultTZ); @Override MajorType getType(); @Override boolean isNull(int index); @Override Class<?>...
### Question: TimeStampMilliAccessor extends AbstractSqlAccessor { @Override public Timestamp getTimestamp(int index, Calendar calendar) { Preconditions.checkNotNull(calendar, "Invalid calendar used when attempting to retrieve timestamp."); return getTimestamp(index, calendar.getTimeZone()); } TimeStampMilliAccessor(Ti...
### Question: Upgrade { @VisibleForTesting public void validateUpgrade(final LegacyKVStoreProvider storeProvider, final String curEdition) throws Exception { if (!getDACConfig().isMigrationEnabled()) { final ConfigurationStore configurationStore = new ConfigurationStore(storeProvider); final ConfigurationEntry entry = ...
### Question: TypeConvertingSqlAccessor implements SqlAccessor { @Override public float getFloat( int rowOffset ) throws InvalidAccessException { final float result; switch ( getType().getMinorType() ) { case FLOAT4: result = innerAccessor.getFloat( rowOffset ); break; case INT: result = innerAccessor.getInt( rowOffset...
### Question: TypeConvertingSqlAccessor implements SqlAccessor { @Override public double getDouble( int rowOffset ) throws InvalidAccessException { final double result; switch ( getType().getMinorType() ) { case FLOAT8: result = innerAccessor.getDouble( rowOffset ); break; case INT: result = innerAccessor.getInt( rowOf...
### Question: DictionaryBuilder { public Iterable<T> build() { Preconditions.checkArgument(!isBuilt, "build can only be called once"); isBuilt = true; if (valueAccumulator.isEmpty()) { return Collections.emptyList(); } final T[] values = ObjectArrays.newArray(clazzType, valueAccumulator.size()); for (ObjectIntCursor<T>...
### Question: HiveReaderProtoUtil { @Deprecated static Map<String, Integer> buildInputFormatLookup(HiveTableXattrOrBuilder tableXattr) { int i = 0; final Map<String, Integer> lookup = Maps.newHashMap(); for (final PartitionXattr partitionXattr : tableXattr.getPartitionXattrsList()) { if (partitionXattr.hasInputFormat()...
### Question: DremioFileSystem extends FileSystem { void updateOAuthConfig(Configuration conf, String accountName, String accountNameWithoutSuffix) { final String CLIENT_ID = "dremio.azure.clientId"; final String TOKEN_ENDPOINT = "dremio.azure.tokenEndpoint"; final String CLIENT_SECRET = "dremio.azure.clientSecret"; St...
### Question: HiveScanBatchCreator implements HiveProxiedScanBatchCreator { @VisibleForTesting public UserGroupInformation getUGI(HiveStoragePlugin storagePlugin, HiveProxyingSubScan config) { final String userName = storagePlugin.getUsername(config.getProps().getUserName()); return HiveImpersonationUtil.createProxyUgi...
### Question: HiveScanBatchCreator implements HiveProxiedScanBatchCreator { boolean allSplitsAreOnS3(List<SplitAndPartitionInfo> splits) { for (SplitAndPartitionInfo split : splits) { try { final HiveReaderProto.HiveSplitXattr splitAttr = HiveReaderProto.HiveSplitXattr.parseFrom(split.getDatasetSplitInfo().getExtendedP...
### Question: HiveStoragePlugin extends BaseHiveStoragePlugin implements StoragePluginCreator.PF4JStoragePlugin, SupportsReadSignature, SupportsListingDatasets, SupportsAlteringDatasetMetadata, SupportsPF4JStoragePlugin { public String getUsername(String name) { if (isStorageImpersonationEnabled()) { return name; }...
### Question: S3FileSystem extends ContainerFileSystem implements MayProvideAsyncStream { static software.amazon.awssdk.regions.Region getAwsRegionFromEndpoint(String endpoint) { return Optional.ofNullable(endpoint) .map(e -> e.toLowerCase(Locale.ROOT)) .filter(e -> e.endsWith(S3_ENDPOINT_END) || e.endsWith(S3_CN_ENDPO...
### Question: S3FileSystem extends ContainerFileSystem implements MayProvideAsyncStream { @Override protected ContainerHolder getUnknownContainer(String containerName) throws IOException { boolean containerFound = false; try { if (s3.doesBucketExistV2(containerName)) { final ListObjectsV2Request req = new ListObjectsV2...
### Question: SplitRecommender extends Recommender<SplitRule, Selection> { @Override public List<SplitRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Split is supported only on TEXT type columns"); List<SplitRule> rules = new ArrayList<>(); String seltext = selecti...
### Question: S3FileSystem extends ContainerFileSystem implements MayProvideAsyncStream { protected void verifyCredentials(Configuration conf) throws RuntimeException { AwsCredentialsProvider awsCredentialsProvider = getAsync2Provider(conf); final StsClientBuilder stsClientBuilder = StsClient.builder() .credentialsProv...
### Question: ContainerFileSystem extends FileSystem { @VisibleForTesting static Path transform(Path path, String containerName) { final String relativePath = removeLeadingSlash(Path.getPathWithoutSchemeAndAuthority(path).toString()); final Path containerPath = new Path(Path.SEPARATOR + containerName); return Strings.i...
### Question: AzureAsyncReader extends ExponentialBackoff implements AutoCloseable, AsyncByteReader { @Override public CompletableFuture<Void> readFully(long offset, ByteBuf dst, int dstOffset, int len) { return read(offset, dst, dstOffset, len, 0); } AzureAsyncReader(final String accountName, ...
### Question: AsyncHttpClientProvider { public static AsyncHttpClient getInstance(){ return SingletonHelper.INSTANCE; } static AsyncHttpClient getInstance(); static final int DEFAULT_REQUEST_TIMEOUT; }### Answer: @Test public void testSameInstance() throws InterruptedException { ExecutorService ex = Executors.newFixed...
### Question: AzureSharedKeyAuthTokenProvider implements AzureAuthTokenProvider { @Override public String getAuthzHeaderValue(final Request req) { try { final URL url = new URL(req.getUrl()); final Map<String, String> headersMap = new HashMap<>(); req.getHeaders().forEach(header -> headersMap.put(header.getKey(), heade...
### Question: AzureSharedKeyAuthTokenProvider implements AzureAuthTokenProvider { @Override public boolean checkAndUpdateToken() { return false; } AzureSharedKeyAuthTokenProvider(final String accountName, final String key); @Override boolean checkAndUpdateToken(); @Override String getAuthzHeaderValue(final Request req)...
### Question: AzureSharedKeyAuthTokenProvider implements AzureAuthTokenProvider { @Override public boolean isCloseToExpiry() { return false; } AzureSharedKeyAuthTokenProvider(final String accountName, final String key); @Override boolean checkAndUpdateToken(); @Override String getAuthzHeaderValue(final Request req); @O...
### Question: RemoteNodeFileSystem extends FileSystem { static DFS.FileStatus toProtoFileStatus(FileStatus status) throws IOException { DFS.FileStatus.Builder builder = DFS.FileStatus.newBuilder(); builder .setLength(status.getLen()) .setIsDirectory(status.isDirectory()) .setBlockReplication(status.getReplication()) .s...
### Question: RemoteNodeFileSystem extends FileSystem { @Override public boolean delete(Path f, boolean recursive) throws IOException { Path absolutePath = toAbsolutePath(f); checkPath(absolutePath); final DeleteCommand command = new DeleteCommand(absolutePath.toUri().getPath(), recursive); runner.runCommand(command); ...
### Question: RemoteNodeFileSystem extends FileSystem { @Override public boolean mkdirs(Path f, FsPermission permission) throws IOException { Path absolutePath = toAbsolutePath(f); checkPath(absolutePath); final MkdirsCommand command = new MkdirsCommand( absolutePath.toUri().getPath(), permission != null ? (int) permis...
### Question: RemoteNodeFileSystem extends FileSystem { @Override public boolean rename(Path src, Path dst) throws IOException { Path absoluteSrc = toAbsolutePath(src); Path absoluteDst = toAbsolutePath(dst); checkPath(absoluteSrc); checkPath(absoluteDst); final RenameCommand command = new RenameCommand(absoluteSrc.toU...
### Question: RemoteNodeFileSystem extends FileSystem { @Override public FSDataInputStream open(Path f, int bufferSize) throws IOException { Path absolutePath = toAbsolutePath(f); checkPath(absolutePath); final String path = absolutePath.toUri().getPath(); return new FSDataInputStream(new RemoteNodeInputStream(path, bu...
### Question: DatasetTool { History getHistory(final DatasetPath datasetPath, DatasetVersion currentDataset) throws DatasetVersionNotFoundException { return getHistory(datasetPath, currentDataset, currentDataset); } DatasetTool( DatasetVersionMutator datasetService, JobsService jobsService, QueryExecutor ex...
### Question: PseudoDistributedFileSystem extends FileSystem implements PathCanonicalizer { @Override public RemoteIterator<FileStatus> listStatusIterator(Path f) throws FileNotFoundException, IOException { final Path absolutePath = toAbsolutePath(f); checkPath(absolutePath); if (isRemoteFile(absolutePath)) { return ne...
### Question: PseudoDistributedFileSystem extends FileSystem implements PathCanonicalizer { @Override public FSDataInputStream open(Path f, int bufferSize) throws IOException { Path absolutePath = toAbsolutePath(f); checkPath(absolutePath); if (absolutePath.isRoot()) { throw new AccessControlException("Cannot open " + ...
### Question: Transformer { public VirtualDatasetUI transformWithExtract(DatasetVersion newVersion, DatasetPath path, VirtualDatasetUI baseDataset, TransformBase transform) throws DatasetNotFoundException, NamespaceException{ final ExtractTransformActor actor = new ExtractTransformActor(baseDataset.getState(), false, u...
### Question: PseudoDistributedFileSystem extends FileSystem implements PathCanonicalizer { @Override public FSDataOutputStream create(Path f, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException { final Path absolutePath = toAbsolutePa...
### Question: PseudoDistributedFileSystem extends FileSystem implements PathCanonicalizer { @Override public FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException { Path absolutePath = toAbsolutePath(f); checkPath(absolutePath); if (absolutePath.isRoot()) { throw new AccessControlE...
### Question: PseudoDistributedFileSystem extends FileSystem implements PathCanonicalizer { @Override public boolean delete(Path f, boolean recursive) throws IOException { Path absolutePath = toAbsolutePath(f); checkPath(absolutePath); if (absolutePath.isRoot()) { throw new AccessControlException("Cannot delete " + f);...
### Question: SQLGenerator { public static String generateSQL(VirtualDatasetState vss){ return new SQLGenerator().innerGenerateSQL(vss); } SQLGenerator(); static String generateSQL(VirtualDatasetState vss); static String getTableAlias(From from); }### Answer: @Test public void testReplaceInvalidReplacedValues() { bool...
### Question: PseudoDistributedFileSystem extends FileSystem implements PathCanonicalizer { @Override public boolean mkdirs(Path f, FsPermission permission) throws IOException { Path absolutePath = toAbsolutePath(f); checkPath(absolutePath); if (absolutePath.isRoot()) { return true; } if (isRemoteFile(absolutePath)) { ...
### Question: PseudoDistributedFileSystem extends FileSystem implements PathCanonicalizer { @Override public Path canonicalizePath(Path p) throws IOException { Path absolutePath = toAbsolutePath(p); checkPath(absolutePath); if (isRemoteFile(absolutePath)) { return absolutePath; } if (isDirectory(absolutePath)) { return...
### Question: Hive3StoragePlugin extends BaseHiveStoragePlugin implements StoragePluginCreator.PF4JStoragePlugin, SupportsReadSignature, SupportsListingDatasets, SupportsAlteringDatasetMetadata, SupportsPF4JStoragePlugin { public String getUsername(String name) { if (isStorageImpersonationEnabled()) { return name; ...
### Question: HiveScanBatchCreator implements HiveProxiedScanBatchCreator { @VisibleForTesting public UserGroupInformation getUGI(Hive3StoragePlugin storagePlugin, HiveProxyingSubScan config) { final String userName = storagePlugin.getUsername(config.getProps().getUserName()); return HiveImpersonationUtil.createProxyUg...
### Question: NativeLibPluginManager extends DefaultPluginManager { @Override protected Path createPluginsRoot() { final Path pluginsPath = this.isDevelopment() ? Paths.get(PLUGINS_PATH_DEV_MODE) : DremioConfig.getPluginsRootPath().resolve("connectors"); return pluginsPath; } }### Answer: @Test public void testShoul...
### Question: HistogramGenerator { @VisibleForTesting static void produceRanges(List<Number> ranges, LocalDateTime min, LocalDateTime max, TruncEvalEnum truncateTo) { long timeValue = toMillis(roundTime(min, truncateTo, true)); long maxTimeValue = toMillis(roundTime(max, truncateTo, false)); ranges.add(timeValue); whil...
### Question: ExtractMapRecommender extends Recommender<ExtractMapRule, MapSelection> { @Override public List<ExtractMapRule> getRules(MapSelection selection, DataType selColType) { checkArgument(selColType == DataType.MAP, "Extract map entries is supported only on MAP type columns"); return Collections.singletonList(n...
### Question: YarnController { public YarnController() { this(DremioConfig.create()); } YarnController(); YarnController(DremioConfig config); TwillRunnerService getTwillService(ClusterId key); void invalidateTwillService(final ClusterId key); TwillRunnerService startTwillRunner(YarnConfiguration yarnConfiguration); T...
### Question: ExtractMapRecommender extends Recommender<ExtractMapRule, MapSelection> { @Override public TransformRuleWrapper<ExtractMapRule> wrapRule(ExtractMapRule rule) { return new ExtractMapTransformRuleWrapper(rule); } @Override List<ExtractMapRule> getRules(MapSelection selection, DataType selColType); @Overrid...
### Question: YarnService implements ProvisioningServiceDelegate { @Override public void stopCluster(Cluster cluster) throws YarnProvisioningHandlingException { stopClusterAsync(cluster); } YarnService(DremioConfig config, ProvisioningStateListener stateListener, NodeProvider executionNodeProvider, ...
### Question: AppBundleGenerator { @VisibleForTesting static Stream<Path> toPathStream(ClassLoader classLoader) { if (classLoader == null) { return Stream.of(); } if (classLoader != ClassLoader.getSystemClassLoader()) { return Stream.concat(toPathStream(classLoader.getParent()), getPaths(classLoader)); } else { return ...
### Question: CardGenerator { <T> String generateCardGenQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName)); L...
### Question: YarnContainerHealthMonitor implements LiveHealthMonitor { @Override public boolean isHealthy() { return isHealthy; } YarnContainerHealthMonitor(); @Override boolean isHealthy(); }### Answer: @Test public void testUnavailableContainer() throws Exception { when(connection.getResponseCode()).thenReturn(Http...
### Question: CardGenerator { <T> String generateMatchCountQuery(String inputColName, String datasetPreviewTable, List<TransformRuleWrapper<T>> evaluators) { StringBuilder queryBuilder = new StringBuilder(); String inputExpr = String.format("%s.%s", quoteIdentifier("dremio_preview_data"), quoteIdentifier(inputColName))...
### Question: ExtractRecommender extends Recommender<ExtractRule, Selection> { @Override public List<ExtractRule> getRules(Selection selection, DataType selColType) { checkArgument(selColType == DataType.TEXT, "Extract text is supported only on TEXT type columns"); if (selection.getLength() <= 0) { throw UserException....
### Question: ExtractRecommender extends Recommender<ExtractRule, Selection> { List<ExtractRule> recommendCharacterGroup(Selection selection) { List<ExtractRule> rules = new ArrayList<>(); String cellText = selection.getCellText(); int start = selection.getOffset(); int end = start + selection.getLength(); String selec...
### Question: PowerBIMessageBodyGenerator extends BaseBIToolMessageBodyGenerator { @VisibleForTesting static DSRFile createDSRFile(String hostname, DatasetConfig datasetConfig) { final DSRConnectionInfo connInfo = new DSRConnectionInfo(); connInfo.server = hostname; final DatasetPath dataset = new DatasetPath(datasetCo...
### Question: BaseBIToolResource { @VisibleForTesting Response.ResponseBuilder buildResponseWithHost(Response.ResponseBuilder builder, String host) { if (host == null) { return builder; } final String hostOnly; final int portIndex = host.indexOf(":"); if (portIndex == -1) { hostOnly = host; } else { hostOnly = host.sub...
### Question: ReflectionResource { @GET @Path("/{id}") public Reflection getReflection(@PathParam("id") String id) { Optional<ReflectionGoal> goal = reflectionServiceHelper.getReflectionById(id); if (!goal.isPresent()) { throw new ReflectionNotFound(id); } String reflectionId = goal.get().getId().getId(); return new Re...
### Question: ScorePair { public ScorePair(MatchingConfig mc) { this.mc = mc; vt = new VectorTable(mc); modifiers = new ArrayList<Modifier>(); observed_vectors = new Hashtable<MatchVector, Long>(); } ScorePair(MatchingConfig mc); void addScoreModifier(Modifier sm); MatchResult scorePair(Record rec1, Record rec2); Hasht...
### Question: ScorePair { protected List<String[]> getCandidatesFromMultiFieldDemographics(String data1, String data2) { String[] a = data1.split(MatchingConstants.MULTI_FIELD_DELIMITER); String[] b = data2.split(MatchingConstants.MULTI_FIELD_DELIMITER); List<String[]> res = new ArrayList<String[]>(); for (String i : a...
### Question: Employee { public void salaryIncrement(Double percentage) { Double newSalary = salary + percentage * salary / 100; setSalary(newSalary); } Employee(Integer id, String name, Double salary); Integer getId(); void setId(Integer id); String getName(); void setName(String name); Double getSalary(); void setSal...
### Question: WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { @Override public void customize(WebServerFactory server) { setMimeMappings(server); setLocationForStaticAssets(server); if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_...