You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "Timothy Potter (Jira)" <ji...@apache.org> on 2021/11/15 21:08:00 UTC

[jira] [Commented] (SOLR-15799) Solr SQL should allow the schema name on table names if possible

    [ https://issues.apache.org/jira/browse/SOLR-15799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17444105#comment-17444105 ] 

Timothy Potter commented on SOLR-15799:
---------------------------------------

Looks like it may be coming from the SQL Alchemy plugin: https://github.com/aadel/sqlalchemy-solr/blob/master/sqlalchemy_solr/base.py#L534

The work-around for this is to use Superset's {{USE LEGACY DATASOURCE EDITOR}} to unset the schema, see attached screenshot

> Solr SQL should allow the schema name on table names if possible
> ----------------------------------------------------------------
>
>                 Key: SOLR-15799
>                 URL: https://issues.apache.org/jira/browse/SOLR-15799
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: Parallel SQL
>            Reporter: Timothy Potter
>            Assignee: Timothy Potter
>            Priority: Major
>              Labels: RobustSQL
>         Attachments: Screen Shot 2021-11-15 at 1.55.14 PM.png, Screen Shot 2021-11-15 at 2.07.24 PM.png
>
>
> Started kicking the tires on Solr SQL with Superset and the first issue I encountered is Calcite's parsing doesn't like the schema name (Solr uses {{default}}) on table names, such as:
> {code}
> Caused by: java.sql.SQLException: Error while executing SQL "SELECT genre_s AS genre_s,
>        COUNT(*) AS `count`
> FROM `default`.books
> GROUP BY genre_s
> ORDER BY `count` DESC
> LIMIT 100": From line 3, column 6 to line 3, column 20: Object 'default' not found
> 	at org.apache.calcite.avatica.Helper.createException(Helper.java:56) ~[?:?]
> 	at org.apache.calcite.avatica.Helper.createException(Helper.java:41) ~[?:?]
> 	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163) ~[?:?]
> 	at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227) ~[?:?]
> 	at org.apache.solr.client.solrj.io.stream.JDBCStream.open(JDBCStream.java:283) ~[?:?]
> 	... 55 more
> Caused by: org.apache.calcite.runtime.CalciteContextException: From line 3, column 6 to line 3, column 20: Object 'default' not found
> 	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
> 	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
> 	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
> 	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:506) ~[?:?]
> 	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:917) ~[?:?]
> 	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:902) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5271) ~[?:?]
> 	at org.apache.calcite.sql.validate.IdentifierNamespace.resolveImpl(IdentifierNamespace.java:183) ~[?:?]
> 	at org.apache.calcite.sql.validate.IdentifierNamespace.validateImpl(IdentifierNamespace.java:188) ~[?:?]
> 	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:89) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1098) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1069) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3380) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3362) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3644) ~[?:?]
> 	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:64) ~[?:?]
> 	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:89) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1098) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1069) ~[?:?]
> 	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:247) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1044) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:750) ~[?:?]
> 	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:585) ~[?:?]
> 	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:251) ~[?:?]
> 	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:215) ~[?:?]
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:647) ~[?:?]
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513) ~[?:?]
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483) ~[?:?]
> 	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249) ~[?:?]
> 	at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:623) ~[?:?]
> 	at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675) ~[?:?]
> 	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156) ~[?:?]
> 	at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227) ~[?:?]
> 	at org.apache.solr.client.solrj.io.stream.JDBCStream.open(JDBCStream.java:283) ~[?:?]
> 	... 55 more
> Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Object 'default' not found
> 	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
> 	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:?]
> 	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
> 	at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
> 	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:506) ~[?:?]
> 	at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:600) ~[?:?]
> 	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:917) ~[?:?]
> 	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:902) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5271) ~[?:?]
> 	at org.apache.calcite.sql.validate.IdentifierNamespace.resolveImpl(IdentifierNamespace.java:183) ~[?:?]
> 	at org.apache.calcite.sql.validate.IdentifierNamespace.validateImpl(IdentifierNamespace.java:188) ~[?:?]
> 	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:89) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1098) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1069) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3380) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3362) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3644) ~[?:?]
> 	at org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:64) ~[?:?]
> 	at org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:89) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1098) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1069) ~[?:?]
> 	at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:247) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1044) ~[?:?]
> 	at org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:750) ~[?:?]
> 	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:585) ~[?:?]
> 	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:251) ~[?:?]
> 	at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:215) ~[?:?]
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:647) ~[?:?]
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:513) ~[?:?]
> 	at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:483) ~[?:?]
> 	at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:249) ~[?:?]
> 	at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:623) ~[?:?]
> 	at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675) ~[?:?]
> 	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156) ~[?:?]
> 	at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227) ~[?:?]
> 	at org.apache.solr.client.solrj.io.stream.JDBCStream.open(JDBCStream.java:283) ~[?:?]
> 	... 55 more
> {code}
> Seems like {{`default`.TABLE}} should work but not sure if this is a Calcite setting or something we're not doing correctly in the Solr code. See screenshot ... need to figure out where the {{default}} schema name is even coming from??



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org