Package org.apache.calcite.adapter.file
Class FileSchema
- java.lang.Object
-
- org.apache.calcite.schema.impl.AbstractSchema
-
- org.apache.calcite.adapter.file.FileSchema
-
- All Implemented Interfaces:
Schema
class FileSchema extends AbstractSchema
Schema mapped onto a set of URLs / HTML tables. Each table in the schema is an HTML table on a URL.
-
-
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 private java.io.File
baseDirectory
private com.google.common.collect.ImmutableList<java.util.Map<java.lang.String,java.lang.Object>>
tables
-
Constructor Summary
Constructors Constructor Description FileSchema(SchemaPlus parentSchema, java.lang.String name, java.io.File baseDirectory, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> tables)
Creates an HTML tables schema.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
addTable(com.google.common.collect.ImmutableMap.Builder<java.lang.String,Table> builder, java.util.Map<java.lang.String,java.lang.Object> tableDef)
private boolean
addTable(com.google.common.collect.ImmutableMap.Builder<java.lang.String,Table> builder, Source source, java.lang.String tableName, java.util.Map<java.lang.String,java.lang.Object> tableDef)
protected java.util.Map<java.lang.String,Table>
getTableMap()
Returns a map of tables in this schema by name.private static java.lang.String
trim(java.lang.String s, java.lang.String suffix)
Looks for a suffix on a string and returns either the string with the suffix removed or the original string.private static java.lang.String
trimOrNull(java.lang.String s, java.lang.String suffix)
Looks for a suffix on a string and returns either the string with the suffix removed or null.-
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
-
FileSchema
FileSchema(SchemaPlus parentSchema, java.lang.String name, java.io.File baseDirectory, java.util.List<java.util.Map<java.lang.String,java.lang.Object>> tables)
Creates an HTML tables schema.- Parameters:
parentSchema
- Parent schemaname
- Schema namebaseDirectory
- Base directory to look for relative files, or nulltables
- List containing HTML table identifiers
-
-
Method Detail
-
trim
private static java.lang.String trim(java.lang.String s, java.lang.String suffix)
Looks for a suffix on a string and returns either the string with the suffix removed or the original string.
-
trimOrNull
private static java.lang.String trimOrNull(java.lang.String s, java.lang.String suffix)
Looks for a suffix on a string and returns either the string with the suffix removed or null.
-
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
-
addTable
private boolean addTable(com.google.common.collect.ImmutableMap.Builder<java.lang.String,Table> builder, java.util.Map<java.lang.String,java.lang.Object> tableDef) throws java.net.MalformedURLException
- Throws:
java.net.MalformedURLException
-
-