You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "github-code-scanning[bot] (via GitHub)" <gi...@apache.org> on 2023/05/22 22:52:47 UTC

[GitHub] [druid] github-code-scanning[bot] commented on a diff in pull request #14329: Extension to read and ingest iceberg data files

github-code-scanning[bot] commented on code in PR #14329:
URL: https://github.com/apache/druid/pull/14329#discussion_r1201265868


##########
extensions-core/s3-extensions/src/test/java/org/apache/druid/data/input/s3/S3InputSourceAdapterTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.data.input.s3;
+
+import com.amazonaws.ClientConfiguration;
+import com.amazonaws.services.s3.AmazonS3Client;
+import com.amazonaws.services.s3.AmazonS3ClientBuilder;
+import org.apache.druid.storage.s3.S3InputDataConfig;
+import org.apache.druid.storage.s3.ServerSideEncryptingAmazonS3;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class S3InputSourceAdapterTest
+{
+  @Test
+  public void testAdapterGet()
+  {
+    AmazonS3Client s3Client = EasyMock.createMock(AmazonS3Client.class);

Review Comment:
   ## Unread local variable
   
   Variable 'AmazonS3Client s3Client' is never read.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/4975)



##########
extensions-core/s3-extensions/src/test/java/org/apache/druid/data/input/s3/S3InputSourceAdapterTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.data.input.s3;
+
+import com.amazonaws.ClientConfiguration;
+import com.amazonaws.services.s3.AmazonS3Client;
+import com.amazonaws.services.s3.AmazonS3ClientBuilder;
+import org.apache.druid.storage.s3.S3InputDataConfig;
+import org.apache.druid.storage.s3.ServerSideEncryptingAmazonS3;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class S3InputSourceAdapterTest
+{
+  @Test
+  public void testAdapterGet()
+  {
+    AmazonS3Client s3Client = EasyMock.createMock(AmazonS3Client.class);
+    ClientConfiguration clientConfiguration = EasyMock.createMock(ClientConfiguration.class);
+    ServerSideEncryptingAmazonS3.Builder serverSides3Builder =
+        EasyMock.createMock(ServerSideEncryptingAmazonS3.Builder.class);
+    AmazonS3ClientBuilder s3ClientBuilder = AmazonS3Client.builder();

Review Comment:
   ## Unread local variable
   
   Variable 'AmazonS3ClientBuilder s3ClientBuilder' is never read.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/4977)



##########
extensions-contrib/druid-iceberg-extensions/src/main/java/org/apache/druid/iceberg/input/HiveIcebergCatalog.java:
##########
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.iceberg.input;
+
+import com.fasterxml.jackson.annotation.JacksonInject;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
+import org.apache.druid.iceberg.guice.HiveConf;
+import org.apache.druid.java.util.common.ISE;
+import org.apache.druid.java.util.common.logger.Logger;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.security.UserGroupInformation;
+import org.apache.iceberg.BaseMetastoreCatalog;
+import org.apache.iceberg.hive.HiveCatalog;
+
+import javax.annotation.Nullable;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Hive Metastore specific implementation of iceberg catalog.
+ * Kerberos authentication is performed if the credentials are provided in the catalog properties
+ */
+public class HiveIcebergCatalog extends IcebergCatalog
+{
+  public static final String TYPE_KEY = "hive";
+
+  @JsonProperty
+  private String warehousePath;
+
+  @JsonProperty
+  private String catalogUri;
+
+  @JsonProperty
+  private Map<String, String> catalogProperties;
+
+  private final Configuration configuration;
+
+  private BaseMetastoreCatalog hiveCatalog;
+
+  private static final Logger log = new Logger(HiveIcebergCatalog.class);
+
+  @JsonCreator
+  public HiveIcebergCatalog(
+      @JsonProperty("warehousePath") String warehousePath,
+      @JsonProperty("catalogUri") String catalogUri,
+      @JsonProperty("catalogProperties") @Nullable
+          Map<String, String> catalogProperties,
+      @JacksonInject @HiveConf Configuration configuration
+  )
+  {
+    this.warehousePath = Preconditions.checkNotNull(warehousePath, "warehousePath cannot be null");
+    this.catalogUri = Preconditions.checkNotNull(catalogUri, "catalogUri cannot be null");
+    this.catalogProperties = catalogProperties != null ? catalogProperties : new HashMap<>();
+    this.configuration = configuration;
+    catalogProperties

Review Comment:
   ## Dereferenced variable may be null
   
   Variable [catalogProperties](1) may be null at this access as suggested by [this](2) null guard.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/4978)



##########
extensions-core/s3-extensions/src/test/java/org/apache/druid/data/input/s3/S3InputSourceAdapterTest.java:
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.data.input.s3;
+
+import com.amazonaws.ClientConfiguration;
+import com.amazonaws.services.s3.AmazonS3Client;
+import com.amazonaws.services.s3.AmazonS3ClientBuilder;
+import org.apache.druid.storage.s3.S3InputDataConfig;
+import org.apache.druid.storage.s3.ServerSideEncryptingAmazonS3;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class S3InputSourceAdapterTest
+{
+  @Test
+  public void testAdapterGet()
+  {
+    AmazonS3Client s3Client = EasyMock.createMock(AmazonS3Client.class);
+    ClientConfiguration clientConfiguration = EasyMock.createMock(ClientConfiguration.class);

Review Comment:
   ## Unread local variable
   
   Variable 'ClientConfiguration clientConfiguration' is never read.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/4976)



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

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org