_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q155500 | GoogleHadoopFileSystem.configureBuckets | train | @Override
@VisibleForTesting
protected void configureBuckets(GoogleCloudStorageFileSystem gcsFs) throws IOException {
rootBucket = initUri.getAuthority();
checkArgument(rootBucket != null, "No bucket specified in GCS URI: %s", initUri);
// Validate root bucket name
pathCodec.getPath(rootBucket, /* o... | java | {
"resource": ""
} |
q155501 | GoogleHadoopFileSystem.getHadoopPath | train | @Override
public Path getHadoopPath(URI gcsPath) {
logger.atFine().log("GHFS.getHadoopPath: %s", gcsPath);
// Handle root. Delegate to getGcsPath on "gs:/" to resolve the appropriate gs://<bucket> URI.
if (gcsPath.equals(getGcsPath(getFileSystemRoot()))) {
return getFileSystemRoot();
}
Sto... | java | {
"resource": ""
} |
q155502 | GoogleCloudStorageImpl.getDeletionCallback | train | private JsonBatchCallback<Void> getDeletionCallback(
final StorageResourceId resourceId,
final KeySetView<IOException, Boolean> innerExceptions,
final BatchHelper batchHelper,
final int attempt,
final long generation) {
return new JsonBatchCallback<Void>() {
@Override
publi... | java | {
"resource": ""
} |
q155503 | GoogleCloudStorageImpl.rewriteInternal | train | private void rewriteInternal(
final BatchHelper batchHelper,
final KeySetView<IOException, Boolean> innerExceptions,
final String srcBucketName, final String srcObjectName,
final String dstBucketName, final String dstObjectName)
throws IOException {
Storage.Objects.Rewrite rewriteObjec... | java | {
"resource": ""
} |
q155504 | GoogleCloudStorageImpl.copyInternal | train | private void copyInternal(
BatchHelper batchHelper,
final KeySetView<IOException, Boolean> innerExceptions,
final String srcBucketName, final String srcObjectName,
final String dstBucketName, final String dstObjectName)
throws IOException {
Storage.Objects.Copy copyObject =
con... | java | {
"resource": ""
} |
q155505 | GoogleCloudStorageImpl.onCopyFailure | train | private void onCopyFailure(
KeySetView<IOException, Boolean> innerExceptions,
GoogleJsonError e,
String srcBucketName, String srcObjectName) {
if (errorExtractor.itemNotFound(e)) {
FileNotFoundException fnfe =
GoogleCloudStorageExceptions.getFileNotFoundException(srcBucketName, src... | java | {
"resource": ""
} |
q155506 | GoogleCloudStorageImpl.handlePrefixes | train | private void handlePrefixes(
String bucketName, List<String> prefixes, List<GoogleCloudStorageItemInfo> objectInfos) {
if (storageOptions.isInferImplicitDirectoriesEnabled()) {
for (String prefix : prefixes) {
objectInfos.add(
GoogleCloudStorageItemInfo.createInferredDirectory(
... | java | {
"resource": ""
} |
q155507 | GoogleCloudStorageImpl.createItemInfoForBucket | train | public static GoogleCloudStorageItemInfo createItemInfoForBucket(
StorageResourceId resourceId, Bucket bucket) {
Preconditions.checkArgument(resourceId != null, "resourceId must not be null");
Preconditions.checkArgument(bucket != null, "bucket must not be null");
Preconditions.checkArgument(
... | java | {
"resource": ""
} |
q155508 | GoogleCloudStorageImpl.createItemInfoForStorageObject | train | public static GoogleCloudStorageItemInfo createItemInfoForStorageObject(
StorageResourceId resourceId, StorageObject object) {
Preconditions.checkArgument(resourceId != null, "resourceId must not be null");
Preconditions.checkArgument(object != null, "object must not be null");
Preconditions.checkArgu... | java | {
"resource": ""
} |
q155509 | GoogleCloudStorageImpl.getBucket | train | private Bucket getBucket(String bucketName)
throws IOException {
logger.atFine().log("getBucket(%s)", bucketName);
checkArgument(!Strings.isNullOrEmpty(bucketName), "bucketName must not be null or empty");
Storage.Buckets.Get getBucket = configureRequest(gcs.buckets().get(bucketName), bucketName);
... | java | {
"resource": ""
} |
q155510 | GoogleCloudStorageImpl.getWriteGeneration | train | private long getWriteGeneration(StorageResourceId resourceId, boolean overwritable)
throws IOException {
logger.atFine().log("getWriteGeneration(%s, %s)", resourceId, overwritable);
GoogleCloudStorageItemInfo info = getItemInfo(resourceId);
if (!info.exists()) {
return 0L;
}
if (info.exi... | java | {
"resource": ""
} |
q155511 | GoogleCloudStorageImpl.getObject | train | private StorageObject getObject(StorageResourceId resourceId)
throws IOException {
logger.atFine().log("getObject(%s)", resourceId);
Preconditions.checkArgument(
resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId);
String bucketName = resourceId.getBucketName();... | java | {
"resource": ""
} |
q155512 | CredentialFactory.getStaticHttpTransport | train | private static synchronized HttpTransport getStaticHttpTransport()
throws IOException, GeneralSecurityException {
if (staticHttpTransport == null) {
staticHttpTransport = HttpTransportFactory.createHttpTransport(HttpTransportType.JAVA_NET);
}
return staticHttpTransport;
} | java | {
"resource": ""
} |
q155513 | CredentialFactory.getCredentialFromJsonKeyFile | train | public Credential getCredentialFromJsonKeyFile(
String serviceAccountJsonKeyFile, List<String> scopes, HttpTransport transport)
throws IOException, GeneralSecurityException {
logger.atFine().log("getCredentialFromJsonKeyFile(%s, %s)", serviceAccountJsonKeyFile, scopes);
try (FileInputStream fis = n... | java | {
"resource": ""
} |
q155514 | DynamicFileListRecordReader.nextKeyValue | train | @Override
public boolean nextKeyValue()
throws IOException, InterruptedException {
currentValue = null;
// Check if we already have a reader in-progress.
if (delegateReader != null) {
if (delegateReader.nextKeyValue()) {
populateCurrentKeyValue();
return true;
} else {
... | java | {
"resource": ""
} |
q155515 | DynamicFileListRecordReader.close | train | @Override
public void close()
throws IOException {
if (delegateReader != null) {
logger.atWarning().log(
"Got non-null delegateReader during close(); possible premature close() call.");
delegateReader.close();
delegateReader = null;
}
} | java | {
"resource": ""
} |
q155516 | DynamicFileListRecordReader.setEndFileMarkerFile | train | private void setEndFileMarkerFile(String fileName) {
int fileIndex = parseFileIndex(fileName);
if (endFileNumber == -1) {
// First time finding the end-marker file.
endFileNumber = fileIndex;
logger.atInfo().log("Found end-marker file '%s' with index %s", fileName, endFileNumber);
// Sa... | java | {
"resource": ""
} |
q155517 | DynamicFileListRecordReader.refreshFileList | train | private void refreshFileList()
throws IOException {
FileStatus[] files = fileSystem.globStatus(inputDirectoryAndPattern);
for (FileStatus file : files) {
String fileName = file.getPath().getName();
if (!knownFileSet.contains(fileName)) {
if (endFileNumber != -1) {
// Sanity c... | java | {
"resource": ""
} |
q155518 | GcsDelegationTokens.bindToAnyDelegationToken | train | public void bindToAnyDelegationToken() throws IOException {
validateAccessTokenProvider();
Token<DelegationTokenIdentifier> token = selectTokenFromFsOwner();
if (token != null) {
bindToDelegationToken(token);
} else {
deployUnbonded();
}
if (accessTokenProvider == null) {
throw... | java | {
"resource": ""
} |
q155519 | GcsDelegationTokens.selectTokenFromFsOwner | train | public Token<DelegationTokenIdentifier> selectTokenFromFsOwner() throws IOException {
return lookupToken(user.getCredentials(), service, tokenBinding.getKind());
} | java | {
"resource": ""
} |
q155520 | GcsDelegationTokens.bindToDelegationToken | train | public void bindToDelegationToken(Token<DelegationTokenIdentifier> token) throws IOException {
validateAccessTokenProvider();
boundDT = token;
DelegationTokenIdentifier dti = extractIdentifier(token);
logger.atInfo().log("Using delegation token %s", dti);
// extract the credential providers.
acc... | java | {
"resource": ""
} |
q155521 | GcsDelegationTokens.getBoundOrNewDT | train | @SuppressWarnings("OptionalGetWithoutIsPresent")
public Token<DelegationTokenIdentifier> getBoundOrNewDT(String renewer) throws IOException {
logger.atFine().log("Delegation token requested");
if (isBoundToDT()) {
// the FS was created on startup with a token, so return it.
logger.atFine().log("Re... | java | {
"resource": ""
} |
q155522 | GcsDelegationTokens.extractIdentifier | train | public static DelegationTokenIdentifier extractIdentifier(
final Token<? extends DelegationTokenIdentifier> token) throws IOException {
checkArgument(token != null, "null token");
DelegationTokenIdentifier identifier;
// harden up decode beyond what Token does itself
try {
identifier = token... | java | {
"resource": ""
} |
q155523 | GcsDelegationTokens.lookupToken | train | @SuppressWarnings("unchecked") // safe by contract of lookupToken()
private static Token<DelegationTokenIdentifier> lookupToken(
Credentials credentials, Text service, Text kind) throws DelegationTokenIOException {
logger.atFine().log("Looking for token for service %s in credentials", service);
Token<?>... | java | {
"resource": ""
} |
q155524 | ConfigurationUtil.getMandatoryConfig | train | public static String getMandatoryConfig(Configuration config, String key)
throws IOException {
String value = config.get(key);
if (Strings.isNullOrEmpty(value)) {
throw new IOException("Must supply a value for configuration setting: " + key);
}
return value;
} | java | {
"resource": ""
} |
q155525 | ConfigurationUtil.getMandatoryConfig | train | public static Map<String, String> getMandatoryConfig(
Configuration config, List<String> keys)
throws IOException {
List<String> missingKeys = new ArrayList<>();
Map<String, String> values = new HashMap<>();
for (String key : keys) {
String value = config.get(key);
if (Strings.isNull... | java | {
"resource": ""
} |
q155526 | AbstractGoogleAsyncWriteChannel.setUploadChunkSize | train | public void setUploadChunkSize(int chunkSize) {
Preconditions.checkArgument(chunkSize > 0, "Upload chunk size must be great than 0.");
Preconditions.checkArgument(
chunkSize % MediaHttpUploader.MINIMUM_CHUNK_SIZE == 0,
"Upload chunk size must be a multiple of MediaHttpUploader.MINIMUM_CHUNK_SIZE... | java | {
"resource": ""
} |
q155527 | AbstractGoogleAsyncWriteChannel.write | train | @Override
public synchronized int write(ByteBuffer buffer) throws IOException {
checkState(isInitialized, "initialize() must be invoked before use.");
if (!isOpen()) {
throw new ClosedChannelException();
}
// No point in writing further if upload failed on another thread.
if (uploadOperatio... | java | {
"resource": ""
} |
q155528 | AbstractGoogleAsyncWriteChannel.initialize | train | public void initialize() throws IOException {
// Create a pipe such that its one end is connected to the input stream used by
// the uploader and the other end is the write channel used by the caller.
PipedInputStream pipeSource = new PipedInputStream(pipeBufferSize);
OutputStream pipeSink = new PipedOu... | java | {
"resource": ""
} |
q155529 | AbstractGoogleAsyncWriteChannel.waitForCompletionAndThrowIfUploadFailed | train | private S waitForCompletionAndThrowIfUploadFailed() throws IOException {
try {
return uploadOperation.get();
} catch (InterruptedException e) {
// If we were interrupted, we need to cancel the upload operation.
uploadOperation.cancel(true);
IOException exception = new ClosedByInterruptEx... | java | {
"resource": ""
} |
q155530 | GoogleCloudStorageExceptions.getFileNotFoundException | train | public static FileNotFoundException getFileNotFoundException(
String bucketName, String objectName) {
checkArgument(!isNullOrEmpty(bucketName), "bucketName must not be null or empty");
return new FileNotFoundException(
String.format(
"Item not found: '%s'."
+ " If you e... | java | {
"resource": ""
} |
q155531 | ResilientOperation.retry | train | @SuppressWarnings("unchecked")
public static <T, X extends Exception> T retry(
CheckedCallable<T, X> callable,
BackOff backoff,
RetryDeterminer<? super X> retryDet,
Class<X> classType,
Sleeper sleeper)
throws X, InterruptedException {
checkNotNull(backoff, "Must provide a non-n... | java | {
"resource": ""
} |
q155532 | ResilientOperation.retry | train | public static <T, X extends Exception> T retry(
CheckedCallable<T, X> callable,
BackOff backoff,
RetryDeterminer<? super X> retryDet,
Class<X> classType)
throws X, InterruptedException {
return retry(callable, backoff, retryDet, classType, Sleeper.DEFAULT);
} | java | {
"resource": ""
} |
q155533 | ResilientOperation.nextSleep | train | private static boolean nextSleep(BackOff backoff, Sleeper sleeper, Exception currentException)
throws InterruptedException {
long backOffTime;
try {
backOffTime = backoff.nextBackOffMillis();
} catch (IOException e) {
throw new RuntimeException("Failed to to get next back off time", e);
... | java | {
"resource": ""
} |
q155534 | StorageResourceId.objectHasDirectoryPath | train | static boolean objectHasDirectoryPath(String objectName) {
return !Strings.isNullOrEmpty(objectName)
&& objectName.endsWith(GoogleCloudStorage.PATH_DELIMITER);
} | java | {
"resource": ""
} |
q155535 | BatchHelper.flushIfPossible | train | private void flushIfPossible(boolean flushAll) throws IOException {
if (flushAll) {
flushLock.lock();
} else if (pendingRequests.isEmpty() || !flushLock.tryLock()) {
return;
}
try {
do {
flushPendingRequests();
if (flushAll) {
awaitRequestsCompletion();
... | java | {
"resource": ""
} |
q155536 | BatchHelper.flush | train | public void flush() throws IOException {
try {
flushIfPossible(true);
checkState(pendingRequests.isEmpty(), "pendingRequests should be empty after flush");
checkState(responseFutures.isEmpty(), "responseFutures should be empty after flush");
} finally {
requestsExecutor.shutdown();
... | java | {
"resource": ""
} |
q155537 | BatchHelper.awaitRequestsCompletion | train | private void awaitRequestsCompletion() throws IOException {
// Don't wait until all requests will be completed if enough requests are pending for full batch
while (!responseFutures.isEmpty() && pendingRequests.size() < maxRequestsPerBatch) {
try {
responseFutures.remove().get();
} catch (Int... | java | {
"resource": ""
} |
q155538 | PrefixMappedItemCache.putItem | train | public synchronized GoogleCloudStorageItemInfo putItem(GoogleCloudStorageItemInfo item) {
StorageResourceId id = item.getResourceId();
PrefixKey key = new PrefixKey(id.getBucketName(), id.getObjectName());
CacheValue<GoogleCloudStorageItemInfo> value =
new CacheValue<GoogleCloudStorageItemInfo>(item... | java | {
"resource": ""
} |
q155539 | PrefixMappedItemCache.removeItem | train | public synchronized GoogleCloudStorageItemInfo removeItem(StorageResourceId id) {
PrefixKey key = new PrefixKey(id.getBucketName(), id.getObjectName());
CacheValue<GoogleCloudStorageItemInfo> value = itemMap.remove(key);
if (value == null) {
return null;
}
if (isExpired(value)) {
clean... | java | {
"resource": ""
} |
q155540 | PrefixMappedItemCache.invalidateBucket | train | public synchronized void invalidateBucket(String bucket) {
PrefixKey key = new PrefixKey(bucket, "");
getPrefixSubMap(itemMap, key).clear();
getPrefixSubMap(prefixMap, key).clear();
} | java | {
"resource": ""
} |
q155541 | PrefixMappedItemCache.cleanupLists | train | private void cleanupLists(PrefixKey key) {
// Remove expired list entries. Keep track of the last list removed.
NavigableMap<PrefixKey, CacheValue<Object>> head = prefixMap.headMap(key, true).descendingMap();
Iterator<Entry<PrefixKey, CacheValue<Object>>> headItr = head.entrySet().iterator();
Entry<Pref... | java | {
"resource": ""
} |
q155542 | PrefixMappedItemCache.aggregateCacheValues | train | private static <K, V> List<V> aggregateCacheValues(Map<K, CacheValue<V>> map) {
List<V> values = new ArrayList<>(map.size());
for (Map.Entry<K, CacheValue<V>> entry : map.entrySet()) {
values.add(entry.getValue().getValue());
}
return values;
} | java | {
"resource": ""
} |
q155543 | GcsDtFetcher.addDelegationTokens | train | @Override
public Token<?> addDelegationTokens(
Configuration conf, Credentials creds, String renewer, String url) throws Exception {
if (!url.startsWith(SCHEME)) {
url = SCHEME + "://" + url;
}
FileSystem fs = FileSystem.get(URI.create(url), conf);
Token<?> token = fs.getDelegationToken(re... | java | {
"resource": ""
} |
q155544 | CredentialFromAccessTokenProviderClassFactory.credential | train | public static Credential credential(
AccessTokenProviderClassFromConfigFactory providerClassFactory,
Configuration config,
Collection<String> scopes)
throws IOException, GeneralSecurityException {
Class<? extends AccessTokenProvider> clazz =
providerClassFactory.getAccessTokenProvide... | java | {
"resource": ""
} |
q155545 | BigQueryFactory.createBigQueryCredential | train | public Credential createBigQueryCredential(Configuration config)
throws GeneralSecurityException, IOException {
Credential credential =
CredentialFromAccessTokenProviderClassFactory.credential(
new AccessTokenProviderClassFromConfigFactory().withOverridePrefix("mapred.bq"),
con... | java | {
"resource": ""
} |
q155546 | BigQueryFactory.getBigQuery | train | public Bigquery getBigQuery(Configuration config)
throws GeneralSecurityException, IOException {
logger.atInfo().log("Creating BigQuery from default credential.");
Credential credential = createBigQueryCredential(config);
// Use the credential to create an authorized BigQuery client
return getBigQ... | java | {
"resource": ""
} |
q155547 | BigQueryFactory.getBigQueryFromCredential | train | public Bigquery getBigQueryFromCredential(Credential credential, String appName) {
logger.atInfo().log("Creating BigQuery from given credential.");
// Use the credential to create an authorized BigQuery client
if (credential != null) {
return new Bigquery
.Builder(HTTP_TRANSPORT, JSON_FACTOR... | java | {
"resource": ""
} |
q155548 | BigQueryUtils.waitForJobCompletion | train | public static void waitForJobCompletion(
Bigquery bigquery, String projectId, JobReference jobReference, Progressable progressable)
throws IOException, InterruptedException {
Sleeper sleeper = Sleeper.DEFAULT;
BackOff pollBackOff =
new ExponentialBackOff.Builder()
.setMaxInterva... | java | {
"resource": ""
} |
q155549 | BigQueryUtils.getSchemaFromString | train | public static List<TableFieldSchema> getSchemaFromString(String fields) {
logger.atFine().log("getSchemaFromString('%s')", fields);
// Parse the output schema for Json from fields.
JsonParser jsonParser = new JsonParser();
JsonArray json = jsonParser.parse(fields).getAsJsonArray();
List<TableFieldS... | java | {
"resource": ""
} |
q155550 | GoogleHadoopFileSystemBase.initialize | train | public void initialize(URI path, Configuration config, boolean initSuperclass)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(path != null, "path must not be null");
Preconditions.checkArgument(config != null, "config must not be null");
Preconditions.checkArg... | java | {
"resource": ""
} |
q155551 | GoogleHadoopFileSystemBase.initializeDelegationTokenSupport | train | private void initializeDelegationTokenSupport(Configuration config, URI path) throws IOException {
logger.atFine().log("GHFS.initializeDelegationTokenSupport");
// Load delegation token binding, if support is configured
GcsDelegationTokens dts = new GcsDelegationTokens();
Text service = new Text(getSche... | java | {
"resource": ""
} |
q155552 | GoogleHadoopFileSystemBase.getDefaultPort | train | @Override
protected int getDefaultPort() {
logger.atFine().log("GHFS.getDefaultPort:");
int result = -1;
logger.atFine().log("GHFS.getDefaultPort:=> %s", result);
return result;
} | java | {
"resource": ""
} |
q155553 | GoogleHadoopFileSystemBase.create | train | @Override
public FSDataOutputStream create(
Path hadoopPath,
FsPermission permission,
boolean overwrite,
int bufferSize,
short replication,
long blockSize,
Progressable progress)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgume... | java | {
"resource": ""
} |
q155554 | GoogleHadoopFileSystemBase.concat | train | @Override
public void concat(Path trg, Path[] psrcs) throws IOException {
logger.atFine().log("GHFS.concat: %s, %s", trg, lazy(() -> Arrays.toString(psrcs)));
checkArgument(psrcs.length > 0, "psrcs must have at least one source");
URI trgPath = getGcsPath(trg);
List<URI> srcPaths = Arrays.stream(psr... | java | {
"resource": ""
} |
q155555 | GoogleHadoopFileSystemBase.rename | train | @Override
public boolean rename(Path src, Path dst) throws IOException {
// Even though the underlying GCSFS will also throw an IAE if src is root, since our filesystem
// root happens to equal the global root, we want to explicitly check it here since derived
// classes may not have filesystem roots equa... | java | {
"resource": ""
} |
q155556 | GoogleHadoopFileSystemBase.listStatus | train | @Override
public FileStatus[] listStatus(Path hadoopPath)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
checkOpen();
logger.atFine().log("GHFS.listStatus: %s", hadoopPath);
URI gcsPath = getGcsPath(... | java | {
"resource": ""
} |
q155557 | GoogleHadoopFileSystemBase.setWorkingDirectory | train | @Override
public void setWorkingDirectory(Path hadoopPath) {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
logger.atFine().log("GHFS.setWorkingDirectory: %s", hadoopPath);
URI gcsPath = FileInfo.convertToDirectoryPath(pathCodec, ge... | java | {
"resource": ""
} |
q155558 | GoogleHadoopFileSystemBase.mkdirs | train | @Override
public boolean mkdirs(Path hadoopPath, FsPermission permission)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
checkOpen();
logger.atFine().log("GHFS.mkdirs: %s, perm: %s", hadoopPath, permissi... | java | {
"resource": ""
} |
q155559 | GoogleHadoopFileSystemBase.getFileStatus | train | @Override
public FileStatus getFileStatus(Path hadoopPath)
throws IOException {
long startTime = System.nanoTime();
Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");
checkOpen();
logger.atFine().log("GHFS.getFileStatus: %s", hadoopPath);
URI gcsPath = getGcsP... | java | {
"resource": ""
} |
q155560 | GoogleHadoopFileSystemBase.getFileStatus | train | private FileStatus getFileStatus(FileInfo fileInfo, String userName) throws IOException {
// GCS does not provide modification time. It only provides creation time.
// It works for objects because they are immutable once created.
FileStatus status =
new FileStatus(
fileInfo.getSize(),
... | java | {
"resource": ""
} |
q155561 | GoogleHadoopFileSystemBase.globStatus | train | @Override
public FileStatus[] globStatus(Path pathPattern, PathFilter filter) throws IOException {
checkOpen();
logger.atFine().log("GHFS.globStatus: %s", pathPattern);
// URI does not handle glob expressions nicely, for the purpose of
// fully-qualifying a path we can URI-encode them.
// Using t... | java | {
"resource": ""
} |
q155562 | GoogleHadoopFileSystemBase.concurrentGlobInternal | train | private FileStatus[] concurrentGlobInternal(Path fixedPath, PathFilter filter)
throws IOException {
ExecutorService executorService = Executors.newFixedThreadPool(2, DAEMON_THREAD_FACTORY);
Callable<FileStatus[]> flatGlobTask = () -> flatGlobInternal(fixedPath, filter);
Callable<FileStatus[]> nonFlatG... | java | {
"resource": ""
} |
q155563 | GoogleHadoopFileSystemBase.getHomeDirectory | train | @Override
public Path getHomeDirectory() {
Path result = new Path(getFileSystemRoot(), getHomeDirectorySubpath());
logger.atFine().log("GHFS.getHomeDirectory:=> %s", result);
return result;
} | java | {
"resource": ""
} |
q155564 | GoogleHadoopFileSystemBase.fileStatusToString | train | private static String fileStatusToString(FileStatus stat) {
assert stat != null;
return String.format(
"path: %s, isDir: %s, len: %d, owner: %s",
stat.getPath().toString(),
stat.isDir(),
stat.getLen(),
stat.getOwner());
} | java | {
"resource": ""
} |
q155565 | GoogleHadoopFileSystemBase.copyIfNotPresent | train | private static void copyIfNotPresent(Configuration config, String deprecatedKey, String newKey) {
String deprecatedValue = config.get(deprecatedKey);
if (config.get(newKey) == null && deprecatedValue != null) {
logger.atWarning().log(
"Key %s is deprecated. Copying the value of key %s to new key... | java | {
"resource": ""
} |
q155566 | GoogleHadoopFileSystemBase.copyDeprecatedConfigurationOptions | train | private static void copyDeprecatedConfigurationOptions(Configuration config) {
copyIfNotPresent(
config,
GoogleHadoopFileSystemConfiguration.AUTH_SERVICE_ACCOUNT_ENABLE.getKey(),
AUTHENTICATION_PREFIX + HadoopCredentialConfiguration.ENABLE_SERVICE_ACCOUNTS_SUFFIX);
copyIfNotPresent(
... | java | {
"resource": ""
} |
q155567 | GoogleHadoopFileSystemBase.configure | train | private synchronized void configure(Configuration config) throws IOException {
logger.atFine().log("GHFS.configure");
logger.atFine().log("GHFS_ID = %s", GHFS_ID);
overrideConfigFromFile(config);
copyDeprecatedConfigurationOptions(config);
// Set this configuration as the default config for this in... | java | {
"resource": ""
} |
q155568 | GoogleCloudStorageStrings.matchListPrefix | train | public static String matchListPrefix(
String objectNamePrefix, String delimiter, String objectName) {
Preconditions.checkArgument(!Strings.isNullOrEmpty(objectName),
"objectName must not be null or empty, had args %s/%s/%s: ",
objectNamePrefix, delimiter, objectName);
// The suffix th... | java | {
"resource": ""
} |
q155569 | GoogleCloudStorageReadChannel.position | train | @Override
public SeekableByteChannel position(long newPosition) throws IOException {
throwIfNotOpen();
if (newPosition == currentPosition) {
return this;
}
validatePosition(newPosition);
logger.atFine().log(
"Seek from %s to %s position for '%s'", currentPosition, newPosition, reso... | java | {
"resource": ""
} |
q155570 | GoogleCloudStorageReadChannel.validatePosition | train | protected void validatePosition(long position) throws IOException {
if (position < 0) {
throw new EOFException(
String.format(
"Invalid seek offset: position value (%d) must be >= 0 for '%s'",
position, resourceIdString));
}
if (size >= 0 && position >= size) {
... | java | {
"resource": ""
} |
q155571 | GoogleHadoopOutputStream.write | train | @Override
public void write(byte[] b, int offset, int len) throws IOException {
long startTime = System.nanoTime();
out.write(b, offset, len);
statistics.incrementBytesWritten(len);
long duration = System.nanoTime() - startTime;
ghfs.increment(GoogleHadoopFileSystemBase.Counter.WRITE);
ghfs.in... | java | {
"resource": ""
} |
q155572 | FileInfo.addModificationTimeToAttributes | train | public static void addModificationTimeToAttributes(Map<String, byte[]> attributes, Clock clock) {
attributes.put(FILE_MODIFICATION_TIMESTAMP_KEY, Longs.toByteArray(clock.currentTimeMillis()));
} | java | {
"resource": ""
} |
q155573 | FileInfo.convertToFilePath | train | public static String convertToFilePath(String objectName) {
if (!Strings.isNullOrEmpty(objectName)) {
if (objectHasDirectoryPath(objectName)) {
objectName = objectName.substring(0, objectName.length() - 1);
}
}
return objectName;
} | java | {
"resource": ""
} |
q155574 | FileInfo.fromItemInfo | train | public static FileInfo fromItemInfo(PathCodec pathCodec, GoogleCloudStorageItemInfo itemInfo) {
if (itemInfo.isRoot()) {
return ROOT_INFO;
}
URI path = pathCodec.getPath(itemInfo.getBucketName(), itemInfo.getObjectName(), true);
return new FileInfo(path, itemInfo);
} | java | {
"resource": ""
} |
q155575 | FileInfo.fromItemInfos | train | public static List<FileInfo> fromItemInfos(
PathCodec pathCodec, List<GoogleCloudStorageItemInfo> itemInfos) {
List<FileInfo> fileInfos = new ArrayList<>(itemInfos.size());
for (GoogleCloudStorageItemInfo itemInfo : itemInfos) {
fileInfos.add(fromItemInfo(pathCodec, itemInfo));
}
return file... | java | {
"resource": ""
} |
q155576 | FileInfo.isDirectoryPath | train | public static boolean isDirectoryPath(URI path) {
return (path != null) && path.toString().endsWith(GoogleCloudStorage.PATH_DELIMITER);
} | java | {
"resource": ""
} |
q155577 | FileInfo.convertToDirectoryPath | train | public static StorageResourceId convertToDirectoryPath(StorageResourceId resourceId) {
if (resourceId.isStorageObject()) {
if (!objectHasDirectoryPath(resourceId.getObjectName())) {
resourceId = new StorageResourceId(
resourceId.getBucketName(), convertToDirectoryPath(resourceId.getObjectN... | java | {
"resource": ""
} |
q155578 | FileInfo.convertToDirectoryPath | train | public static URI convertToDirectoryPath(PathCodec pathCodec, URI path) {
StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true);
if (resourceId.isStorageObject()) {
if (!objectHasDirectoryPath(resourceId.getObjectName())) {
resourceId = convertToDirectoryPath(resourceId);
... | java | {
"resource": ""
} |
q155579 | BigQueryTableHelper.getTableFieldsJson | train | static String getTableFieldsJson(TableSchema tableSchema) throws IOException {
return JacksonFactory.getDefaultInstance().toString(tableSchema.getFields());
} | java | {
"resource": ""
} |
q155580 | GsonRecordReader.initialize | train | @Override
public void initialize(InputSplit genericSplit, TaskAttemptContext context)
throws IOException {
if (logger.atFine().isEnabled()) {
try {
logger.atFine().log(
"initialize('%s', '%s')",
HadoopToStringUtil.toString(genericSplit), HadoopToStringUtil.toString(cont... | java | {
"resource": ""
} |
q155581 | GsonRecordReader.nextKeyValue | train | @Override
public boolean nextKeyValue()
throws IOException {
// If there is no next value, return false. Set current key and value to null.
// Different Hadoop recordreaders have different behavior for calling current key and value
// after nextKeyValue returns false.
if (!lineReader.nextKeyValu... | java | {
"resource": ""
} |
q155582 | GoogleCloudStorageItemInfo.createInferredDirectory | train | public static GoogleCloudStorageItemInfo createInferredDirectory(StorageResourceId resourceId) {
checkArgument(resourceId != null, "resourceId must not be null");
return new GoogleCloudStorageItemInfo(
resourceId,
/* creationTime= */ 0,
/* size= */ 0,
/* location= */ null,
... | java | {
"resource": ""
} |
q155583 | GoogleCloudStorageItemInfo.createNotFound | train | public static GoogleCloudStorageItemInfo createNotFound(StorageResourceId resourceId) {
checkArgument(resourceId != null, "resourceId must not be null");
// Bucket or StorageObject.
return new GoogleCloudStorageItemInfo(
resourceId,
/* creationTime= */ 0,
/* size= */ -1,
/* l... | java | {
"resource": ""
} |
q155584 | ForwardingBigQueryFileOutputFormat.checkOutputSpecs | train | @Override
public void checkOutputSpecs(JobContext job) throws FileAlreadyExistsException, IOException {
Configuration conf = job.getConfiguration();
// Validate the output configuration.
BigQueryOutputConfiguration.validateConfiguration(conf);
// Get the output path.
Path outputPath = BigQueryOu... | java | {
"resource": ""
} |
q155585 | ForwardingBigQueryFileOutputFormat.getOutputCommitter | train | @Override
public synchronized OutputCommitter getOutputCommitter(TaskAttemptContext context)
throws IOException {
// Cache the committer.
if (committer == null) {
committer = createCommitter(context);
}
return committer;
} | java | {
"resource": ""
} |
q155586 | ForwardingBigQueryFileOutputFormat.getRecordWriter | train | @Override
public RecordWriter<K, V> getRecordWriter(TaskAttemptContext context)
throws IOException, InterruptedException {
Configuration conf = context.getConfiguration();
return getDelegate(conf).getRecordWriter(context);
} | java | {
"resource": ""
} |
q155587 | ForwardingBigQueryFileOutputFormat.createCommitter | train | protected OutputCommitter createCommitter(TaskAttemptContext context) throws IOException {
Configuration conf = context.getConfiguration();
return getDelegate(conf).getOutputCommitter(context);
} | java | {
"resource": ""
} |
q155588 | ForwardingBigQueryFileOutputFormat.getDelegate | train | @SuppressWarnings("unchecked")
protected synchronized FileOutputFormat<K, V> getDelegate(Configuration conf) throws IOException {
if (delegate == null) {
delegate = BigQueryOutputConfiguration.getFileOutputFormat(conf);
logger.atInfo().log("Delegating functionality to '%s'.", delegate.getClass().getSi... | java | {
"resource": ""
} |
q155589 | BigQueryOutputConfiguration.validateConfiguration | train | public static void validateConfiguration(Configuration conf) throws IOException {
// Ensure the BigQuery output information is valid.
ConfigurationUtil.getMandatoryConfig(conf, REQUIRED_KEYS);
// Run through the individual getters as they manage error handling.
getProjectId(conf);
getTableSchema(co... | java | {
"resource": ""
} |
q155590 | BigQueryOutputConfiguration.getTableSchema | train | static Optional<BigQueryTableSchema> getTableSchema(Configuration conf) throws IOException {
String fieldsJson = conf.get(BigQueryConfiguration.OUTPUT_TABLE_SCHEMA_KEY);
if (!Strings.isNullOrEmpty(fieldsJson)) {
try {
TableSchema tableSchema = BigQueryTableHelper.createTableSchemaFromFields(fields... | java | {
"resource": ""
} |
q155591 | BigQueryOutputConfiguration.getGcsOutputPath | train | public static Path getGcsOutputPath(Configuration conf) throws IOException {
Job tempJob = new JobConfigurationAdapter(conf);
// Error if the output path is missing.
Path outputPath = FileOutputFormat.getOutputPath(tempJob);
if (outputPath == null) {
throw new IOException("FileOutputFormat output... | java | {
"resource": ""
} |
q155592 | BigQueryOutputConfiguration.getWriteDisposition | train | public static String getWriteDisposition(Configuration conf) {
return conf.get(
BigQueryConfiguration.OUTPUT_TABLE_WRITE_DISPOSITION_KEY,
BigQueryConfiguration.OUTPUT_TABLE_WRITE_DISPOSITION_DEFAULT);
} | java | {
"resource": ""
} |
q155593 | BigQueryOutputConfiguration.setFileOutputFormatOutputPath | train | @VisibleForTesting
static void setFileOutputFormatOutputPath(Configuration conf, String outputPath)
throws IOException {
Job tempJob = new JobConfigurationAdapter(conf);
FileOutputFormat.setOutputPath(tempJob, new Path(outputPath));
} | java | {
"resource": ""
} |
q155594 | ApiErrorExtractor.accessDeniedNonRecoverable | train | public boolean accessDeniedNonRecoverable(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String reason = errorInfo.getReason();
return ACCOUNT_DISABLED_REASON_CODE.equals(reason)
|| ACCESS_NOT_CONFIGURED_REASON_CODE.equals(reason);
}
return fal... | java | {
"resource": ""
} |
q155595 | ApiErrorExtractor.isClientError | train | public boolean isClientError(IOException e) {
GoogleJsonResponseException jsonException = getJsonResponseExceptionOrNull(e);
if (jsonException != null) {
return (getHttpStatusCode(jsonException)) / 100 == 4;
}
return false;
} | java | {
"resource": ""
} |
q155596 | ApiErrorExtractor.fieldSizeTooLarge | train | public boolean fieldSizeTooLarge(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String reason = errorInfo.getReason();
return FIELD_SIZE_TOO_LARGE.equals(reason);
}
return false;
} | java | {
"resource": ""
} |
q155597 | ApiErrorExtractor.resourceNotReady | train | public boolean resourceNotReady(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String reason = errorInfo.getReason();
return RESOURCE_NOT_READY_REASON_CODE.equals(reason);
}
return false;
} | java | {
"resource": ""
} |
q155598 | ApiErrorExtractor.rateLimited | train | public boolean rateLimited(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
if (errorInfo != null) {
String domain = errorInfo.getDomain();
String reason = errorInfo.getReason();
boolean isRateLimitedOrGlobalDomain =
USAGE_LIMITS_DOMAIN.equals(domain) || GLOBAL_DOMAIN.equa... | java | {
"resource": ""
} |
q155599 | ApiErrorExtractor.userProjectMissing | train | public boolean userProjectMissing(GoogleJsonError e) {
ErrorInfo errorInfo = getErrorInfo(e);
return errorInfo != null
&& e.getCode() == STATUS_CODE_BAD_REQUEST
&& USER_PROJECT_MISSING.equals(errorInfo.getMessage());
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.