From e554ae404c7f9b1e452bfd01ba692a9b2f3fa4ae Mon Sep 17 00:00:00 2001 From: Kevin Risden Date: Thu, 28 Apr 2016 15:08:22 -0500 Subject: [PATCH] Fix license location and CloudSolrClient leak --- .../solr/handler/sql/SolrEnumerator.java | 17 +++-- .../apache/solr/handler/sql/SolrFilter.java | 33 +++++---- .../apache/solr/handler/sql/SolrMethod.java | 15 ++--- .../apache/solr/handler/sql/SolrProject.java | 33 +++++---- .../org/apache/solr/handler/sql/SolrRel.java | 25 ++++--- .../apache/solr/handler/sql/SolrRules.java | 33 +++++---- .../apache/solr/handler/sql/SolrSchema.java | 67 ++++++++++--------- .../solr/handler/sql/SolrSchemaFactory.java | 15 ++--- .../org/apache/solr/handler/sql/SolrSort.java | 33 +++++---- .../apache/solr/handler/sql/SolrTable.java | 51 +++++++------- .../solr/handler/sql/SolrTableScan.java | 25 ++++--- .../sql/SolrToEnumerableConverter.java | 33 +++++---- .../sql/SolrToEnumerableConverterRule.java | 13 ++-- .../apache/solr/handler/sql/package-info.java | 17 +++++ 14 files changed, 209 insertions(+), 201 deletions(-) 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 8697b07ca7b..cd354389b6f 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 { 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 12113b441a5..1828ae532db 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. */ 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 7e3fae2b163..323f1353443 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. 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 ee44dd1d878..26d9ee0dde1 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. */ 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 44afee3869b..a61cc3f5619 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 { 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 d1fdbce5a5a..9cefc55d605 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} 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 cfba33adfab..84b5b150c74 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 getTableMap() { - this.cloudSolrClient.connect(); - Set collections = this.cloudSolrClient.getZkStateReader().getClusterState().getCollections(); - final ImmutableMap.Builder 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 collections = cloudSolrClient.getZkStateReader().getClusterState().getCollections(); + + final ImmutableMap.Builder 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 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) { 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 f0a6ba0e356..84ace8a2a0b 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 { 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 0945984ec5a..465986b96f1 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. */ 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 0390040654d..8ed7e38da71 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 query(final CloudSolrClient cloudSolrClient) { - return query(cloudSolrClient, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), null); + public Enumerable 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 query(final CloudSolrClient cloudSolrClient, List fields, + public Enumerable query(final String zk, List fields, List filterQueries, List order, String limit) { Map solrParams = new HashMap<>(); solrParams.put(CommonParams.Q, "*:*"); @@ -117,7 +116,7 @@ public class SolrTable extends AbstractQueryableTable implements TranslatableTab public Enumerator 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 enumerator() { //noinspection unchecked - final Enumerable enumerable = (Enumerable) getTable().query(getCloudSolrClient()); + final Enumerable enumerable = (Enumerable) 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 query(List fields, List filterQueries, List order, String limit) { - return getTable().query(getCloudSolrClient(), fields, filterQueries, order, limit); + return getTable().query(getZK(), fields, filterQueries, order, limit); } } } 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 4655a01d041..45eb09c4e00 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. 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 6ee7908c398..76558558e81 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 */ 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 a97e047f70b..80365caec1c 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}. 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 7346ec54050..5aef90dace2 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} */