Skip to content

Commit 9494a30

Browse files
committed
Fix TestIPFSQueries not passing.
1 parent 39bab37 commit 9494a30

File tree

4 files changed

+20
-28
lines changed

4 files changed

+20
-28
lines changed

contrib/storage-ipfs/pom.xml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
<version>${project.version}</version>
2424
</dependency>
2525

26+
<dependency>
27+
<groupId>com.github.dbw9580</groupId>
28+
<artifactId>java-ipfs-http-client</artifactId>
29+
<version>v1.3.3</version>
30+
</dependency>
31+
2632
<!-- Test dependencies -->
2733
<dependency>
2834
<groupId>org.apache.drill.exec</groupId>
@@ -40,27 +46,6 @@
4046
<scope>test</scope>
4147
</dependency>
4248

43-
<dependency>
44-
<groupId>com.github.dbw9580</groupId>
45-
<artifactId>java-ipfs-http-client</artifactId>
46-
<version>v1.3.3</version>
47-
</dependency>
48-
<dependency>
49-
<groupId>com.fasterxml.jackson.core</groupId>
50-
<artifactId>jackson-annotations</artifactId>
51-
<version>2.9.0</version>
52-
</dependency>
53-
<dependency>
54-
<groupId>com.fasterxml.jackson.core</groupId>
55-
<artifactId>jackson-databind</artifactId>
56-
<version>2.9.0</version>
57-
</dependency>
58-
<dependency>
59-
<groupId>com.fasterxml.jackson.core</groupId>
60-
<artifactId>jackson-core</artifactId>
61-
<version>2.9.0</version>
62-
</dependency>
63-
6449
</dependencies>
6550

6651

contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSHelper.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.slf4j.LoggerFactory;
3232

3333
import java.io.IOException;
34+
import java.net.Inet6Address;
3435
import java.net.InetAddress;
3536
import java.net.UnknownHostException;
3637
import java.util.List;
@@ -144,6 +145,9 @@ public IPFSPeer getMyself() throws IOException {
144145
.filter(addr -> {
145146
try {
146147
InetAddress inetAddress = InetAddress.getByName(addr.getHost());
148+
if (inetAddress instanceof Inet6Address) {
149+
return false;
150+
}
147151
return inetAddress.isSiteLocalAddress()
148152
|| inetAddress.isLinkLocalAddress()
149153
|| inetAddress.isLoopbackAddress();
@@ -233,6 +237,10 @@ public static Optional<String> pickPeerHost(List<MultiAddress> peerAddrs) {
233237
String host = addr.getHost();
234238
try {
235239
InetAddress inetAddress = InetAddress.getByName(host);
240+
if (inetAddress instanceof Inet6Address) {
241+
// ignore IPv6 addresses
242+
continue;
243+
}
236244
if (inetAddress.isSiteLocalAddress() || inetAddress.isLinkLocalAddress()) {
237245
localAddr = host;
238246
} else {

contrib/storage-ipfs/src/main/java/org/apache/drill/exec/store/ipfs/IPFSSubScan.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
3636
import io.ipfs.multihash.Multihash;
3737
import org.apache.drill.common.PlanStringBuilder;
38-
import org.apache.drill.common.exceptions.ExecutionSetupException;
3938
import org.apache.drill.common.expression.SchemaPath;
4039
import org.apache.drill.exec.physical.base.AbstractBase;
4140
import org.apache.drill.exec.physical.base.PhysicalOperator;
@@ -65,7 +64,7 @@ public IPFSSubScan(@JacksonInject StoragePluginRegistry registry,
6564
@JsonProperty("IPFSSubScanSpec") @JsonDeserialize(using=MultihashDeserializer.class) List<Multihash> ipfsSubScanSpecList,
6665
@JsonProperty("format") IPFSScanSpec.Format format,
6766
@JsonProperty("columns") List<SchemaPath> columns
68-
) throws ExecutionSetupException {
67+
) {
6968
super((String) null);
7069
IPFSStoragePlugin plugin = registry.resolve(ipfsStoragePluginConfig, IPFSStoragePlugin.class);
7170
ipfsContext = plugin.getIPFSContext();
@@ -174,7 +173,7 @@ static class MultihashDeserializer extends JsonDeserializer<List<Multihash>> {
174173
@Override
175174
public List<Multihash> deserialize(JsonParser jp, DeserializationContext ctxt)
176175
throws IOException {
177-
assert jp.nextToken() == JsonToken.START_ARRAY;
176+
assert jp.currentToken() == JsonToken.START_ARRAY;
178177

179178
List<Multihash> multihashList = new ArrayList<>();
180179
while (jp.nextToken() != JsonToken.END_ARRAY) {

contrib/storage-ipfs/src/test/resources/bootstrap-storage-plugins.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"port": 5001,
77
"max-nodes-per-leaf": 1,
88
"ipfs-timeouts": {
9-
"find-provider": 2,
10-
"find-peer-info": 2,
11-
"fetch-data": 2
9+
"find-provider": 1,
10+
"find-peer-info": 1,
11+
"fetch-data": 1
1212
},
13-
"groupscan-worker-threads": 50,
13+
"groupscan-worker-threads": 5,
1414
"formats": null,
1515
"enabled": true
1616
}

0 commit comments

Comments
 (0)