7272import com .amazonaws .services .s3 .model .PutObjectRequest ;
7373import com .amazonaws .services .s3 .model .PutObjectResult ;
7474import com .amazonaws .services .s3 .model .S3Object ;
75- import com .amazonaws .services .s3 .model .SelectObjectContentRequest ;
76- import com .amazonaws .services .s3 .model .SelectObjectContentResult ;
7775import com .amazonaws .services .s3 .model .StorageClass ;
7876import com .amazonaws .services .s3 .model .UploadPartRequest ;
7977import com .amazonaws .services .s3 .model .UploadPartResult ;
180178import org .apache .hadoop .fs .s3a .commit .PutTracker ;
181179import org .apache .hadoop .fs .s3a .commit .MagicCommitIntegration ;
182180import org .apache .hadoop .fs .s3a .impl .ChangeTracker ;
183- import org .apache .hadoop .fs .s3a .select .SelectBinding ;
184- import org .apache .hadoop .fs .s3a .select .SelectConstants ;
185181import org .apache .hadoop .fs .s3a .s3guard .S3Guard ;
186182import org .apache .hadoop .fs .s3a .statistics .BlockOutputStreamStatistics ;
187183import org .apache .hadoop .fs .s3a .statistics .CommitterStatistics ;
@@ -1562,8 +1558,7 @@ public FSDataInputStream open(Path f, int bufferSize)
15621558 /**
15631559 * Opens an FSDataInputStream at the indicated Path.
15641560 * The {@code fileInformation} parameter controls how the file
1565- * is opened, whether it is normal vs. an S3 select call,
1566- * can a HEAD be skipped, etc.
1561+ * is opened, can a HEAD be skipped, etc.
15671562 * @param path the file to open
15681563 * @param fileInformation information about the file to open
15691564 * @throws IOException IO failure.
@@ -1689,11 +1684,6 @@ public <T> CompletableFuture<T> submit(final CallableRaisingIOE<T> operation) {
16891684 private final class WriteOperationHelperCallbacksImpl
16901685 implements WriteOperationHelper .WriteOperationHelperCallbacks {
16911686
1692- @ Override
1693- public SelectObjectContentResult selectObjectContent (SelectObjectContentRequest request ) {
1694- return s3 .selectObjectContent (request );
1695- }
1696-
16971687 @ Override
16981688 public CompleteMultipartUploadResult completeMultipartUpload (
16991689 CompleteMultipartUploadRequest request ) {
@@ -1707,7 +1697,7 @@ public CompleteMultipartUploadResult completeMultipartUpload(
17071697 * using FS state as well as the status.
17081698 * @param fileStatus file status.
17091699 * @param auditSpan audit span.
1710- * @return a context for read and select operations.
1700+ * @return a context for read operations.
17111701 */
17121702 @ VisibleForTesting
17131703 protected S3AReadOpContext createReadContext (
@@ -5135,11 +5125,6 @@ public boolean hasPathCapability(final Path path, final String capability)
51355125 // capability depends on FS configuration
51365126 return isMagicCommitEnabled ();
51375127
5138- case SelectConstants .S3_SELECT_CAPABILITY :
5139- // select is only supported if enabled and client side encryption is
5140- // disabled.
5141- return !isCSEEnabled && SelectBinding .isSelectEnabled (getConf ());
5142-
51435128 case CommonPathCapabilities .FS_CHECKSUMS :
51445129 // capability depends on FS configuration
51455130 return getConf ().getBoolean (ETAG_CHECKSUM_ENABLED ,
@@ -5224,85 +5209,6 @@ public AWSCredentialProviderList shareCredentials(final String purpose) {
52245209 return credentials .share ();
52255210 }
52265211
5227- /**
5228- * This is a proof of concept of a select API.
5229- * @param source path to source data
5230- * @param options request configuration from the builder.
5231- * @param fileInformation any passed in information.
5232- * @return the stream of the results
5233- * @throws IOException IO failure
5234- */
5235- @ Retries .RetryTranslated
5236- @ AuditEntryPoint
5237- private FSDataInputStream select (final Path source ,
5238- final Configuration options ,
5239- final OpenFileSupport .OpenFileInformation fileInformation )
5240- throws IOException {
5241- requireSelectSupport (source );
5242- final AuditSpan auditSpan = entryPoint (OBJECT_SELECT_REQUESTS , source );
5243- final Path path = makeQualified (source );
5244- String expression = fileInformation .getSql ();
5245- final S3AFileStatus fileStatus = extractOrFetchSimpleFileStatus (path ,
5246- fileInformation );
5247-
5248- // readahead range can be dynamically set
5249- S3ObjectAttributes objectAttributes = createObjectAttributes (
5250- path , fileStatus );
5251- ChangeDetectionPolicy changePolicy = fileInformation .getChangePolicy ();
5252- S3AReadOpContext readContext = createReadContext (
5253- fileStatus ,
5254- auditSpan );
5255- fileInformation .applyOptions (readContext );
5256-
5257- if (changePolicy .getSource () != ChangeDetectionPolicy .Source .None
5258- && fileStatus .getEtag () != null ) {
5259- // if there is change detection, and the status includes at least an
5260- // etag,
5261- // check that the object metadata lines up with what is expected
5262- // based on the object attributes (which may contain an eTag or
5263- // versionId).
5264- // This is because the select API doesn't offer this.
5265- // (note: this is trouble for version checking as cannot force the old
5266- // version in the final read; nor can we check the etag match)
5267- ChangeTracker changeTracker =
5268- new ChangeTracker (uri .toString (),
5269- changePolicy ,
5270- readContext .getS3AStatisticsContext ()
5271- .newInputStreamStatistics ()
5272- .getChangeTrackerStatistics (),
5273- objectAttributes );
5274-
5275- // will retry internally if wrong version detected
5276- Invoker readInvoker = readContext .getReadInvoker ();
5277- getObjectMetadata (path , changeTracker , readInvoker , "select" );
5278- }
5279- // instantiate S3 Select support using the current span
5280- // as the active span for operations.
5281- SelectBinding selectBinding = new SelectBinding (
5282- createWriteOperationHelper (auditSpan ));
5283-
5284- // build and execute the request
5285- return selectBinding .select (
5286- readContext ,
5287- expression ,
5288- options ,
5289- objectAttributes );
5290- }
5291-
5292- /**
5293- * Verify the FS supports S3 Select.
5294- * @param source source file.
5295- * @throws UnsupportedOperationException if not.
5296- */
5297- private void requireSelectSupport (final Path source ) throws
5298- UnsupportedOperationException {
5299- if (!isCSEEnabled && !SelectBinding .isSelectEnabled (getConf ())) {
5300-
5301- throw new UnsupportedOperationException (
5302- SelectConstants .SELECT_UNSUPPORTED );
5303- }
5304- }
5305-
53065212 /**
53075213 * Get the file status of the source file.
53085214 * If in the fileInformation parameter return that
@@ -5333,16 +5239,14 @@ private S3AFileStatus extractOrFetchSimpleFileStatus(
53335239 }
53345240
53355241 /**
5336- * Initiate the open() or select() operation.
5242+ * Initiate the open() operation.
53375243 * This is invoked from both the FileSystem and FileContext APIs.
53385244 * It's declared as an audit entry point but the span creation is pushed
5339- * down into the open/select methods it ultimately calls.
5245+ * down into the open operation s it ultimately calls.
53405246 * @param rawPath path to the file
53415247 * @param parameters open file parameters from the builder.
5342- * @return a future which will evaluate to the opened/selected file.
5248+ * @return a future which will evaluate to the opened file.
53435249 * @throws IOException failure to resolve the link.
5344- * @throws PathIOException operation is a select request but S3 select is
5345- * disabled
53465250 * @throws IllegalArgumentException unknown mandatory key
53475251 */
53485252 @ Override
@@ -5358,20 +5262,9 @@ public CompletableFuture<FSDataInputStream> openFileWithOptions(
53585262 parameters ,
53595263 getDefaultBlockSize ());
53605264 CompletableFuture <FSDataInputStream > result = new CompletableFuture <>();
5361- if (!fileInformation .isS3Select ()) {
5362- // normal path.
5363- unboundedThreadPool .submit (() ->
5364- LambdaUtils .eval (result ,
5365- () -> executeOpen (path , fileInformation )));
5366- } else {
5367- // it is a select statement.
5368- // fail fast if the operation is not available
5369- requireSelectSupport (path );
5370- // submit the query
5371- unboundedThreadPool .submit (() ->
5372- LambdaUtils .eval (result ,
5373- () -> select (path , parameters .getOptions (), fileInformation )));
5374- }
5265+ unboundedThreadPool .submit (() ->
5266+ LambdaUtils .eval (result ,
5267+ () -> executeOpen (path , fileInformation )));
53755268 return result ;
53765269 }
53775270
0 commit comments