-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename OpenFileInformation to OpenStreamInformation #227
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
import software.amazon.s3.analyticsaccelerator.request.ObjectClient; | ||
import software.amazon.s3.analyticsaccelerator.request.ObjectMetadata; | ||
import software.amazon.s3.analyticsaccelerator.util.ObjectFormatSelector; | ||
import software.amazon.s3.analyticsaccelerator.util.OpenFileInformation; | ||
import software.amazon.s3.analyticsaccelerator.util.OpenStreamInformation; | ||
import software.amazon.s3.analyticsaccelerator.util.S3URI; | ||
|
||
/** | ||
|
@@ -103,23 +103,25 @@ public S3SeekableInputStream createStream(@NonNull S3URI s3URI, ObjectMetadata m | |
* Creates an instance of SeekableStream with file information | ||
* | ||
* @param s3URI the object's S3 URI | ||
* @param openFileInformation known file information this key | ||
* @param openStreamInformation known file information this key | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
* @return An instance of the input stream. | ||
* @throws IOException IoException | ||
*/ | ||
public S3SeekableInputStream createStream( | ||
@NonNull S3URI s3URI, @NonNull OpenFileInformation openFileInformation) throws IOException { | ||
storeObjectMetadata(s3URI, openFileInformation.getObjectMetadata()); | ||
return new S3SeekableInputStream(s3URI, createLogicalIO(s3URI, openFileInformation), telemetry); | ||
@NonNull S3URI s3URI, @NonNull OpenStreamInformation openStreamInformation) | ||
throws IOException { | ||
storeObjectMetadata(s3URI, openStreamInformation.getObjectMetadata()); | ||
return new S3SeekableInputStream( | ||
s3URI, createLogicalIO(s3URI, openStreamInformation), telemetry); | ||
} | ||
|
||
LogicalIO createLogicalIO(S3URI s3URI) throws IOException { | ||
return createLogicalIO(s3URI, OpenFileInformation.DEFAULT); | ||
return createLogicalIO(s3URI, OpenStreamInformation.DEFAULT); | ||
} | ||
|
||
LogicalIO createLogicalIO(S3URI s3URI, OpenFileInformation openFileInformation) | ||
LogicalIO createLogicalIO(S3URI s3URI, OpenStreamInformation openStreamInformation) | ||
throws IOException { | ||
switch (objectFormatSelector.getObjectFormat(s3URI, openFileInformation)) { | ||
switch (objectFormatSelector.getObjectFormat(s3URI, openStreamInformation)) { | ||
case PARQUET: | ||
return new ParquetLogicalIOImpl( | ||
s3URI, | ||
|
@@ -128,7 +130,7 @@ LogicalIO createLogicalIO(S3URI s3URI, OpenFileInformation openFileInformation) | |
objectMetadataStore, | ||
objectBlobStore, | ||
telemetry, | ||
openFileInformation.getStreamContext()), | ||
openStreamInformation.getStreamContext()), | ||
telemetry, | ||
configuration.getLogicalIOConfiguration(), | ||
parquetColumnPrefetchStore); | ||
|
@@ -141,7 +143,7 @@ LogicalIO createLogicalIO(S3URI s3URI, OpenFileInformation openFileInformation) | |
objectMetadataStore, | ||
objectBlobStore, | ||
telemetry, | ||
openFileInformation.getStreamContext()), | ||
openStreamInformation.getStreamContext()), | ||
telemetry); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,19 +38,19 @@ public ObjectFormatSelector(LogicalIOConfiguration configuration) { | |
* Uses a regex matcher to select the file format based on the file extension of the key. | ||
* | ||
* @param s3URI the object's S3 URI | ||
* @param openFileInformation known file information for the file | ||
* @param openStreamInformation known file information for the file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
should be known stream info? |
||
* @return the file format of the object | ||
*/ | ||
public ObjectFormat getObjectFormat(S3URI s3URI, OpenFileInformation openFileInformation) { | ||
public ObjectFormat getObjectFormat(S3URI s3URI, OpenStreamInformation openStreamInformation) { | ||
|
||
// If the supplied policy in open file information is Sequential, then use the default input | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. still says Open file information |
||
// stream, regardless of the file format (even if it's parquet!). This is important for | ||
// applications like DISTCP, which use a "whole_file" read policy with S3A, where they will | ||
// read parquet file sequentially (as they simply need to copy over the file), | ||
// instead of the regular parquet pattern of footer first, then specific columns etc., so our | ||
// parquet specific optimisations are of no use there :( | ||
if (openFileInformation.getInputPolicy() != null | ||
&& openFileInformation.getInputPolicy().equals(InputPolicy.Sequential)) { | ||
if (openStreamInformation.getInputPolicy() != null | ||
&& openStreamInformation.getInputPolicy().equals(InputPolicy.Sequential)) { | ||
return ObjectFormat.DEFAULT; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,8 +23,6 @@ | |
import java.util.function.Function; | ||
import lombok.Getter; | ||
import lombok.NonNull; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration; | ||
import software.amazon.awssdk.core.async.AsyncResponseTransformer; | ||
import software.amazon.awssdk.services.s3.S3AsyncClient; | ||
|
@@ -41,7 +39,6 @@ | |
public class S3SdkObjectClient implements ObjectClient { | ||
private static final String HEADER_USER_AGENT = "User-Agent"; | ||
private static final String HEADER_REFERER = "Referer"; | ||
private static final Logger LOG = LoggerFactory.getLogger(S3SdkObjectClient.class); | ||
|
||
@Getter @NonNull private final S3AsyncClient s3AsyncClient; | ||
@NonNull private final Telemetry telemetry; | ||
|
@@ -185,8 +182,6 @@ public CompletableFuture<ObjectContent> getObject( | |
referrerHeader = getRequest.getReferrer().toString(); | ||
} | ||
|
||
LOG.info("auditHeaders {}", referrerHeader); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this logger still needed? |
||
|
||
builder.overrideConfiguration( | ||
AwsRequestOverrideConfiguration.builder() | ||
.putHeader(HEADER_REFERER, referrerHeader) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: These doc should be updated. It still says Open file information.