Class PathSchemaProvider
java.lang.Object
org.apache.drill.exec.record.metadata.schema.PathSchemaProvider
- All Implemented Interfaces:
SchemaProvider
- Direct Known Subclasses:
FsMetastoreSchemaProvider
Is used to provide schema using given schema file name and path.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.fasterxml.jackson.databind.ObjectReader
Reader used to read JSON schema from file into intoSchemaContainer
.static final com.fasterxml.jackson.databind.ObjectWriter
Writer used to write content fromSchemaContainer
into JSON file.Fields inherited from interface org.apache.drill.exec.record.metadata.schema.SchemaProvider
DEFAULT_SCHEMA_NAME
-
Constructor Summary
ConstructorDescriptionPathSchemaProvider
(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) PathSchemaProvider
(org.apache.hadoop.fs.Path path) -
Method Summary
Modifier and TypeMethodDescriptionprotected SchemaContainer
createTableSchema
(String schema, Map<String, String> properties) void
delete()
Deletes schema.boolean
exists()
Checks if schema exists.read()
Reads schema intoSchemaContainer
.void
Stores given schema definition and properties.
-
Field Details
-
READER
public static final com.fasterxml.jackson.databind.ObjectReader READERReader used to read JSON schema from file into intoSchemaContainer
. Allows comment inside the JSON file. -
WRITER
public static final com.fasterxml.jackson.databind.ObjectWriter WRITERWriter used to write content fromSchemaContainer
into JSON file.
-
-
Constructor Details
-
PathSchemaProvider
- Throws:
IOException
-
PathSchemaProvider
public PathSchemaProvider(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws IOException - Throws:
IOException
-
-
Method Details
-
delete
Description copied from interface:SchemaProvider
Deletes schema.- Specified by:
delete
in interfaceSchemaProvider
- Throws:
IOException
-
store
public void store(String schema, Map<String, String> properties, StorageProperties storageProperties) throws IOExceptionDescription copied from interface:SchemaProvider
Stores given schema definition and properties.- Specified by:
store
in interfaceSchemaProvider
- Parameters:
schema
- schema definitionproperties
- map of propertiesstorageProperties
- storage properties- Throws:
IOException
-
read
Description copied from interface:SchemaProvider
Reads schema intoSchemaContainer
. Depending on implementation, can read from a file or from the given input.- Specified by:
read
in interfaceSchemaProvider
- Returns:
- table schema instance
- Throws:
IOException
-
exists
Description copied from interface:SchemaProvider
Checks if schema exists.- Specified by:
exists
in interfaceSchemaProvider
- Returns:
- true if schema exists, false otherwise
- Throws:
IOException
-
createTableSchema
protected SchemaContainer createTableSchema(String schema, Map<String, String> properties) throws IOException- Throws:
IOException
-