Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 49 additions & 14 deletions druid-handler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<name>Hive Druid Handler</name>
<properties>
<hive.path.to.root>..</hive.path.to.root>
<druid.guava.version>16.0.1</druid.guava.version>
<druid.guava.version>${guava.version}</druid.guava.version>
</properties>
<dependencies>
<!-- dependencies are always listed in sorted order by groupId, artifactId -->
Expand All @@ -34,6 +34,14 @@
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-smile</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand Down Expand Up @@ -77,13 +85,16 @@
<version>${druid.guava.version}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
<version>${netty3.version}</version>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<dependency>
<groupId>org.apache.druid</groupId>
Expand Down Expand Up @@ -114,6 +125,10 @@
<groupId>io.netty</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
Expand All @@ -130,6 +145,26 @@
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
<exclusion>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
Expand Down Expand Up @@ -332,10 +367,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<!-- we need to shade netty, as there is a conflict between versions
used by Hadoop (3.6.2.Final) and Druid (3.10.4.Final) -->
<!-- we need to shade jackson, as there is a conflict between versions
used by Hive (2.4.2) and Druid (2.4.6) -->
<!-- we need to shade netty 4, as there is a conflict between versions
used by Hadoop and Druid -->
<!-- we need to shade jackson and async-http-client to use Hive-managed
patched versions rather than legacy Druid transitives -->
<execution>
<phase>package</phase>
<goals>
Expand All @@ -357,10 +392,6 @@
<pattern>org.apache.calcite</pattern>
<shadedPattern>org.apache.hive.druid.org.apache.calcite</shadedPattern>
</relocation>
<relocation>
<pattern>org.jboss.netty</pattern>
<shadedPattern>org.apache.hive.druid.org.jboss.netty</shadedPattern>
</relocation>
<relocation>
<pattern>com.fasterxml.jackson</pattern>
<shadedPattern>org.apache.hive.druid.com.fasterxml.jackson</shadedPattern>
Expand Down Expand Up @@ -393,6 +424,10 @@
<include>org.asynchttpclient:*</include>
<include>org.antlr:*</include>
</includes>
<excludes>
<!-- HIVE-25013: Netty 3 (io.netty:netty) is EOL with no CVE fix; HTTP uses Apache HttpClient -->
<exclude>io.netty:netty</exclude>
</excludes>
</artifactSet>
<filters>
<filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@
import org.apache.druid.data.input.impl.JSONParseSpec;
import org.apache.druid.data.input.impl.StringInputRowParser;
import org.apache.druid.data.input.impl.TimestampSpec;
import org.apache.druid.java.util.http.client.Request;
import org.apache.druid.java.util.http.client.response.StringFullResponseHandler;
import org.apache.druid.java.util.http.client.response.StringFullResponseHolder;
import org.apache.druid.segment.IndexSpec;
import org.apache.druid.segment.indexing.DataSchema;
import org.apache.druid.segment.writeout.TmpFileSegmentWriteOutMediumFactory;
import org.apache.hadoop.hive.druid.conf.DruidConstants;
import org.apache.hadoop.hive.druid.http.HiveDruidHttpRequest;
import org.apache.hadoop.hive.druid.http.HiveDruidHttpResponse;
import org.apache.hadoop.hive.druid.json.AvroParseSpec;
import org.apache.hadoop.hive.druid.json.AvroStreamInputRowParser;
import org.apache.hadoop.hive.druid.json.InlineSchemaAvroBytesDecoder;
Expand All @@ -43,8 +42,6 @@
import org.apache.hadoop.hive.druid.json.KafkaSupervisorTuningConfig;
import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.ql.session.SessionState;
import org.jboss.netty.handler.codec.http.HttpMethod;
import org.jboss.netty.handler.codec.http.HttpResponseStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -159,22 +156,21 @@ static void updateKafkaIngestionSpec(String overlordAddress, KafkaSupervisorSpec
String task = JSON_MAPPER.writeValueAsString(spec);
CONSOLE.printInfo("submitting kafka Spec {}", task);
LOG.info("submitting kafka Supervisor Spec {}", task);
StringFullResponseHolder response = DruidStorageHandlerUtils
.getResponseFromCurrentLeader(DruidStorageHandler.getHttpClient(), new Request(HttpMethod.POST,
new URL(String.format("http://%s/druid/indexer/v1/supervisor", overlordAddress)))
.setContent("application/json", JSON_MAPPER.writeValueAsBytes(spec)),
new StringFullResponseHandler(Charset.forName("UTF-8")));
if (response.getStatus().equals(HttpResponseStatus.OK)) {
String
msg =
String.format("Kafka Supervisor for [%s] Submitted Successfully to druid.",
spec.getDataSchema().getDataSource());
HiveDruidHttpResponse response = DruidStorageHandlerUtils.getResponseFromCurrentLeader(
DruidStorageHandler.getHttpClient(),
new HiveDruidHttpRequest("POST",
new URL(String.format("http://%s/druid/indexer/v1/supervisor", overlordAddress)))
.setContent(JSON_MAPPER.writeValueAsBytes(spec))
.setHeader("Content-Type", "application/json"));
if (response.getStatusCode() == HiveDruidHttpResponse.SC_OK) {
String msg = String.format("Kafka Supervisor for [%s] Submitted Successfully to druid.",
spec.getDataSchema().getDataSource());
LOG.info(msg);
CONSOLE.printInfo(msg);
} else {
throw new IOException(String.format("Unable to update Kafka Ingestion for Druid status [%d] full response [%s]",
response.getStatus().getCode(),
response.getContent()));
throw new IOException(String.format(
"Unable to update Kafka Ingestion for Druid status [%d] full response [%s]",
response.getStatusCode(), response.getContent()));
}
} catch (Exception e) {
throw new RuntimeException(e);
Expand Down
Loading
Loading