meridor / perspective-backend

Scalable multi-cloud management API and shell
Apache License 2.0
16 stars 6 forks source link

Nothing fetched for instances query #136

Closed vania-pooh closed 8 years ago

vania-pooh commented 8 years ago
perspective>show instances --name firefox
Nothing to show
vania-pooh commented 8 years ago
perspective>select i.image_id, im.id from instances i inner join images im on i.image_id = i.id;
Error: java.lang.String cannot be cast to org.meridor.perspective.sql.impl.index.impl.IndexSignature
perspective>explain select i.image_id, im.id from instances i inner join images im on i.image_id = i.id;
Results contain 2 entries.
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ task                                                                                                                                                                             │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ DataSourceTask{dataSource=DataSource{tableAlias='null', leftDataSource=DataSource{tableAlias='i', leftDataSource=null, isNaturalJoin=false, joinType=null,                       │
│ condition=org.meridor.perspective.sql.impl.expression.IndexBooleanExpression                                                                                                     │
│ 69fb7079, columns=[id], rightDatasource=null, type=INDEX_SCAN}, isNaturalJoin=false, joinType=null,                                                                              │
│ condition=null, columns=[], rightDatasource=DataSource{tableAlias='im', leftDataSource=null, isNaturalJoin=false, joinType=INNER, condition=i.image_id = i.id, columns=[],       │
│ rightDatasource=null, type=TABLE_SCAN}, type=PARENT}, tableAliases={im=images, i=instances}}                                                                                     │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ SelectTask{selectionMap={i.image_id=i.image_id, im.id=im.id}, selectAll=false, tableAliases={im=images, i=instances}}                                                            │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
vania-pooh commented 8 years ago

After fixing #135 the error message is: Column image_id not found for table instances

vania-pooh commented 8 years ago
perspective>explain select instances.id, instances.real_id, instances.name, projects.id, projects.name, instances.cloud_id, instances.cloud_type, images.name, flavors.name, instances.addresses, instances.state, instances.last_updated from instances inner join projects on instances.project_id = projects.id left join flavors on instances.project_id = flavors.project_id and instances.flavor_id = flavors.id left join images on instances.image_id = images.id order by instances.name asc
Results contain 3 entries.
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ task                                                                                                                                                                             │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ DataSourceTask{dataSource=DataSource{tableAlias='null', leftDataSource=DataSource{tableAlias='instances', leftDataSource=null, isNaturalJoin=false, joinType=null,               │
│ condition=null, columns=[], rightDatasource=DataSource{tableAlias='projects', leftDataSource=null, isNaturalJoin=false, joinType=INNER, condition=instances.project_id =         │
│ projects.id, columns=[], rightDatasource=null, type=TABLE_SCAN}, type=TABLE_SCAN}, isNaturalJoin=false, joinType=null, condition=null, columns=[],                               │
│ rightDatasource=DataSource{tableAlias='flavors', leftDataSource=null, isNaturalJoin=false, joinType=LEFT, condition=instances.project_id = flavors.project_id &&                 │
│ instances.flavor_id = flavors.id, columns=[], rightDatasource=DataSource{tableAlias='images', leftDataSource=null, isNaturalJoin=false, joinType=LEFT,                           │
│ condition=instances.image_id = images.id, columns=[], rightDatasource=null, type=TABLE_SCAN}, type=TABLE_SCAN}, type=PARENT}, tableAliases={flavors=flavors, images=images,      │
│ projects=projects, instances=instances}}                                                                                                                                         │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ OrderTask{expressions=[OrderExpression{expression=instances.name, orderDirection=ASC}]}                                                                                          │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ SelectTask{selectionMap={instances.id=instances.id, instances.real_id=instances.real_id, instances.name=instances.name, projects.id=projects.id, projects.name=projects.name,    │
│ instances.cloud_id=instances.cloud_id, instances.cloud_type=instances.cloud_type, images.name=images.name, flavors.name=flavors.name, instances.addresses=instances.addresses,   │
│ instances.state=instances.state, instances.last_updated=instances.last_updated}, selectAll=false, tableAliases={flavors=flavors, images=images, projects=projects,               │
│ instances=instances}}                                                                                                                                                            │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Should be index scan.

vania-pooh commented 8 years ago

Data is being fetched now.