jon-wei commented on a change in pull request #9360: Create splits of multiple
files for parallel indexing
URL: https://github.com/apache/druid/pull/9360#discussion_r382871722
##########
File path:
extensions-core/google-extensions/src/main/java/org/apache/druid/data/input/google/GoogleCloudStorageInputSource.java
##########
@@ -59,23 +65,42 @@ public GoogleCloudStorageInputSource(
}
@Override
- protected GoogleCloudStorageEntity
createEntity(InputSplit<CloudObjectLocation> split)
+ protected InputEntity createEntity(CloudObjectLocation location)
{
- return new GoogleCloudStorageEntity(storage, split.get());
+ return new GoogleCloudStorageEntity(storage, location);
}
@Override
- protected Stream<InputSplit<CloudObjectLocation>> getPrefixesSplitStream()
+ protected Stream<InputSplit<List<CloudObjectLocation>>>
getPrefixesSplitStream(@Nonnull SplitHintSpec splitHintSpec)
{
- return StreamSupport.stream(storageObjectIterable().spliterator(), false)
- .map(this::byteSourceFromStorageObject)
- .map(InputSplit::new);
+ final Iterator<List<StorageObject>> splitIterator = splitHintSpec.split(
+ storageObjectIterable().iterator(),
+ storageObject -> {
+ final BigInteger sizeInBigInteger = storageObject.getSize();
+ long sizeInLong;
+ if (sizeInBigInteger == null) {
+ sizeInLong = Long.MAX_VALUE;
+ } else {
+ try {
+ sizeInLong = sizeInBigInteger.longValueExact();
+ }
+ catch (ArithmeticException e) {
+ sizeInLong = Long.MAX_VALUE;
Review comment:
Should this propagate the exception instead? If we get an object with a byte
size that can't be stored in a long, something seems very wrong
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]