8383import software .amazon .awssdk .services .s3 .model .PutObjectResponse ;
8484import software .amazon .awssdk .services .s3 .model .S3Error ;
8585import software .amazon .awssdk .services .s3 .model .S3Object ;
86- import software .amazon .awssdk .services .s3 .model .SelectObjectContentRequest ;
87- import software .amazon .awssdk .services .s3 .model .SelectObjectContentResponseHandler ;
8886import software .amazon .awssdk .services .s3 .model .StorageClass ;
8987import software .amazon .awssdk .services .s3 .model .UploadPartRequest ;
9088import software .amazon .awssdk .services .s3 .model .UploadPartResponse ;
194192import org .apache .hadoop .fs .s3a .commit .PutTracker ;
195193import org .apache .hadoop .fs .s3a .commit .MagicCommitIntegration ;
196194import org .apache .hadoop .fs .s3a .impl .ChangeTracker ;
197- import org .apache .hadoop .fs .s3a .select .SelectBinding ;
198- import org .apache .hadoop .fs .s3a .select .SelectConstants ;
199195import org .apache .hadoop .fs .s3a .s3guard .S3Guard ;
200196import org .apache .hadoop .fs .s3a .statistics .BlockOutputStreamStatistics ;
201197import org .apache .hadoop .fs .s3a .statistics .CommitterStatistics ;
@@ -299,7 +295,7 @@ public class S3AFileSystem extends FileSystem implements StreamCapabilities,
299295
300296 private S3Client s3Client ;
301297
302- /** Async client is used for transfer manager and s3 select . */
298+ /** Async client is used for transfer manager. */
303299 private S3AsyncClient s3AsyncClient ;
304300
305301 // initial callback policy is fail-once; it's there just to assist
@@ -1725,8 +1721,7 @@ public FSDataInputStream open(Path f, int bufferSize)
17251721 /**
17261722 * Opens an FSDataInputStream at the indicated Path.
17271723 * The {@code fileInformation} parameter controls how the file
1728- * is opened, whether it is normal vs. an S3 select call,
1729- * can a HEAD be skipped, etc.
1724+ * is opened, can a HEAD be skipped, etc.
17301725 * @param path the file to open
17311726 * @param fileInformation information about the file to open
17321727 * @throws IOException IO failure.
@@ -1853,13 +1848,6 @@ public <T> CompletableFuture<T> submit(final CallableRaisingIOE<T> operation) {
18531848 private final class WriteOperationHelperCallbacksImpl
18541849 implements WriteOperationHelper .WriteOperationHelperCallbacks {
18551850
1856- @ Override
1857- public CompletableFuture <Void > selectObjectContent (
1858- SelectObjectContentRequest request ,
1859- SelectObjectContentResponseHandler responseHandler ) {
1860- return getS3AsyncClient ().selectObjectContent (request , responseHandler );
1861- }
1862-
18631851 @ Override
18641852 public CompleteMultipartUploadResponse completeMultipartUpload (
18651853 CompleteMultipartUploadRequest request ) {
@@ -1872,7 +1860,7 @@ public CompleteMultipartUploadResponse completeMultipartUpload(
18721860 * using FS state as well as the status.
18731861 * @param fileStatus file status.
18741862 * @param auditSpan audit span.
1875- * @return a context for read and select operations.
1863+ * @return a context for read operations.
18761864 */
18771865 @ VisibleForTesting
18781866 protected S3AReadOpContext createReadContext (
@@ -5452,13 +5440,6 @@ public boolean hasPathCapability(final Path path, final String capability)
54525440 // capability depends on FS configuration
54535441 return isMagicCommitEnabled ();
54545442
5455- case SelectConstants .S3_SELECT_CAPABILITY :
5456- // select is only supported if enabled and client side encryption is
5457- // disabled.
5458- return !isCSEEnabled
5459- && SelectBinding .isSelectEnabled (getConf ())
5460- && !s3ExpressStore ;
5461-
54625443 case CommonPathCapabilities .FS_CHECKSUMS :
54635444 // capability depends on FS configuration
54645445 return getConf ().getBoolean (ETAG_CHECKSUM_ENABLED ,
@@ -5572,85 +5553,6 @@ public AWSCredentialProviderList shareCredentials(final String purpose) {
55725553 return credentials .share ();
55735554 }
55745555
5575- /**
5576- * This is a proof of concept of a select API.
5577- * @param source path to source data
5578- * @param options request configuration from the builder.
5579- * @param fileInformation any passed in information.
5580- * @return the stream of the results
5581- * @throws IOException IO failure
5582- */
5583- @ Retries .RetryTranslated
5584- @ AuditEntryPoint
5585- private FSDataInputStream select (final Path source ,
5586- final Configuration options ,
5587- final OpenFileSupport .OpenFileInformation fileInformation )
5588- throws IOException {
5589- requireSelectSupport (source );
5590- final AuditSpan auditSpan = entryPoint (OBJECT_SELECT_REQUESTS , source );
5591- final Path path = makeQualified (source );
5592- String expression = fileInformation .getSql ();
5593- final S3AFileStatus fileStatus = extractOrFetchSimpleFileStatus (path ,
5594- fileInformation );
5595-
5596- // readahead range can be dynamically set
5597- S3ObjectAttributes objectAttributes = createObjectAttributes (
5598- path , fileStatus );
5599- ChangeDetectionPolicy changePolicy = fileInformation .getChangePolicy ();
5600- S3AReadOpContext readContext = createReadContext (
5601- fileStatus ,
5602- auditSpan );
5603- fileInformation .applyOptions (readContext );
5604-
5605- if (changePolicy .getSource () != ChangeDetectionPolicy .Source .None
5606- && fileStatus .getEtag () != null ) {
5607- // if there is change detection, and the status includes at least an
5608- // etag,
5609- // check that the object metadata lines up with what is expected
5610- // based on the object attributes (which may contain an eTag or
5611- // versionId).
5612- // This is because the select API doesn't offer this.
5613- // (note: this is trouble for version checking as cannot force the old
5614- // version in the final read; nor can we check the etag match)
5615- ChangeTracker changeTracker =
5616- new ChangeTracker (uri .toString (),
5617- changePolicy ,
5618- readContext .getS3AStatisticsContext ()
5619- .newInputStreamStatistics ()
5620- .getChangeTrackerStatistics (),
5621- objectAttributes );
5622-
5623- // will retry internally if wrong version detected
5624- Invoker readInvoker = readContext .getReadInvoker ();
5625- getObjectMetadata (path , changeTracker , readInvoker , "select" );
5626- }
5627- // instantiate S3 Select support using the current span
5628- // as the active span for operations.
5629- SelectBinding selectBinding = new SelectBinding (
5630- createWriteOperationHelper (auditSpan ));
5631-
5632- // build and execute the request
5633- return selectBinding .select (
5634- readContext ,
5635- expression ,
5636- options ,
5637- objectAttributes );
5638- }
5639-
5640- /**
5641- * Verify the FS supports S3 Select.
5642- * @param source source file.
5643- * @throws UnsupportedOperationException if not.
5644- */
5645- private void requireSelectSupport (final Path source ) throws
5646- UnsupportedOperationException {
5647- if (!isCSEEnabled && !SelectBinding .isSelectEnabled (getConf ())) {
5648-
5649- throw new UnsupportedOperationException (
5650- SelectConstants .SELECT_UNSUPPORTED );
5651- }
5652- }
5653-
56545556 /**
56555557 * Get the file status of the source file.
56565558 * If in the fileInformation parameter return that
@@ -5681,16 +5583,14 @@ private S3AFileStatus extractOrFetchSimpleFileStatus(
56815583 }
56825584
56835585 /**
5684- * Initiate the open() or select() operation.
5586+ * Initiate the open() operation.
56855587 * This is invoked from both the FileSystem and FileContext APIs.
56865588 * It's declared as an audit entry point but the span creation is pushed
5687- * down into the open/select methods it ultimately calls.
5589+ * down into the open operation s it ultimately calls.
56885590 * @param rawPath path to the file
56895591 * @param parameters open file parameters from the builder.
5690- * @return a future which will evaluate to the opened/selected file.
5592+ * @return a future which will evaluate to the opened file.
56915593 * @throws IOException failure to resolve the link.
5692- * @throws PathIOException operation is a select request but S3 select is
5693- * disabled
56945594 * @throws IllegalArgumentException unknown mandatory key
56955595 */
56965596 @ Override
@@ -5706,20 +5606,9 @@ public CompletableFuture<FSDataInputStream> openFileWithOptions(
57065606 parameters ,
57075607 getDefaultBlockSize ());
57085608 CompletableFuture <FSDataInputStream > result = new CompletableFuture <>();
5709- if (!fileInformation .isS3Select ()) {
5710- // normal path.
5711- unboundedThreadPool .submit (() ->
5712- LambdaUtils .eval (result ,
5713- () -> executeOpen (path , fileInformation )));
5714- } else {
5715- // it is a select statement.
5716- // fail fast if the operation is not available
5717- requireSelectSupport (path );
5718- // submit the query
5719- unboundedThreadPool .submit (() ->
5720- LambdaUtils .eval (result ,
5721- () -> select (path , parameters .getOptions (), fileInformation )));
5722- }
5609+ unboundedThreadPool .submit (() ->
5610+ LambdaUtils .eval (result ,
5611+ () -> executeOpen (path , fileInformation )));
57235612 return result ;
57245613 }
57255614
0 commit comments