SOLR-10444: SQL interface does not use client cache

This commit is contained in:
Joel Bernstein 2017-04-06 21:17:02 -04:00
parent 6e5f6fab53
commit 865f9b2b01
2 changed files with 10 additions and 0 deletions

View File

@ -115,6 +115,10 @@ public class StreamHandler extends RequestHandlerBase implements SolrCoreAware,
return PermissionNameProvider.Name.READ_PERM;
}
public static SolrClientCache getClientCache() {
return clientCache;
}
public void inform(SolrCore core) {
/* The stream factory will always contain the zkUrl for the given collection

View File

@ -28,6 +28,7 @@ import org.apache.calcite.schema.SchemaPlus;
import org.apache.calcite.schema.TranslatableTable;
import org.apache.calcite.schema.impl.AbstractTableQueryable;
import org.apache.calcite.util.Pair;
import org.apache.solr.client.solrj.io.SolrClientCache;
import org.apache.solr.client.solrj.io.comp.ComparatorOrder;
import org.apache.solr.client.solrj.io.comp.FieldComparator;
import org.apache.solr.client.solrj.io.comp.MultipleFieldComparator;
@ -51,6 +52,7 @@ import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
import org.apache.solr.client.solrj.io.stream.metrics.*;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.handler.StreamHandler;
import java.io.IOException;
import java.util.*;
@ -158,6 +160,10 @@ class SolrTable extends AbstractQueryableTable implements TranslatableTable {
throw new RuntimeException(e);
}
StreamContext streamContext = new StreamContext();
streamContext.setSolrClientCache(StreamHandler.getClientCache());
tupleStream.setStreamContext(streamContext);
final TupleStream finalStream = tupleStream;
return new AbstractEnumerable<Object>() {