Skip to content

Avoid forwarding unrelated request parameters to Calcite from the /sql handler#4607

Open
janhoy wants to merge 4 commits into
apache:mainfrom
janhoy:calcite-sql-params
Open

Avoid forwarding unrelated request parameters to Calcite from the /sql handler#4607
janhoy wants to merge 4 commits into
apache:mainfrom
janhoy:calcite-sql-params

Conversation

@janhoy

@janhoy janhoy commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

The /sql handler needlessly forwarded unrelated request parameters to Calcite, which was brittle. Now always accept numWorkers and aggregationMode which are the ones Solr care about. Forward to Calcite all params listed in the new sysprop solr.sql.connection.params.allowed, defaulting to a set of the 11 most useful calcite params.

Also there was some dead code in SQLHandler. Removing handling of properties workerCollection, workerZkhost, and the corresponding defaultWorkerCollection.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 6, 2026
@janhoy janhoy requested a review from risdenk July 6, 2026 21:55
Comment on lines +461 to +462
"someOtherParam",
"someValue",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your assertions don't check that "someOtherParam" wasn't passed

@epugh epugh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice to see this expanding to cover more (and covering new properties!)

static final String ALLOWED_CONNECTION_PARAMS_PROP = "solr.sql.connection.params.allowed";

/** Calcite configuration parameters forwarded as connection properties. */
static final Set<String> DEFAULT_CONNECTION_PARAMS =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming these are the right ones! Wow...

String sql = params.get("stmt");
// Set defaults for parameters
params.set("numWorkers", params.getInt("numWorkers", 1));
params.set("workerCollection", params.get("workerCollection", defaultWorkerCollection));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were there any tests that could be removed when these params were removed??? I didn't look...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation module:sql tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants