This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 19ad2f36bfd Update org.apache.calcite - abandoned (#3119)
19ad2f36bfd is described below
commit 19ad2f36bfde83157cb7ac3276b707cedefd48e4
Author: Solr Bot <[email protected]>
AuthorDate: Tue Aug 25 00:24:29 2026 +0200
Update org.apache.calcite - abandoned (#3119)
Co-authored-by: Jan Høydahl <[email protected]>
Co-authored-by: Eric Pugh <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
.../PR#3119-update-org-apache-calcite.yml | 8 +
gradle/libs.versions.toml | 4 +-
solr/licenses/avatica-core-1.25.0.jar.sha1 | 1 -
solr/licenses/avatica-core-1.28.0.jar.sha1 | 1 +
solr/licenses/avatica-metrics-1.25.0.jar.sha1 | 1 -
solr/licenses/avatica-metrics-1.28.0.jar.sha1 | 1 +
solr/licenses/calcite-core-1.37.0.jar.sha1 | 1 -
solr/licenses/calcite-core-1.42.0.jar.sha1 | 1 +
solr/licenses/calcite-linq4j-1.37.0.jar.sha1 | 1 -
solr/licenses/calcite-linq4j-1.42.0.jar.sha1 | 1 +
solr/licenses/checker-qual-3.54.0.jar.sha1 | 1 +
solr/licenses/commons-compiler-3.1.11.jar.sha1 | 1 -
solr/licenses/commons-compiler-3.1.12.jar.sha1 | 1 +
solr/licenses/httpclient5-5.2.1.jar.sha1 | 1 -
solr/licenses/httpclient5-5.5.jar.sha1 | 1 +
solr/licenses/httpcore5-5.2.3.jar.sha1 | 1 -
solr/licenses/httpcore5-5.3.5.jar.sha1 | 1 +
solr/licenses/httpcore5-h2-5.2.jar.sha1 | 1 -
solr/licenses/httpcore5-h2-5.3.4.jar.sha1 | 1 +
solr/licenses/janino-3.1.11.jar.sha1 | 1 -
solr/licenses/janino-3.1.12.jar.sha1 | 1 +
solr/licenses/joou-java-6-0.9.4.jar.sha1 | 1 +
solr/licenses/joou-java-6-LICENSE-ASL.txt | 174 +++++++++++++++++++++
solr/licenses/joou-java-6-NOTICE.txt | 2 +
solr/modules/sql/gradle.lockfile | 21 +--
.../apache/solr/handler/sql/CalciteSolrDriver.java | 7 +
.../org/apache/solr/handler/sql/SolrAggregate.java | 11 --
.../apache/solr/handler/sql/SolrEnumerator.java | 1 -
.../org/apache/solr/handler/sql/SolrFilter.java | 26 +--
.../org/apache/solr/handler/sql/SolrProject.java | 5 +-
.../org/apache/solr/handler/sql/SolrRules.java | 110 +++++++++----
.../java/org/apache/solr/handler/sql/SolrSort.java | 2 +-
.../handler/sql/SolrToEnumerableConverterRule.java | 18 ++-
.../apache/solr/handler/sql/TestSQLHandler.java | 148 ++++++++++++++++++
solr/solr-ref-guide/gradle.lockfile | 21 +--
solr/solrj-streaming/gradle.lockfile | 21 +--
36 files changed, 495 insertions(+), 104 deletions(-)
diff --git a/changelog/unreleased/PR#3119-update-org-apache-calcite.yml
b/changelog/unreleased/PR#3119-update-org-apache-calcite.yml
new file mode 100644
index 00000000000..1be885fde76
--- /dev/null
+++ b/changelog/unreleased/PR#3119-update-org-apache-calcite.yml
@@ -0,0 +1,8 @@
+title: Update org.apache.calcite to 1.42.0 and Avatica to 1.28.0
+type: dependency_update
+authors:
+ - name: Eric Pugh
+ nick: epugh
+links:
+- name: PR#3119
+ url: https://github.com/apache/solr/pull/3119
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index ae9478a71e1..91c753dfaaf 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -24,8 +24,8 @@ antora = "3.1.12"
antora-default-ui = "782311344b54aaa734d4c86629b8cd75e4da36d6"
# @keep Antora Lunr extensions version used in ref-guide
antora-lunr-extension = "1.0.0-alpha.10"
-apache-calcite = "1.37.0"
-apache-calcite-avatica = "1.25.0"
+apache-calcite = "1.42.0"
+apache-calcite-avatica = "1.28.0"
apache-commons-collections4 = "4.5.0"
apache-commons-compress = "1.28.0"
apache-commons-exec = "1.6.0"
diff --git a/solr/licenses/avatica-core-1.25.0.jar.sha1
b/solr/licenses/avatica-core-1.25.0.jar.sha1
deleted file mode 100644
index 1fe8f3a4af4..00000000000
--- a/solr/licenses/avatica-core-1.25.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-73b9a0e7032a5ae89f294091bc6cbb9a67a21101
diff --git a/solr/licenses/avatica-core-1.28.0.jar.sha1
b/solr/licenses/avatica-core-1.28.0.jar.sha1
new file mode 100644
index 00000000000..2aa1a25dfc7
--- /dev/null
+++ b/solr/licenses/avatica-core-1.28.0.jar.sha1
@@ -0,0 +1 @@
+d5e10c96fc7447ff2c42866a4676d45720b7d043
diff --git a/solr/licenses/avatica-metrics-1.25.0.jar.sha1
b/solr/licenses/avatica-metrics-1.25.0.jar.sha1
deleted file mode 100644
index 0b3586336b0..00000000000
--- a/solr/licenses/avatica-metrics-1.25.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-152f846d9f30a3e026530c2087ecd65c39bb304b
diff --git a/solr/licenses/avatica-metrics-1.28.0.jar.sha1
b/solr/licenses/avatica-metrics-1.28.0.jar.sha1
new file mode 100644
index 00000000000..9cdac73e35a
--- /dev/null
+++ b/solr/licenses/avatica-metrics-1.28.0.jar.sha1
@@ -0,0 +1 @@
+ccfcd1abf8a5eebbcf0364ada7a14c7ff24168bd
diff --git a/solr/licenses/calcite-core-1.37.0.jar.sha1
b/solr/licenses/calcite-core-1.37.0.jar.sha1
deleted file mode 100644
index 91d833404de..00000000000
--- a/solr/licenses/calcite-core-1.37.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-537a3281dfefbd7939d27785732a2aafddd3abcb
diff --git a/solr/licenses/calcite-core-1.42.0.jar.sha1
b/solr/licenses/calcite-core-1.42.0.jar.sha1
new file mode 100644
index 00000000000..9a691763667
--- /dev/null
+++ b/solr/licenses/calcite-core-1.42.0.jar.sha1
@@ -0,0 +1 @@
+7de9279a71383a1aba2c1b51ff294ccea75c1342
diff --git a/solr/licenses/calcite-linq4j-1.37.0.jar.sha1
b/solr/licenses/calcite-linq4j-1.37.0.jar.sha1
deleted file mode 100644
index 7e81d14286e..00000000000
--- a/solr/licenses/calcite-linq4j-1.37.0.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-92446d8dfc8e57289e6120a7efc6932650ed3410
diff --git a/solr/licenses/calcite-linq4j-1.42.0.jar.sha1
b/solr/licenses/calcite-linq4j-1.42.0.jar.sha1
new file mode 100644
index 00000000000..148b7747a44
--- /dev/null
+++ b/solr/licenses/calcite-linq4j-1.42.0.jar.sha1
@@ -0,0 +1 @@
+8ea854065930c333946766480246fb828f2756db
diff --git a/solr/licenses/checker-qual-3.54.0.jar.sha1
b/solr/licenses/checker-qual-3.54.0.jar.sha1
new file mode 100644
index 00000000000..92727a15930
--- /dev/null
+++ b/solr/licenses/checker-qual-3.54.0.jar.sha1
@@ -0,0 +1 @@
+c3ce292a54faccba14e2a9f3077a4dc05e5770a8
diff --git a/solr/licenses/commons-compiler-3.1.11.jar.sha1
b/solr/licenses/commons-compiler-3.1.11.jar.sha1
deleted file mode 100644
index e4a23a4f2e3..00000000000
--- a/solr/licenses/commons-compiler-3.1.11.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-19d5bfd402f91de0e670ef5783bf5c0a3f5ab478
diff --git a/solr/licenses/commons-compiler-3.1.12.jar.sha1
b/solr/licenses/commons-compiler-3.1.12.jar.sha1
new file mode 100644
index 00000000000..19facd11f2c
--- /dev/null
+++ b/solr/licenses/commons-compiler-3.1.12.jar.sha1
@@ -0,0 +1 @@
+0501779107b06a981ff359eab7369ff7a2bf077e
diff --git a/solr/licenses/httpclient5-5.2.1.jar.sha1
b/solr/licenses/httpclient5-5.2.1.jar.sha1
deleted file mode 100644
index 5008d9aae80..00000000000
--- a/solr/licenses/httpclient5-5.2.1.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-0c900514d3446d9ce5d9dbd90c21192048125440
diff --git a/solr/licenses/httpclient5-5.5.jar.sha1
b/solr/licenses/httpclient5-5.5.jar.sha1
new file mode 100644
index 00000000000..0ba91544777
--- /dev/null
+++ b/solr/licenses/httpclient5-5.5.jar.sha1
@@ -0,0 +1 @@
+4b3d253351cf74eb0ae8eb21ca5a5fb9815ef861
diff --git a/solr/licenses/httpcore5-5.2.3.jar.sha1
b/solr/licenses/httpcore5-5.2.3.jar.sha1
deleted file mode 100644
index 9a0b58fcbfd..00000000000
--- a/solr/licenses/httpcore5-5.2.3.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-687cede1a44f70c7741abfab6ee2aa53dd2bfb54
diff --git a/solr/licenses/httpcore5-5.3.5.jar.sha1
b/solr/licenses/httpcore5-5.3.5.jar.sha1
new file mode 100644
index 00000000000..a30a39affb2
--- /dev/null
+++ b/solr/licenses/httpcore5-5.3.5.jar.sha1
@@ -0,0 +1 @@
+172790b48b0d8cb5d74f28dcf712b5e5a70c3440
diff --git a/solr/licenses/httpcore5-h2-5.2.jar.sha1
b/solr/licenses/httpcore5-h2-5.2.jar.sha1
deleted file mode 100644
index ff13228a443..00000000000
--- a/solr/licenses/httpcore5-h2-5.2.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-698bd8c759ccc7fd7398f3179ff45d0e5a7ccc16
diff --git a/solr/licenses/httpcore5-h2-5.3.4.jar.sha1
b/solr/licenses/httpcore5-h2-5.3.4.jar.sha1
new file mode 100644
index 00000000000..8a1dd9b0d90
--- /dev/null
+++ b/solr/licenses/httpcore5-h2-5.3.4.jar.sha1
@@ -0,0 +1 @@
+3742a9a9ba3a5a0d45be230093b52a1302a561e2
diff --git a/solr/licenses/janino-3.1.11.jar.sha1
b/solr/licenses/janino-3.1.11.jar.sha1
deleted file mode 100644
index 08e36c20aec..00000000000
--- a/solr/licenses/janino-3.1.11.jar.sha1
+++ /dev/null
@@ -1 +0,0 @@
-878a02f3ab98d37206c9852c025a46b86dc882d0
diff --git a/solr/licenses/janino-3.1.12.jar.sha1
b/solr/licenses/janino-3.1.12.jar.sha1
new file mode 100644
index 00000000000..6cdb19a7c1a
--- /dev/null
+++ b/solr/licenses/janino-3.1.12.jar.sha1
@@ -0,0 +1 @@
+ffcd3dfa84057ef76092b6b66c53871a97ae40b8
diff --git a/solr/licenses/joou-java-6-0.9.4.jar.sha1
b/solr/licenses/joou-java-6-0.9.4.jar.sha1
new file mode 100644
index 00000000000..a9930eaf0ac
--- /dev/null
+++ b/solr/licenses/joou-java-6-0.9.4.jar.sha1
@@ -0,0 +1 @@
+d7e3ec7fbba4616cb61f1b1627348fa9fe16a541
diff --git a/solr/licenses/joou-java-6-LICENSE-ASL.txt
b/solr/licenses/joou-java-6-LICENSE-ASL.txt
new file mode 100644
index 00000000000..298f0e2665e
--- /dev/null
+++ b/solr/licenses/joou-java-6-LICENSE-ASL.txt
@@ -0,0 +1,174 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/solr/licenses/joou-java-6-NOTICE.txt
b/solr/licenses/joou-java-6-NOTICE.txt
new file mode 100644
index 00000000000..1c98a08980f
--- /dev/null
+++ b/solr/licenses/joou-java-6-NOTICE.txt
@@ -0,0 +1,2 @@
+jOOU
+Copyright (c) Data Geekery GmbH (https://www.jooq.org)
diff --git a/solr/modules/sql/gradle.lockfile b/solr/modules/sql/gradle.lockfile
index abd08f3dc1c..68414c1067e 100644
--- a/solr/modules/sql/gradle.lockfile
+++ b/solr/modules/sql/gradle.lockfile
@@ -82,10 +82,10 @@
jakarta.xml.bind:jakarta.xml.bind-api:4.0.2=jarValidation,runtimeClasspath,runti
javax.inject:javax.inject:1=annotationProcessor,errorprone,testAnnotationProcessor
junit:junit:4.13.2=jarValidation,testCompileClasspath,testRuntimeClasspath
org.antlr:antlr4-runtime:4.13.2=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
-org.apache.calcite.avatica:avatica-core:1.25.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.calcite.avatica:avatica-metrics:1.25.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.calcite:calcite-core:1.37.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
-org.apache.calcite:calcite-linq4j:1.37.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.calcite.avatica:avatica-core:1.28.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.calcite.avatica:avatica-metrics:1.28.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.calcite:calcite-core:1.42.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
+org.apache.calcite:calcite-linq4j:1.42.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.apache.commons:commons-exec:1.6.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.commons:commons-lang3:3.20.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.commons:commons-math3:3.6.1=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
@@ -93,9 +93,9 @@
org.apache.commons:commons-text:1.15.0=jarValidation,runtimeClasspath,runtimeLib
org.apache.curator:curator-client:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents.client5:httpclient5:5.2.1=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
-org.apache.httpcomponents.core5:httpcore5-h2:5.2=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
-org.apache.httpcomponents.core5:httpcore5:5.2.3=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
+org.apache.httpcomponents.client5:httpclient5:5.5=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
+org.apache.httpcomponents.core5:httpcore5-h2:5.3.4=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
+org.apache.httpcomponents.core5:httpcore5:5.3.5=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-1.2-api:2.26.1=solrPlatformLibs
org.apache.logging.log4j:log4j-api:2.26.1=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.26.1=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
@@ -137,9 +137,9 @@
org.apiguardian:apiguardian-api:1.1.2=compileClasspath,jarValidation,runtimeClas
org.carrot2:morfologik-fsa:2.1.9=jarValidation,testRuntimeClasspath
org.carrot2:morfologik-polish:2.1.9=jarValidation,testRuntimeClasspath
org.carrot2:morfologik-stemming:2.1.9=jarValidation,testRuntimeClasspath
-org.checkerframework:checker-qual:4.2.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
-org.codehaus.janino:commons-compiler:3.1.11=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
-org.codehaus.janino:janino:3.1.11=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
+org.checkerframework:checker-qual:3.54.0=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
+org.codehaus.janino:commons-compiler:3.1.12=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
+org.codehaus.janino:janino:3.1.12=jarValidation,runtimeClasspath,runtimeLibs,testRuntimeClasspath
org.codehaus.woodstox:stax2-api:4.3.0=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.eclipse.jetty.compression:jetty-compression-common:12.1.10=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
org.eclipse.jetty.compression:jetty-compression-gzip:12.1.10=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
@@ -177,6 +177,7 @@
org.glassfish.jersey:jersey-bom:4.0.2=jarValidation,runtimeClasspath,runtimeLibs
org.hamcrest:hamcrest:3.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.immutables:value-annotations:2.12.2=compileClasspath,jarValidation
org.javassist:javassist:3.30.2-GA=jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testRuntimeClasspath
+org.jooq:joou-java-6:0.9.4=compileClasspath,jarValidation,runtimeClasspath,runtimeLibs,testCompileClasspath,testRuntimeClasspath
org.jspecify:jspecify:1.0.0=annotationProcessor,compileClasspath,errorprone,jarValidation,runtimeClasspath,runtimeLibs,solrPlatformLibs,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-api:5.6.2=jarValidation,testRuntimeClasspath
org.junit.platform:junit-platform-commons:1.6.2=jarValidation,testRuntimeClasspath
diff --git
a/solr/modules/sql/src/java/org/apache/solr/handler/sql/CalciteSolrDriver.java
b/solr/modules/sql/src/java/org/apache/solr/handler/sql/CalciteSolrDriver.java
index e77ece4aea0..52e1fdc39d7 100644
---
a/solr/modules/sql/src/java/org/apache/solr/handler/sql/CalciteSolrDriver.java
+++
b/solr/modules/sql/src/java/org/apache/solr/handler/sql/CalciteSolrDriver.java
@@ -99,7 +99,14 @@ public class CalciteSolrDriver extends Driver {
return calciteConnection;
}
+ @SuppressWarnings("deprecation")
private void registerUDFs() {
+ // register() is deprecated in favour of SqlOperatorTables.of/chain, but
Calcite's JDBC stack
+ // builds the validator's operator table via
CalcitePrepareImpl.createSqlValidator (private
+ // static), leaving no protected hook to chain a custom SqlOperatorTable
without subclassing
+ // private inner classes. Mutating the global SqlStdOperatorTable
singleton is the only viable
+ // injection point available through the public API today.
+ // See https://issues.apache.org/jira/browse/CALCITE-7730
final SqlStdOperatorTable stdOpTab = SqlStdOperatorTable.instance();
stdOpTab.register(new ArrayContainsAll());
stdOpTab.register(new ArrayContainsAny());
diff --git
a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrAggregate.java
b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrAggregate.java
index 6ff6ff95a84..1e3c2f7e226 100644
--- a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrAggregate.java
+++ b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrAggregate.java
@@ -78,17 +78,6 @@ class SolrAggregate extends Aggregate implements SolrRel {
return new SolrAggregate(getCluster(), traitSet, hints, input, groupSet,
groupSets, aggCalls);
}
- @Override
- public Aggregate copy(
- RelTraitSet traitSet,
- RelNode input,
- boolean indicator,
- ImmutableBitSet groupSet,
- List<ImmutableBitSet> groupSets,
- List<AggregateCall> aggCalls) {
- return new SolrAggregate(getCluster(), traitSet, hints, input, groupSet,
groupSets, aggCalls);
- }
-
@Override
public void implement(Implementor implementor) {
implementor.visitChild(0, getInput());
diff --git
a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrEnumerator.java
b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrEnumerator.java
index ba4a06bafbf..cdd553fdbf8 100644
--- a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrEnumerator.java
+++ b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrEnumerator.java
@@ -76,7 +76,6 @@ class SolrEnumerator implements Enumerator<Object> {
private Object getter(Tuple tuple, Map.Entry<String, Class<?>> field) {
Object val = tuple.get(field.getKey());
-
if (val == null) {
return null;
}
diff --git
a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrFilter.java
b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrFilter.java
index d43f1ae4c18..cbc0cf7dfc0 100644
--- a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrFilter.java
+++ b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrFilter.java
@@ -585,16 +585,15 @@ class SolrFilter extends Filter implements SolrRel {
}
if (left.getKind() == SqlKind.CAST && right.getKind() == SqlKind.CAST) {
- return translateBinary2(
- ((RexCall) left).getOperands().get(0), ((RexCall)
right).getOperands().get(0));
+ return translateBinary2(unwrapCast(left), unwrapCast(right));
}
- // for WHERE clause like: pdatex >= '2021-07-13T15:12:10.037Z'
+ // for WHERE clause like: pdatex >= CAST('2021-07-13 15:12:10.037' AS
TIMESTAMP)
+ // Calcite 1.42+ may nest multiple CASTs for timestamp coercion, so
unwrap recursively
if (left.getKind() == SqlKind.INPUT_REF && right.getKind() ==
SqlKind.CAST) {
- final RexCall cast = ((RexCall) right);
- if (cast.getOperands().size() == 1
- && cast.getOperands().get(0).getKind() == SqlKind.LITERAL) {
- return translateBinary2(left, cast.getOperands().get(0));
+ RexNode unwrapped = unwrapCast(right);
+ if (unwrapped.getKind() == SqlKind.LITERAL) {
+ return translateBinary2(left, unwrapped);
}
}
@@ -604,7 +603,7 @@ class SolrFilter extends Filter implements SolrRel {
String leftLit = toSolrLiteral("", (RexLiteral) left);
String rightLit = toSolrLiteral("", (RexLiteral) right);
if (!leftLit.equals(rightLit)) {
- // they are equal lits ~ match no docs
+ // unequal literals (e.g. WHERE 1=0) ~ match no docs
return new Pair<>("", (RexLiteral) right);
}
}
@@ -613,6 +612,13 @@ class SolrFilter extends Filter implements SolrRel {
}
/** Translates a call to a binary operator. Returns whether successful. */
+ protected static RexNode unwrapCast(RexNode node) {
+ while (node.getKind() == SqlKind.CAST) {
+ node = ((RexCall) node).getOperands().get(0);
+ }
+ return node;
+ }
+
protected Pair<String, RexLiteral> translateBinary2(RexNode left, RexNode
right) {
if (log.isDebugEnabled()) {
log.debug("translateBinary2 left={} right={}", left, right);
@@ -796,8 +802,8 @@ class SolrFilter extends Filter implements SolrRel {
if (operands.size() != 2) {
throw new AssertionError("Invalid number of arguments - " +
operands.size());
}
- final RexNode left = operands.get(0);
- final RexNode right = operands.get(1);
+ final RexNode left = unwrapCast(operands.get(0));
+ final RexNode right = unwrapCast(operands.get(1));
final Pair<String, RexLiteral> a = translateBinary2(left, right);
if (a != null) {
diff --git
a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrProject.java
b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrProject.java
index 835d4fea03a..87ac4633b8a 100644
--- a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrProject.java
+++ b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrProject.java
@@ -17,7 +17,6 @@
package org.apache.solr.handler.sql;
import java.util.List;
-import org.apache.calcite.adapter.java.JavaTypeFactory;
import org.apache.calcite.plan.RelOptCluster;
import org.apache.calcite.plan.RelOptCost;
import org.apache.calcite.plan.RelOptPlanner;
@@ -57,9 +56,7 @@ class SolrProject extends Project implements SolrRel {
public void implement(Implementor implementor) {
implementor.visitChild(0, getInput());
final SolrRules.RexToSolrTranslator translator =
- new SolrRules.RexToSolrTranslator(
- (JavaTypeFactory) getCluster().getTypeFactory(),
- SolrRules.solrFieldNames(getInput().getRowType()));
+ new
SolrRules.RexToSolrTranslator(SolrRules.solrFieldNames(getInput().getRowType()));
for (Pair<RexNode, String> pair : getNamedProjects()) {
final String name = pair.right;
final String expr = pair.left.accept(translator);
diff --git
a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrRules.java
b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrRules.java
index a6e0b7416b2..d1bee3fb18b 100644
--- a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrRules.java
+++ b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrRules.java
@@ -19,10 +19,9 @@ package org.apache.solr.handler.sql;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.List;
-import java.util.function.Predicate;
-import org.apache.calcite.adapter.java.JavaTypeFactory;
import org.apache.calcite.plan.Convention;
import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
import org.apache.calcite.plan.RelTraitSet;
import org.apache.calcite.rel.RelCollations;
import org.apache.calcite.rel.RelNode;
@@ -35,6 +34,7 @@ import org.apache.calcite.rel.logical.LogicalSort;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rex.RexCall;
import org.apache.calcite.rex.RexInputRef;
+import org.apache.calcite.rex.RexLiteral;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.rex.RexVisitorImpl;
import org.apache.calcite.sql.SqlKind;
@@ -67,12 +67,10 @@ class SolrRules {
/** Translator from {@link RexNode} to strings in Solr's expression
language. */
static class RexToSolrTranslator extends RexVisitorImpl<String> {
- private final JavaTypeFactory typeFactory;
private final List<String> inFields;
- RexToSolrTranslator(JavaTypeFactory typeFactory, List<String> inFields) {
+ RexToSolrTranslator(List<String> inFields) {
super(true);
- this.typeFactory = typeFactory;
this.inFields = inFields;
}
@@ -104,13 +102,8 @@ class SolrRules {
* Base class for planner rules that convert a relational expression to Solr
calling convention.
*/
abstract static class SolrConverterRule extends ConverterRule {
- SolrConverterRule(Class<? extends RelNode> clazz, String description) {
- this(clazz, relNode -> true, description);
- }
-
- <R extends RelNode> SolrConverterRule(
- Class<R> clazz, Predicate<RelNode> predicate, String description) {
- super(clazz, Convention.NONE, SolrRel.CONVENTION, description);
+ protected SolrConverterRule(ConverterRule.Config config) {
+ super(config);
}
}
@@ -118,7 +111,7 @@ class SolrRules {
private static class SolrFilterRule extends SolrConverterRule {
private static boolean isNotFilterByExpr(List<RexNode> rexNodes,
List<String> fieldNames) {
- // We dont have a way to filter by result of aggregator now
+ // We don't have a way to filter by result of aggregator now
boolean result = true;
for (RexNode rexNode : rexNodes) {
@@ -138,10 +131,24 @@ class SolrRules {
return isNotFilterByExpr(filterOperands,
SolrRules.solrFieldNames(relNode.getRowType()));
}
- private static final SolrFilterRule FILTER_RULE = new SolrFilterRule();
+ static final SolrFilterRule FILTER_RULE =
+ new SolrFilterRule(
+ ConverterRule.Config.INSTANCE
+ .withConversion(
+ LogicalFilter.class,
+ SolrFilterRule::filter,
+ Convention.NONE,
+ SolrRel.CONVENTION,
+ "SolrFilterRule")
+ .withRuleFactory(SolrFilterRule::new));
+
+ private SolrFilterRule(ConverterRule.Config config) {
+ super(config);
+ }
- private SolrFilterRule() {
- super(LogicalFilter.class, SolrFilterRule::filter, "SolrFilterRule");
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ return filter(call.rel(0));
}
@Override
@@ -155,10 +162,46 @@ class SolrRules {
/** Rule to convert a {@link LogicalProject} to a {@link SolrProject}. */
private static class SolrProjectRule extends SolrConverterRule {
- private static final SolrProjectRule PROJECT_RULE = new SolrProjectRule();
+ static final SolrProjectRule PROJECT_RULE =
+ new SolrProjectRule(
+ ConverterRule.Config.INSTANCE
+ .withConversion(
+ LogicalProject.class,
+ SolrProjectRule::isSupported,
+ Convention.NONE,
+ SolrRel.CONVENTION,
+ "SolrProjectRule")
+ .withRuleFactory(SolrProjectRule::new));
+
+ private SolrProjectRule(ConverterRule.Config config) {
+ super(config);
+ }
- private SolrProjectRule() {
- super(LogicalProject.class, "SolrProjectRule");
+ /**
+ * Reject projects where any expression is a bare literal (possibly
wrapped in CASTs). This
+ * prevents SolrProject from being created for Calcite 1.42+ plans where
constant-folding
+ * replaces a grouped field with a literal constant (e.g. WHERE str_s='a'
causes Calcite to
+ * substitute str_s with the literal 'a' in a DISTINCT output project).
Such projects must
+ * remain as {@link LogicalProject} so Calcite's enumerable layer handles
the substitution.
+ */
+ private static boolean isSupported(RelNode relNode) {
+ for (RexNode expr : ((LogicalProject) relNode).getProjects()) {
+ if (isLiteralExpr(expr)) return false;
+ }
+ return true;
+ }
+
+ /** Returns true if the expression is a literal, possibly wrapped in one
or more CASTs. */
+ private static boolean isLiteralExpr(RexNode node) {
+ while (node instanceof RexCall && node.getKind() == SqlKind.CAST) {
+ node = ((RexCall) node).getOperands().get(0);
+ }
+ return node instanceof RexLiteral;
+ }
+
+ @Override
+ public boolean matches(RelOptRuleCall call) {
+ return isSupported(call.rel(0));
}
@Override
@@ -173,10 +216,15 @@ class SolrRules {
/** Rule to convert a {@link LogicalSort} to a {@link SolrSort}. */
private static class SolrSortRule extends SolrConverterRule {
- static final SolrSortRule SORT_RULE = new SolrSortRule(LogicalSort.class,
"SolrSortRule");
+ static final SolrSortRule SORT_RULE =
+ new SolrSortRule(
+ ConverterRule.Config.INSTANCE
+ .withConversion(
+ LogicalSort.class, Convention.NONE, SolrRel.CONVENTION,
"SolrSortRule")
+ .withRuleFactory(SolrSortRule::new));
- SolrSortRule(Class<? extends RelNode> clazz, String description) {
- super(clazz, description);
+ private SolrSortRule(ConverterRule.Config config) {
+ super(config);
}
@Override
@@ -195,14 +243,18 @@ class SolrRules {
/** Rule to convert an {@link LogicalAggregate} to an {@link SolrAggregate}.
*/
private static class SolrAggregateRule extends SolrConverterRule {
- // private static final Predicate<RelNode> AGGREGATE_PREDICTE = relNode
->
- // Aggregate.IS_SIMPLE.apply(((LogicalAggregate)relNode));// &&
- // !((LogicalAggregate)relNode).containsDistinctCall();
-
- private static final RelOptRule AGGREGATE_RULE = new SolrAggregateRule();
+ static final SolrAggregateRule AGGREGATE_RULE =
+ new SolrAggregateRule(
+ ConverterRule.Config.INSTANCE
+ .withConversion(
+ LogicalAggregate.class,
+ Convention.NONE,
+ SolrRel.CONVENTION,
+ "SolrAggregateRule")
+ .withRuleFactory(SolrAggregateRule::new));
- private SolrAggregateRule() {
- super(LogicalAggregate.class, "SolrAggregateRule");
+ private SolrAggregateRule(ConverterRule.Config config) {
+ super(config);
}
@Override
diff --git
a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrSort.java
b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrSort.java
index 82799d864a7..f5fb75d9d48 100644
--- a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrSort.java
+++ b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrSort.java
@@ -80,7 +80,7 @@ class SolrSort extends Sort implements SolrRel {
}
if (fetch != null) {
- implementor.setLimit(((RexLiteral) fetch).getValue().toString());
+ implementor.setLimit(((RexLiteral) fetch).getValue2().toString());
}
if (offset != null && offset instanceof RexLiteral) {
diff --git
a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverterRule.java
b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverterRule.java
index ff9ac210bea..8c6f8d27442 100644
---
a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverterRule.java
+++
b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrToEnumerableConverterRule.java
@@ -26,14 +26,18 @@ import org.apache.calcite.rel.convert.ConverterRule;
* EnumerableConvention}.
*/
class SolrToEnumerableConverterRule extends ConverterRule {
- static final ConverterRule INSTANCE = new SolrToEnumerableConverterRule();
+ static final ConverterRule INSTANCE =
+ new SolrToEnumerableConverterRule(
+ ConverterRule.Config.INSTANCE
+ .withConversion(
+ RelNode.class,
+ SolrRel.CONVENTION,
+ EnumerableConvention.INSTANCE,
+ "SolrToEnumerableConverterRule")
+ .withRuleFactory(SolrToEnumerableConverterRule::new));
- private SolrToEnumerableConverterRule() {
- super(
- RelNode.class,
- SolrRel.CONVENTION,
- EnumerableConvention.INSTANCE,
- "SolrToEnumerableConverterRule");
+ private SolrToEnumerableConverterRule(ConverterRule.Config config) {
+ super(config);
}
@Override
diff --git
a/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java
b/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java
index 6ababeb539a..cfbbf23a788 100644
--- a/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java
+++ b/solr/modules/sql/src/test/org/apache/solr/handler/sql/TestSQLHandler.java
@@ -3463,4 +3463,152 @@ public class TestSQLHandler extends SolrCloudTestCase {
expectResults(
"select id, stringxmv from $ALIAS WHERE array_contains_any(stringxmv,
('a', 'e'))", 3);
}
+
+ /**
+ * Calcite 1.42+ constant-folds a WHERE predicate on the exact
grouped/aggregated column into a
+ * literal in the output project. These tests verify that the grouped column
value is returned
+ * correctly (not null) when the WHERE filters on the same column as GROUP
BY or DISTINCT.
+ */
+ @Test
+ public void testGroupByWhereOnGroupedColumn() throws Exception {
+ new UpdateRequest()
+ .add("id", "1", "str_s", "a", "field_i", "7")
+ .add("id", "2", "str_s", "b", "field_i", "8")
+ .add("id", "3", "str_s", "a", "field_i", "20")
+ .add("id", "4", "str_s", "b", "field_i", "11")
+ .add("id", "5", "str_s", "c", "field_i", "30")
+ .commit(cluster.getSolrClient(), COLLECTIONORALIAS);
+
+ String baseUrl =
+ cluster.getJettySolrRunners().get(0).getBaseUrl().toString() + "/" +
COLLECTIONORALIAS;
+
+ // WHERE on the exact grouped column (equality) — Calcite 1.42 may
constant-fold str_s to 'a'
+ SolrParams sParams =
+ params(
+ CommonParams.QT,
+ "/sql",
+ "aggregationMode",
+ "facet",
+ "stmt",
+ "select str_s, count(*), sum(field_i) from collection1"
+ + " where str_s = 'a' group by str_s order by str_s asc");
+
+ List<Tuple> tuples = getTuples(sParams, baseUrl);
+ assertEquals(1, tuples.size());
+ Tuple tuple = tuples.get(0);
+ assertEquals(
+ "str_s must not be null-folded by Calcite constant folding", "a",
tuple.get("str_s"));
+ assertEquals(2, tuple.getDouble("EXPR$1"), 0.0); // count(*)
+ assertEquals(27, tuple.getDouble("EXPR$2"), 0.0); // sum(field_i)
+
+ // Same query in map_reduce mode
+ sParams =
+ params(
+ CommonParams.QT,
+ "/sql",
+ "aggregationMode",
+ "map_reduce",
+ "stmt",
+ "select str_s, count(*), sum(field_i) from collection1"
+ + " where str_s = 'a' group by str_s order by str_s asc");
+
+ tuples = getTuples(sParams, baseUrl);
+ assertEquals(1, tuples.size());
+ tuple = tuples.get(0);
+ assertEquals(
+ "str_s must not be null-folded by Calcite constant folding", "a",
tuple.get("str_s"));
+ assertEquals(2, tuple.getDouble("EXPR$1"), 0.0);
+ assertEquals(27, tuple.getDouble("EXPR$2"), 0.0);
+
+ // WHERE on grouped column using IN — multiple constant-folded values
+ sParams =
+ params(
+ CommonParams.QT,
+ "/sql",
+ "aggregationMode",
+ "facet",
+ "stmt",
+ "select str_s, count(*) from collection1"
+ + " where str_s in ('a', 'b') group by str_s order by str_s
asc");
+
+ tuples = getTuples(sParams, baseUrl);
+ assertEquals(2, tuples.size());
+ assertEquals("a", tuples.get(0).get("str_s"));
+ assertEquals(2, tuples.get(0).getDouble("EXPR$1"), 0.0);
+ assertEquals("b", tuples.get(1).get("str_s"));
+ assertEquals(2, tuples.get(1).getDouble("EXPR$1"), 0.0);
+
+ // WHERE on a NON-grouped column — grouped column must still be present
+ sParams =
+ params(
+ CommonParams.QT,
+ "/sql",
+ "aggregationMode",
+ "facet",
+ "stmt",
+ "select str_s, count(*), sum(field_i) from collection1"
+ + " where field_i > 10 group by str_s order by str_s asc");
+
+ tuples = getTuples(sParams, baseUrl);
+ assertEquals(3, tuples.size());
+ assertEquals("a", tuples.get(0).get("str_s"));
+ assertEquals(1, tuples.get(0).getDouble("EXPR$1"), 0.0); // only id=3
(field_i=20)
+ assertEquals("b", tuples.get(1).get("str_s"));
+ assertEquals(1, tuples.get(1).getDouble("EXPR$1"), 0.0); // only id=4
(field_i=11)
+ assertEquals("c", tuples.get(2).get("str_s"));
+ assertEquals(1, tuples.get(2).getDouble("EXPR$1"), 0.0); // id=5
(field_i=30)
+ }
+
+ /**
+ * Verifies that DISTINCT queries with WHERE predicates on the distinct
columns return the correct
+ * (non-null) column values — the companion test to testSelectDistinct's
predicate sub-case,
+ * covering additional patterns not exercised by the existing tests.
+ */
+ @Test
+ public void testDistinctWhereOnDistinctColumn() throws Exception {
+ new UpdateRequest()
+ .add("id", "1", "str_s", "a", "field_i", "1")
+ .add("id", "2", "str_s", "b", "field_i", "2")
+ .add("id", "3", "str_s", "a", "field_i", "20")
+ .add("id", "4", "str_s", "c", "field_i", "30")
+ .add("id", "5", "str_s", "c", "field_i", "50")
+ .commit(cluster.getSolrClient(), COLLECTIONORALIAS);
+
+ String baseUrl =
+ cluster.getJettySolrRunners().get(0).getBaseUrl().toString() + "/" +
COLLECTIONORALIAS;
+
+ // WHERE on one of the DISTINCT columns (facet mode)
+ SolrParams sParams =
+ params(
+ CommonParams.QT,
+ "/sql",
+ "aggregationMode",
+ "facet",
+ "stmt",
+ "select distinct str_s, field_i from collection1"
+ + " where str_s = 'a' order by field_i asc");
+
+ List<Tuple> tuples = getTuples(sParams, baseUrl);
+ assertEquals(2, tuples.size());
+ assertEquals("a", tuples.get(0).get("str_s"));
+ assertEquals(1L, tuples.get(0).getLong("field_i").longValue());
+ assertEquals("a", tuples.get(1).get("str_s"));
+ assertEquals(20L, tuples.get(1).getLong("field_i").longValue());
+
+ // WHERE on a NON-distinct column — distinct column must still be present
+ // Data with field_i>10: id=3 (a,20), id=4 (c,30), id=5 (c,50) → DISTINCT
str_s = {a, c}
+ sParams =
+ params(
+ CommonParams.QT,
+ "/sql",
+ "aggregationMode",
+ "facet",
+ "stmt",
+ "select distinct str_s from collection1 where field_i > 10 order
by str_s asc");
+
+ tuples = getTuples(sParams, baseUrl);
+ assertEquals(2, tuples.size());
+ assertEquals("a", tuples.get(0).get("str_s"));
+ assertEquals("c", tuples.get(1).get("str_s"));
+ }
}
diff --git a/solr/solr-ref-guide/gradle.lockfile
b/solr/solr-ref-guide/gradle.lockfile
index fc6bf207c3f..c5a188e9d58 100644
--- a/solr/solr-ref-guide/gradle.lockfile
+++ b/solr/solr-ref-guide/gradle.lockfile
@@ -79,10 +79,10 @@
jakarta.xml.bind:jakarta.xml.bind-api:4.0.2=testRuntimeClasspath
javax.inject:javax.inject:1=annotationProcessor,errorprone,testAnnotationProcessor
junit:junit:4.13.2=testCompileClasspath,testRuntimeClasspath
org.antlr:antlr4-runtime:4.13.2=testRuntimeClasspath
-org.apache.calcite.avatica:avatica-core:1.25.0=testRuntimeClasspath
-org.apache.calcite.avatica:avatica-metrics:1.25.0=testRuntimeClasspath
-org.apache.calcite:calcite-core:1.37.0=testRuntimeClasspath
-org.apache.calcite:calcite-linq4j:1.37.0=testRuntimeClasspath
+org.apache.calcite.avatica:avatica-core:1.28.0=testRuntimeClasspath
+org.apache.calcite.avatica:avatica-metrics:1.28.0=testRuntimeClasspath
+org.apache.calcite:calcite-core:1.42.0=testRuntimeClasspath
+org.apache.calcite:calcite-linq4j:1.42.0=testRuntimeClasspath
org.apache.commons:commons-exec:1.6.0=testRuntimeClasspath
org.apache.commons:commons-lang3:3.20.0=testRuntimeClasspath
org.apache.commons:commons-math3:3.6.1=testRuntimeClasspath
@@ -90,9 +90,9 @@ org.apache.commons:commons-text:1.15.0=testRuntimeClasspath
org.apache.curator:curator-client:5.9.0=testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=testRuntimeClasspath
-org.apache.httpcomponents.client5:httpclient5:5.2.1=testRuntimeClasspath
-org.apache.httpcomponents.core5:httpcore5-h2:5.2=testRuntimeClasspath
-org.apache.httpcomponents.core5:httpcore5:5.2.3=testRuntimeClasspath
+org.apache.httpcomponents.client5:httpclient5:5.5=testRuntimeClasspath
+org.apache.httpcomponents.core5:httpcore5-h2:5.3.4=testRuntimeClasspath
+org.apache.httpcomponents.core5:httpcore5:5.3.5=testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.26.1=testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.26.1=testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.26.1=testRuntimeClasspath
@@ -122,9 +122,9 @@
org.apache.lucene:lucene-test-framework:10.4.0=testCompileClasspath,testRuntimeC
org.apache.zookeeper:zookeeper-jute:3.9.5=testCompileClasspath,testRuntimeClasspath
org.apache.zookeeper:zookeeper:3.9.5=testCompileClasspath,testRuntimeClasspath
org.apiguardian:apiguardian-api:1.1.2=testRuntimeClasspath
-org.checkerframework:checker-qual:4.2.0=testRuntimeClasspath
-org.codehaus.janino:commons-compiler:3.1.11=testRuntimeClasspath
-org.codehaus.janino:janino:3.1.11=testRuntimeClasspath
+org.checkerframework:checker-qual:3.54.0=testRuntimeClasspath
+org.codehaus.janino:commons-compiler:3.1.12=testRuntimeClasspath
+org.codehaus.janino:janino:3.1.12=testRuntimeClasspath
org.codehaus.woodstox:stax2-api:4.3.0=testRuntimeClasspath
org.eclipse.jetty.compression:jetty-compression-common:12.1.10=testRuntimeClasspath
org.eclipse.jetty.compression:jetty-compression-gzip:12.1.10=testRuntimeClasspath
@@ -161,6 +161,7 @@
org.glassfish.jersey.media:jersey-media-json-jackson:4.0.2=testRuntimeClasspath
org.glassfish.jersey:jersey-bom:4.0.2=testRuntimeClasspath
org.hamcrest:hamcrest:3.0=testCompileClasspath,testRuntimeClasspath
org.javassist:javassist:3.30.2-GA=testRuntimeClasspath
+org.jooq:joou-java-6:0.9.5=testRuntimeClasspath
org.jspecify:jspecify:1.0.0=annotationProcessor,errorprone,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-api:5.6.2=testRuntimeClasspath
org.junit.platform:junit-platform-commons:1.6.2=testRuntimeClasspath
diff --git a/solr/solrj-streaming/gradle.lockfile
b/solr/solrj-streaming/gradle.lockfile
index 387e570e977..b5e3aaf7768 100644
--- a/solr/solrj-streaming/gradle.lockfile
+++ b/solr/solrj-streaming/gradle.lockfile
@@ -79,10 +79,10 @@
jakarta.xml.bind:jakarta.xml.bind-api:4.0.2=jarValidation,testRuntimeClasspath
javax.inject:javax.inject:1=annotationProcessor,errorprone,testAnnotationProcessor
junit:junit:4.13.2=jarValidation,testCompileClasspath,testRuntimeClasspath
org.antlr:antlr4-runtime:4.13.2=jarValidation,testRuntimeClasspath
-org.apache.calcite.avatica:avatica-core:1.25.0=jarValidation,testRuntimeClasspath
-org.apache.calcite.avatica:avatica-metrics:1.25.0=jarValidation,testRuntimeClasspath
-org.apache.calcite:calcite-core:1.37.0=jarValidation,testRuntimeClasspath
-org.apache.calcite:calcite-linq4j:1.37.0=jarValidation,testRuntimeClasspath
+org.apache.calcite.avatica:avatica-core:1.28.0=jarValidation,testRuntimeClasspath
+org.apache.calcite.avatica:avatica-metrics:1.28.0=jarValidation,testRuntimeClasspath
+org.apache.calcite:calcite-core:1.42.0=jarValidation,testRuntimeClasspath
+org.apache.calcite:calcite-linq4j:1.42.0=jarValidation,testRuntimeClasspath
org.apache.commons:commons-exec:1.6.0=jarValidation,testRuntimeClasspath
org.apache.commons:commons-lang3:3.20.0=jarValidation,testRuntimeClasspath
org.apache.commons:commons-math3:3.6.1=compileClasspath,jarValidation,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
@@ -90,9 +90,9 @@
org.apache.commons:commons-text:1.15.0=jarValidation,testRuntimeClasspath
org.apache.curator:curator-client:5.9.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-framework:5.9.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.curator:curator-test:5.9.0=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents.client5:httpclient5:5.2.1=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents.core5:httpcore5-h2:5.2=jarValidation,testRuntimeClasspath
-org.apache.httpcomponents.core5:httpcore5:5.2.3=jarValidation,testRuntimeClasspath
+org.apache.httpcomponents.client5:httpclient5:5.5=jarValidation,testRuntimeClasspath
+org.apache.httpcomponents.core5:httpcore5-h2:5.3.4=jarValidation,testRuntimeClasspath
+org.apache.httpcomponents.core5:httpcore5:5.3.5=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-api:2.26.1=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-core:2.26.1=jarValidation,testRuntimeClasspath
org.apache.logging.log4j:log4j-slf4j2-impl:2.26.1=jarValidation,testRuntimeClasspath
@@ -121,9 +121,9 @@
org.apache.lucene:lucene-test-framework:10.4.0=jarValidation,testCompileClasspat
org.apache.zookeeper:zookeeper-jute:3.9.5=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apache.zookeeper:zookeeper:3.9.5=jarValidation,testCompileClasspath,testRuntimeClasspath
org.apiguardian:apiguardian-api:1.1.2=jarValidation,testRuntimeClasspath
-org.checkerframework:checker-qual:4.2.0=jarValidation,testRuntimeClasspath
-org.codehaus.janino:commons-compiler:3.1.11=jarValidation,testRuntimeClasspath
-org.codehaus.janino:janino:3.1.11=jarValidation,testRuntimeClasspath
+org.checkerframework:checker-qual:3.54.0=jarValidation,testRuntimeClasspath
+org.codehaus.janino:commons-compiler:3.1.12=jarValidation,testRuntimeClasspath
+org.codehaus.janino:janino:3.1.12=jarValidation,testRuntimeClasspath
org.codehaus.woodstox:stax2-api:4.3.0=jarValidation,testRuntimeClasspath
org.eclipse.jetty.compression:jetty-compression-common:12.1.10=jarValidation,testRuntimeClasspath
org.eclipse.jetty.compression:jetty-compression-gzip:12.1.10=jarValidation,testRuntimeClasspath
@@ -161,6 +161,7 @@
org.glassfish.jersey:jersey-bom:4.0.2=jarValidation,testRuntimeClasspath
org.hamcrest:hamcrest:3.0=jarValidation,testCompileClasspath,testRuntimeClasspath
org.hsqldb:hsqldb:2.7.4=jarValidation,testRuntimeClasspath
org.javassist:javassist:3.30.2-GA=jarValidation,testRuntimeClasspath
+org.jooq:joou-java-6:0.9.5=jarValidation,testRuntimeClasspath
org.jspecify:jspecify:1.0.0=annotationProcessor,errorprone,jarValidation,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
org.junit.jupiter:junit-jupiter-api:5.6.2=jarValidation,testRuntimeClasspath
org.junit.platform:junit-platform-commons:1.6.2=jarValidation,testRuntimeClasspath