You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by AshwinKumar AshwinKumar <aa...@g.clemson.edu> on 2017/10/04 03:10:17 UTC

Object not found - while querying a type in elastisearch

Hi Team,

I have created a model.json file with two connection instances for postgres
and elastisearch . PFB the file -

{
  "version": "1.0",
  "defaultSchema": "postgrestestelasti",
  "schemas": [
    {
      "name": "postgrestest",
      "type": "custom",
      "factory": "org.apache.calcite.adapter.jdbc.JdbcSchema$Factory",
      "operand": {
        //"jdbcDriver": "com.mysql.jdbc.Driver",
       // "jdbcUrl": "jdbc:mysql://localhost/foodmart",
        "jdbcDriver": "org.postgresql.Driver",
        "jdbcUrl": "jdbc:postgresql://localhost/bigdawg_catalog",
        "jdbcUser": "pguser",
        "jdbcPassword": "test"
      }
    },
    {
      "type": "custom",
      "name": "elasticsearch",
      "factory":
"org.apache.calcite.adapter.elasticsearch2.Elasticsearch2SchemaFactory",
      "operand": {
        "coordinates": "{'127.0.0.1': 9300}",
        "userConfig": "{'bulk.flush.max.actions': 10,
'bulk.flush.max.size.mb': 1}",
        "index": "megacorp"
      }
    }
  ]
}


The connection is working fine. But when I query a type called EMPLOYEES
(which I have created in the index megacorp)  , It throws the below error -

The query is - select * from EMPLOYEES;

error -

select * from "EMPLOYEES";
2017-10-04 03:54:46,696 [main] ERROR -
org.apache.calcite.sql.validate.SqlValidatorException: Object 'EMPLOYEES'
not found
2017-10-04 03:54:46,701 [main] ERROR -
org.apache.calcite.runtime.CalciteContextException: From line 1, column 15
to line 1, column 25: Object 'EMPLOYEES' not found
Error: Error while executing SQL "select * from "EMPLOYEES"": From line 1,
column 15 to line 1, column 25: Object 'EMPLOYEES' not found (state=,code=0)

Could you please let me know what is the issue here.

Note - please ignore the path for the modelPost.json file as I have it in
cassandra folder. This is just a test model file.


Thanks,
Ashwin

Re: Object not found - while querying a type in elastisearch

Posted by AshwinKumar AshwinKumar <aa...@g.clemson.edu>.
Hi Julian,

Thanks !!..It worked. I was giving both the schemaname and tablename in
quotes. Is there any specific documentation for specifying qualifiers for
table names.

Also Could you please let me know If I can join a table in elastisearch and
a table in postgresql.

Thanks,
Ashwin

On Wed, Oct 4, 2017 at 9:41 PM, Julian Hyde <jh...@apache.org> wrote:

> Do you understand how “defaultSchema” works? It needs to be the name of
> one of your schemas, and yours isn’t.
>
> Have you tried qualifying the table name with the schema name, like this:
>
>   select * from “postgrestest”.EMPLOYEES
>
> Julian
>
>
> > On Oct 3, 2017, at 8:10 PM, AshwinKumar AshwinKumar <
> aashwin@g.clemson.edu> wrote:
> >
> > Hi Team,
> >
> > I have created a model.json file with two connection instances for
> postgres
> > and elastisearch . PFB the file -
> >
> > {
> >  "version": "1.0",
> >  "defaultSchema": "postgrestestelasti",
> >  "schemas": [
> >    {
> >      "name": "postgrestest",
> >      "type": "custom",
> >      "factory": "org.apache.calcite.adapter.jdbc.JdbcSchema$Factory",
> >      "operand": {
> >        //"jdbcDriver": "com.mysql.jdbc.Driver",
> >       // "jdbcUrl": "jdbc:mysql://localhost/foodmart",
> >        "jdbcDriver": "org.postgresql.Driver",
> >        "jdbcUrl": "jdbc:postgresql://localhost/bigdawg_catalog",
> >        "jdbcUser": "pguser",
> >        "jdbcPassword": "test"
> >      }
> >    },
> >    {
> >      "type": "custom",
> >      "name": "elasticsearch",
> >      "factory":
> > "org.apache.calcite.adapter.elasticsearch2.Elasticsearch2SchemaFactory",
> >      "operand": {
> >        "coordinates": "{'127.0.0.1': 9300}",
> >        "userConfig": "{'bulk.flush.max.actions': 10,
> > 'bulk.flush.max.size.mb': 1}",
> >        "index": "megacorp"
> >      }
> >    }
> >  ]
> > }
> >
> >
> > The connection is working fine. But when I query a type called EMPLOYEES
> > (which I have created in the index megacorp)  , It throws the below
> error -
> >
> > The query is - select * from EMPLOYEES;
> >
> > error -
> >
> > select * from "EMPLOYEES";
> > 2017-10-04 03:54:46,696 [main] ERROR -
> > org.apache.calcite.sql.validate.SqlValidatorException: Object
> 'EMPLOYEES'
> > not found
> > 2017-10-04 03:54:46,701 [main] ERROR -
> > org.apache.calcite.runtime.CalciteContextException: From line 1, column
> 15
> > to line 1, column 25: Object 'EMPLOYEES' not found
> > Error: Error while executing SQL "select * from "EMPLOYEES"": From line
> 1,
> > column 15 to line 1, column 25: Object 'EMPLOYEES' not found
> (state=,code=0)
> >
> > Could you please let me know what is the issue here.
> >
> > Note - please ignore the path for the modelPost.json file as I have it in
> > cassandra folder. This is just a test model file.
> >
> >
> > Thanks,
> > Ashwin
>
>

Re: Object not found - while querying a type in elastisearch

Posted by Julian Hyde <jh...@apache.org>.
Do you understand how “defaultSchema” works? It needs to be the name of one of your schemas, and yours isn’t. 

Have you tried qualifying the table name with the schema name, like this:

  select * from “postgrestest”.EMPLOYEES

Julian


> On Oct 3, 2017, at 8:10 PM, AshwinKumar AshwinKumar <aa...@g.clemson.edu> wrote:
> 
> Hi Team,
> 
> I have created a model.json file with two connection instances for postgres
> and elastisearch . PFB the file -
> 
> {
>  "version": "1.0",
>  "defaultSchema": "postgrestestelasti",
>  "schemas": [
>    {
>      "name": "postgrestest",
>      "type": "custom",
>      "factory": "org.apache.calcite.adapter.jdbc.JdbcSchema$Factory",
>      "operand": {
>        //"jdbcDriver": "com.mysql.jdbc.Driver",
>       // "jdbcUrl": "jdbc:mysql://localhost/foodmart",
>        "jdbcDriver": "org.postgresql.Driver",
>        "jdbcUrl": "jdbc:postgresql://localhost/bigdawg_catalog",
>        "jdbcUser": "pguser",
>        "jdbcPassword": "test"
>      }
>    },
>    {
>      "type": "custom",
>      "name": "elasticsearch",
>      "factory":
> "org.apache.calcite.adapter.elasticsearch2.Elasticsearch2SchemaFactory",
>      "operand": {
>        "coordinates": "{'127.0.0.1': 9300}",
>        "userConfig": "{'bulk.flush.max.actions': 10,
> 'bulk.flush.max.size.mb': 1}",
>        "index": "megacorp"
>      }
>    }
>  ]
> }
> 
> 
> The connection is working fine. But when I query a type called EMPLOYEES
> (which I have created in the index megacorp)  , It throws the below error -
> 
> The query is - select * from EMPLOYEES;
> 
> error -
> 
> select * from "EMPLOYEES";
> 2017-10-04 03:54:46,696 [main] ERROR -
> org.apache.calcite.sql.validate.SqlValidatorException: Object 'EMPLOYEES'
> not found
> 2017-10-04 03:54:46,701 [main] ERROR -
> org.apache.calcite.runtime.CalciteContextException: From line 1, column 15
> to line 1, column 25: Object 'EMPLOYEES' not found
> Error: Error while executing SQL "select * from "EMPLOYEES"": From line 1,
> column 15 to line 1, column 25: Object 'EMPLOYEES' not found (state=,code=0)
> 
> Could you please let me know what is the issue here.
> 
> Note - please ignore the path for the modelPost.json file as I have it in
> cassandra folder. This is just a test model file.
> 
> 
> Thanks,
> Ashwin