Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,19 @@

public class MongoIndex
{
private final String name;
private final List<MongodbIndexKey> keys;
private final boolean unique;

public static List<MongoIndex> parse(ListIndexesIterable<Document> indexes)
{
ImmutableList.Builder<MongoIndex> builder = ImmutableList.builder();
for (Document index : indexes) {
// TODO: v, ns, sparse fields
Document key = (Document) index.get("key");
String name = index.getString("name");
boolean unique = index.getBoolean("unique", false);

if (key.containsKey("_fts")) { // Full Text Search
continue;
}
builder.add(new MongoIndex(name, parseKey(key), unique));
builder.add(new MongoIndex(parseKey(key)));
}

return builder.build();
Expand Down Expand Up @@ -70,28 +66,16 @@ else if (value instanceof String) {
return builder.build();
}

public MongoIndex(String name, List<MongodbIndexKey> keys, boolean unique)
public MongoIndex(List<MongodbIndexKey> keys)
{
this.name = name;
this.keys = keys;
this.unique = unique;
}

public String getName()
{
return name;
}

public List<MongodbIndexKey> getKeys()
{
return keys;
}

public boolean isUnique()
{
return unique;
}

public static class MongodbIndexKey
{
private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@
*/
package io.trino.plugin.mongodb;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.google.common.primitives.Shorts;
import com.google.common.primitives.SignedBytes;
import com.mongodb.DBRef;
import com.mongodb.client.MongoCursor;
import io.airlift.slice.Slice;
import io.airlift.slice.SliceOutput;
import io.trino.spi.Page;
import io.trino.spi.PageBuilder;
import io.trino.spi.TrinoException;
Expand All @@ -41,8 +38,6 @@
import org.bson.types.ObjectId;
import org.joda.time.chrono.ISOChronology;

import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -275,12 +270,6 @@ else if (isJsonType(type)) {
}
}

public static JsonGenerator createJsonGenerator(JsonFactory factory, SliceOutput output)
throws IOException
{
return factory.createGenerator((OutputStream) output);
}

private void writeBlock(BlockBuilder output, Type type, Object value)
{
if (isArrayType(type)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
*/
package io.trino.plugin.mongodb;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
Expand All @@ -39,12 +38,6 @@ public final class MongoQueryRunner

private MongoQueryRunner() {}

public static DistributedQueryRunner createMongoQueryRunner(MongoServer server, TpchTable<?>... tables)
throws Exception
{
return createMongoQueryRunner(server, ImmutableMap.of(), ImmutableList.copyOf(tables));
}

public static DistributedQueryRunner createMongoQueryRunner(MongoServer server, Map<String, String> extraProperties, Iterable<TpchTable<?>> tables)
throws Exception
{
Expand Down