jihoonson 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_r383479719
 
 

 ##########
 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:
   The length of a google storage object is the unsigned long type 
(https://cloud.google.com/storage/docs/json_api/v1/objects#resource-representations).
 I think it's better to work instead of failing. Added a warning log about the 
exception.

----------------------------------------------------------------
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]

Reply via email to