You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kr...@apache.org on 2016/04/28 22:08:27 UTC

lucene-solr:jira/solr-8593: Fix license location and CloudSolrClient leak

Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-8593 01a21000a -> e554ae404


Fix license location and CloudSolrClient leak


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/e554ae40
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/e554ae40
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/e554ae40

Branch: refs/heads/jira/solr-8593
Commit: e554ae404c7f9b1e452bfd01ba692a9b2f3fa4ae
Parents: 01a2100
Author: Kevin Risden <kr...@apache.org>
Authored: Thu Apr 28 15:08:22 2016 -0500
Committer: Kevin Risden <kr...@apache.org>
Committed: Thu Apr 28 15:08:22 2016 -0500

----------------------------------------------------------------------
 .../apache/solr/handler/sql/SolrEnumerator.java | 17 +++--
 .../org/apache/solr/handler/sql/SolrFilter.java | 33 +++++-----
 .../org/apache/solr/handler/sql/SolrMethod.java | 15 ++---
 .../apache/solr/handler/sql/SolrProject.java    | 33 +++++-----
 .../org/apache/solr/handler/sql/SolrRel.java    | 25 ++++----
 .../org/apache/solr/handler/sql/SolrRules.java  | 33 +++++-----
 .../org/apache/solr/handler/sql/SolrSchema.java | 67 ++++++++++----------
 .../solr/handler/sql/SolrSchemaFactory.java     | 15 ++---
 .../org/apache/solr/handler/sql/SolrSort.java   | 33 +++++-----
 .../org/apache/solr/handler/sql/SolrTable.java  | 51 ++++++++-------
 .../apache/solr/handler/sql/SolrTableScan.java  | 25 ++++----
 .../handler/sql/SolrToEnumerableConverter.java  | 33 +++++-----
 .../sql/SolrToEnumerableConverterRule.java      | 13 ++--
 .../apache/solr/handler/sql/package-info.java   | 17 +++++
 14 files changed, 209 insertions(+), 201 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrEnumerator.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrEnumerator.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrEnumerator.java
index 8697b07..cd35438 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrEnumerator.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrEnumerator.java
@@ -1,12 +1,3 @@
-package org.apache.solr.handler.sql;
-
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.calcite.linq4j.Enumerator;
-import org.apache.solr.client.solrj.io.Tuple;
-import org.apache.solr.client.solrj.io.stream.TupleStream;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -23,6 +14,14 @@ import org.apache.solr.client.solrj.io.stream.TupleStream;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.solr.handler.sql;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.calcite.linq4j.Enumerator;
+import org.apache.solr.client.solrj.io.Tuple;
+import org.apache.solr.client.solrj.io.stream.TupleStream;
 
 /** Enumerator that reads from a Solr collection. */
 class SolrEnumerator implements Enumerator<Object> {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrFilter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrFilter.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrFilter.java
index 12113b4..1828ae5 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrFilter.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrFilter.java
@@ -1,3 +1,19 @@
+/*
+ * 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.solr.handler.sql;
 
 import java.util.ArrayList;
@@ -16,23 +32,6 @@ import org.apache.calcite.rex.RexInputRef;
 import org.apache.calcite.rex.RexLiteral;
 import org.apache.calcite.rex.RexNode;
 
-/*
- * 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.
- */
-
 /**
  * Implementation of a {@link org.apache.calcite.rel.core.Filter} relational expression in Solr.
  */

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrMethod.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrMethod.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrMethod.java
index 7e3fae2..323f135 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrMethod.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrMethod.java
@@ -1,11 +1,3 @@
-package org.apache.solr.handler.sql;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
-import com.google.common.collect.ImmutableMap;
-import org.apache.calcite.linq4j.tree.Types;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -22,6 +14,13 @@ import org.apache.calcite.linq4j.tree.Types;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.solr.handler.sql;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.calcite.linq4j.tree.Types;
 
 /**
  * Builtin methods in the Solr adapter.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrProject.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrProject.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrProject.java
index ee44dd1..26d9ee0 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrProject.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrProject.java
@@ -1,3 +1,19 @@
+/*
+ * 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.solr.handler.sql;
 
 import java.util.HashMap;
@@ -16,23 +32,6 @@ import org.apache.calcite.rel.type.RelDataType;
 import org.apache.calcite.rex.RexNode;
 import org.apache.calcite.util.Pair;
 
-/*
- * 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.
- */
-
 /**
  * Implementation of {@link org.apache.calcite.rel.core.Project} relational expression in Solr.
  */

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrRel.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrRel.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrRel.java
index 44afee3..a61cc3f 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrRel.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrRel.java
@@ -1,14 +1,3 @@
-package org.apache.solr.handler.sql;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.calcite.plan.Convention;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.rel.RelNode;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -25,6 +14,16 @@ import org.apache.calcite.rel.RelNode;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.solr.handler.sql;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.calcite.plan.Convention;
+import org.apache.calcite.plan.RelOptTable;
+import org.apache.calcite.rel.RelNode;
 
 /**
  * Relational expression that uses Solr calling convention.
@@ -32,8 +31,8 @@ import org.apache.calcite.rel.RelNode;
 public interface SolrRel extends RelNode {
   void implement(Implementor implementor);
 
-  /** Calling convention for relational operations that occur in Cassandra. */
-  Convention CONVENTION = new Convention.Impl("SOLR", SolrRel.class);
+  /** Calling convention for relational operations that occur in Solr. */
+  Convention CONVENTION = new Convention.Impl("Solr", SolrRel.class);
 
   /** Callback for the implementation process that converts a tree of {@link SolrRel} nodes into a Solr query. */
   class Implementor {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrRules.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrRules.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrRules.java
index d1fdbce..9cefc55 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrRules.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrRules.java
@@ -1,3 +1,19 @@
+/*
+ * 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.solr.handler.sql;
 
 import java.util.AbstractList;
@@ -19,23 +35,6 @@ import org.apache.calcite.rex.RexNode;
 import org.apache.calcite.rex.RexVisitorImpl;
 import org.apache.calcite.sql.validate.SqlValidatorUtil;
 
-/*
- * 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.
- */
-
 /**
  * Rules and relational operators for
  * {@link SolrRel#CONVENTION}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java
index cfba33a..84b5b15 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrSchema.java
@@ -1,3 +1,19 @@
+/*
+ * 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.solr.handler.sql;
 
 import java.io.IOException;
@@ -20,53 +36,40 @@ import org.apache.solr.client.solrj.request.LukeRequest;
 import org.apache.solr.client.solrj.response.LukeResponse;
 import org.apache.solr.common.luke.FieldFlag;
 
-/*
- * 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.
- */
-
 class SolrSchema extends AbstractSchema {
-  final CloudSolrClient cloudSolrClient;
+  final String zk;
 
   SolrSchema(String zk) {
     super();
-    this.cloudSolrClient = new CloudSolrClient(zk);
-    this.cloudSolrClient.connect();
+    this.zk = zk;
   }
 
   @Override
   protected Map<String, Table> getTableMap() {
-    this.cloudSolrClient.connect();
-    Set<String> collections = this.cloudSolrClient.getZkStateReader().getClusterState().getCollections();
-    final ImmutableMap.Builder<String, Table> builder = ImmutableMap.builder();
-    for (String collection : collections) {
-      builder.put(collection, new SolrTable(this, collection));
+    try(CloudSolrClient cloudSolrClient = new CloudSolrClient.Builder().withZkHost(zk).build()) {
+      cloudSolrClient.connect();
+      Set<String> collections = cloudSolrClient.getZkStateReader().getClusterState().getCollections();
+
+      final ImmutableMap.Builder<String, Table> builder = ImmutableMap.builder();
+      for (String collection : collections) {
+        builder.put(collection, new SolrTable(this, collection));
+      }
+      return builder.build();
+    } catch (IOException e) {
+      throw new RuntimeException(e);
     }
-    return builder.build();
   }
 
   private Map<String, LukeResponse.FieldInfo> getFieldInfo(String collection) {
-    LukeRequest lukeRequest = new LukeRequest();
-    lukeRequest.setNumTerms(0);
-    LukeResponse lukeResponse;
-    try {
-      lukeResponse = lukeRequest.process(cloudSolrClient, collection);
+    try(CloudSolrClient cloudSolrClient = new CloudSolrClient.Builder().withZkHost(zk).build()) {
+      cloudSolrClient.connect();
+      LukeRequest lukeRequest = new LukeRequest();
+      lukeRequest.setNumTerms(0);
+      LukeResponse lukeResponse = lukeRequest.process(cloudSolrClient, collection);
+      return lukeResponse.getFieldInfo();
     } catch (SolrServerException | IOException e) {
       throw new RuntimeException(e);
     }
-    return lukeResponse.getFieldInfo();
   }
 
   RelProtoDataType getRelDataType(String collection) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrSchemaFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrSchemaFactory.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrSchemaFactory.java
index f0a6ba0..84ace8a 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrSchemaFactory.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrSchemaFactory.java
@@ -1,11 +1,3 @@
-package org.apache.solr.handler.sql;
-
-import java.util.Map;
-
-import org.apache.calcite.schema.Schema;
-import org.apache.calcite.schema.SchemaFactory;
-import org.apache.calcite.schema.SchemaPlus;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -22,6 +14,13 @@ import org.apache.calcite.schema.SchemaPlus;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.solr.handler.sql;
+
+import java.util.Map;
+
+import org.apache.calcite.schema.Schema;
+import org.apache.calcite.schema.SchemaFactory;
+import org.apache.calcite.schema.SchemaPlus;
 
 @SuppressWarnings("UnusedDeclaration")
 public class SolrSchemaFactory implements SchemaFactory {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrSort.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrSort.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrSort.java
index 0945984..465986b 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrSort.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrSort.java
@@ -1,3 +1,19 @@
+/*
+ * 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.solr.handler.sql;
 
 import java.util.ArrayList;
@@ -16,23 +32,6 @@ import org.apache.calcite.rel.type.RelDataTypeField;
 import org.apache.calcite.rex.RexLiteral;
 import org.apache.calcite.rex.RexNode;
 
-/*
- * 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.
- */
-
 /**
  * Implementation of {@link org.apache.calcite.rel.core.Sort} relational expression in Solr.
  */

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrTable.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrTable.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrTable.java
index 0390040..8ed7e38 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrTable.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrTable.java
@@ -1,3 +1,19 @@
+/*
+ * 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.solr.handler.sql;
 
 import java.io.IOException;
@@ -26,23 +42,6 @@ import org.apache.solr.client.solrj.io.stream.CloudSolrStream;
 import org.apache.solr.client.solrj.io.stream.TupleStream;
 import org.apache.solr.common.params.CommonParams;
 
-/*
- * 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.
- */
-
 /**
  * Table based on a Solr collection
  */
@@ -70,18 +69,18 @@ public class SolrTable extends AbstractQueryableTable implements TranslatableTab
     return protoRowType.apply(typeFactory);
   }
   
-  public Enumerable<Object> query(final CloudSolrClient cloudSolrClient) {
-    return query(cloudSolrClient, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), null);
+  public Enumerable<Object> query(final String zk) {
+    return query(zk, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), null);
   }
 
   /** Executes a Solr query on the underlying table.
    *
-   * @param cloudSolrClient Solr CloudSolrClient
+   * @param zk Solr ZooKeeper connection string
    * @param fields List of fields to project
    * @param filterQueries A list of filterQueries which should be used in the query
    * @return Enumerator of results
    */
-  public Enumerable<Object> query(final CloudSolrClient cloudSolrClient, List<String> fields,
+  public Enumerable<Object> query(final String zk, List<String> fields,
                                   List<String> filterQueries, List<String> order, String limit) {
     Map<String, String> solrParams = new HashMap<>();
     solrParams.put(CommonParams.Q, "*:*");
@@ -117,7 +116,7 @@ public class SolrTable extends AbstractQueryableTable implements TranslatableTab
       public Enumerator<Object> enumerator() {
         TupleStream cloudSolrStream;
         try {
-          cloudSolrStream = new CloudSolrStream(cloudSolrClient.getZkHost(), collection, solrParams);
+          cloudSolrStream = new CloudSolrStream(zk, collection, solrParams);
           cloudSolrStream.open();
         } catch (IOException e) {
           throw new RuntimeException(e);
@@ -144,7 +143,7 @@ public class SolrTable extends AbstractQueryableTable implements TranslatableTab
 
     public Enumerator<T> enumerator() {
       //noinspection unchecked
-      final Enumerable<T> enumerable = (Enumerable<T>) getTable().query(getCloudSolrClient());
+      final Enumerable<T> enumerable = (Enumerable<T>) getTable().query(getZK());
       return enumerable.enumerator();
     }
 
@@ -152,8 +151,8 @@ public class SolrTable extends AbstractQueryableTable implements TranslatableTab
       return (SolrTable) table;
     }
 
-    private CloudSolrClient getCloudSolrClient() {
-      return schema.unwrap(SolrSchema.class).cloudSolrClient;
+    private String getZK() {
+      return schema.unwrap(SolrSchema.class).zk;
     }
 
     /** Called via code-generation.
@@ -162,7 +161,7 @@ public class SolrTable extends AbstractQueryableTable implements TranslatableTab
      */
     @SuppressWarnings("UnusedDeclaration")
     public Enumerable<Object> query(List<String> fields, List<String> filterQueries, List<String> order, String limit) {
-      return getTable().query(getCloudSolrClient(), fields, filterQueries, order, limit);
+      return getTable().query(getZK(), fields, filterQueries, order, limit);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrTableScan.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrTableScan.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrTableScan.java
index 4655a01..45eb09c 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrTableScan.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrTableScan.java
@@ -1,16 +1,3 @@
-package org.apache.solr.handler.sql;
-
-import java.util.List;
-
-import org.apache.calcite.plan.RelOptCluster;
-import org.apache.calcite.plan.RelOptPlanner;
-import org.apache.calcite.plan.RelOptRule;
-import org.apache.calcite.plan.RelOptTable;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.core.TableScan;
-import org.apache.calcite.rel.type.RelDataType;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -27,6 +14,18 @@ import org.apache.calcite.rel.type.RelDataType;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.solr.handler.sql;
+
+import java.util.List;
+
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelOptPlanner;
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptTable;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.TableScan;
+import org.apache.calcite.rel.type.RelDataType;
 
 /**
  * Relational expression representing a scan of a Solr collection.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverter.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverter.java
index 6ee7908..7655855 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverter.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverter.java
@@ -1,3 +1,19 @@
+/*
+ * 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.solr.handler.sql;
 
 import java.util.ArrayList;
@@ -27,23 +43,6 @@ import org.apache.calcite.rel.type.RelDataType;
 import org.apache.calcite.runtime.Hook;
 import org.apache.calcite.util.BuiltInMethod;
 
-/*
- * 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.
- */
-
 /**
  * Relational expression representing a scan of a table in Solr
  */

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverterRule.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverterRule.java b/solr/core/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverterRule.java
index a97e047..80365ca 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverterRule.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverterRule.java
@@ -1,10 +1,3 @@
-package org.apache.solr.handler.sql;
-
-import org.apache.calcite.adapter.enumerable.EnumerableConvention;
-import org.apache.calcite.plan.RelTraitSet;
-import org.apache.calcite.rel.RelNode;
-import org.apache.calcite.rel.convert.ConverterRule;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -21,6 +14,12 @@ import org.apache.calcite.rel.convert.ConverterRule;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.solr.handler.sql;
+
+import org.apache.calcite.adapter.enumerable.EnumerableConvention;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.convert.ConverterRule;
 
 /**
  * Rule to convert a relational expression from {@link SolrRel#CONVENTION} to {@link EnumerableConvention}.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e554ae40/solr/core/src/java/org/apache/solr/handler/sql/package-info.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/sql/package-info.java b/solr/core/src/java/org/apache/solr/handler/sql/package-info.java
index 7346ec5..5aef90d 100644
--- a/solr/core/src/java/org/apache/solr/handler/sql/package-info.java
+++ b/solr/core/src/java/org/apache/solr/handler/sql/package-info.java
@@ -1,3 +1,20 @@
+/*
+ * 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.
+ */
+
 /**
  * Classes related to Apache Calcite implementation in {@link org.apache.solr.handler.SQLHandler}
  */