Fix GCS based ingestion if bucket name contains underscores (#12445)
authorTejaswini Bandlamudi <96047043+tejaswini-imply@users.noreply.github.com>
Thu, 21 Apr 2022 03:52:35 +0000 (09:22 +0530)
committerGitHub <noreply@github.com>
Thu, 21 Apr 2022 03:52:35 +0000 (09:22 +0530)
commit177e1856cdaf3e5aa7a5754d129fc1945b9f7c72
tree64f7dc53c6eb242edf15cac73624f091b37c372a
parent5099f5aa70baf679f3b29162eaa2c6846bdf776d
Fix GCS based ingestion if bucket name contains underscores (#12445)

GCP allows bucket names to contain underscores. When a location in such a bucket
is mapped to `java.net.URI`, `URI.getHost()` returns null. `URI.getHost()` is used as
the bucket name in `CloudObjectLocation`, leading to an NPE.

This commit uses `URI.getAuthority()` as the bucket name if `URI.getHost()` is null.
core/src/main/java/org/apache/druid/data/input/impl/CloudObjectLocation.java
core/src/test/java/org/apache/druid/data/input/impl/CloudObjectLocationTest.java