sonatype-lift[bot] commented on a change in pull request #453:
URL: https://github.com/apache/solr/pull/453#discussion_r766263703
##########
File path: solr/core/src/java/org/apache/solr/handler/SQLHandler.java
##########
@@ -145,17 +150,56 @@ public String getSource() {
private boolean firstTuple = true;
List<String> metadataFields = new ArrayList<>();
Map<String, String> metadataAliases = new HashMap<>();
+ private final boolean returnSolrQueryOnly;
+ private final String sqlQuery;
+ TupleStream queryTupleStream;
SqlHandlerStream(String connectionUrl, String sqlQuery, StreamComparator
definedSort,
Properties connectionProperties, String driverClassName,
boolean includeMetadata)
throws IOException {
super(connectionUrl, sqlQuery, definedSort, connectionProperties,
driverClassName);
this.includeMetadata = includeMetadata;
+ this.returnSolrQueryOnly =
"true".equals(connectionProperties.getProperty("returnSolrQueryOnly"));
+ this.sqlQuery = sqlQuery;
+ }
+
+ @Override
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public void open() throws IOException {
+ if (returnSolrQueryOnly) {
+ // Get the Calcite connection and then call prepareSql so we can grab
the TupleStream directly
+ // to by-pass all the ResultSet creation in the JDBC layer as we just
want the Solr query for this SQL vs. executing the SQL
+ CalciteConnection calciteConn = (CalciteConnection)openConnection();
+ CalcitePrepare.Context context = calciteConn.createPrepareContext();
+ CalcitePrepare.CalciteSignature sig =
+ (new CalcitePrepareImpl()).prepareSql(context,
CalcitePrepare.Query.of(sqlQuery), Object[].class, -1);
Review comment:
*UnnecessaryParentheses:* Unnecessary use of grouping parentheses
[(details)](https://errorprone.info/bugpattern/UnnecessaryParentheses)
(at-me [in a reply](https://help.sonatype.com/lift/talking-to-lift) with
`help` or `ignore`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]