Class MongoSchema
- java.lang.Object
-
- org.apache.calcite.schema.impl.AbstractSchema
-
- org.apache.calcite.adapter.mongodb.MongoSchema
-
- All Implemented Interfaces:
Schema
public class MongoSchema extends AbstractSchema
Schema mapped onto a directory of MONGO files. Each table in the schema is a MONGO file in that directory.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.calcite.schema.impl.AbstractSchema
AbstractSchema.Factory
-
Nested classes/interfaces inherited from interface org.apache.calcite.schema.Schema
Schema.TableType
-
-
Field Summary
Fields Modifier and Type Field Description (package private) com.mongodb.client.MongoDatabase
mongoDb
-
Constructor Summary
Constructors Constructor Description MongoSchema(com.mongodb.client.MongoDatabase mongoDb)
Allows tests to inject their instance of the database.MongoSchema(java.lang.String host, java.lang.String database, java.util.List<com.mongodb.MongoCredential> credentialsList, com.mongodb.MongoClientOptions options)
Creates a MongoDB schema.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,Table>
getTableMap()
Returns a map of tables in this schema by name.-
Methods inherited from class org.apache.calcite.schema.impl.AbstractSchema
getExpression, getFunctionMultimap, getFunctionNames, getFunctions, getSubSchema, getSubSchemaMap, getSubSchemaNames, getTable, getTableNames, getType, getTypeMap, getTypeNames, isMutable, snapshot
-
-
-
-
Constructor Detail
-
MongoSchema
MongoSchema(java.lang.String host, java.lang.String database, java.util.List<com.mongodb.MongoCredential> credentialsList, com.mongodb.MongoClientOptions options)
Creates a MongoDB schema.- Parameters:
host
- Mongo host, e.g. "localhost"credentialsList
- Optional credentials (empty list for none)options
- Mongo connection optionsdatabase
- Mongo database name, e.g. "foodmart"
-
MongoSchema
MongoSchema(com.mongodb.client.MongoDatabase mongoDb)
Allows tests to inject their instance of the database.- Parameters:
mongoDb
- existing mongo database instance
-
-
Method Detail
-
getTableMap
protected java.util.Map<java.lang.String,Table> getTableMap()
Description copied from class:AbstractSchema
Returns a map of tables in this schema by name.The implementations of
AbstractSchema.getTableNames()
andAbstractSchema.getTable(String)
depend on this map. The default implementation of this method returns the empty map. Override this method to change their behavior.- Overrides:
getTableMap
in classAbstractSchema
- Returns:
- Map of tables in this schema by name
-
-