Created
November 9, 2019 07:11
-
-
Save masayuki038/cd53ed5f066e32cf36403670c093f0db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.wrap_trap.calcite_avro_sample; | |
import org.apache.calcite.model.ModelHandler; | |
import org.apache.calcite.schema.Schema; | |
import org.apache.calcite.schema.SchemaFactory; | |
import org.apache.calcite.schema.SchemaPlus; | |
import java.io.File; | |
import java.util.Map; | |
public class AvroSchemaFactory implements SchemaFactory { | |
public Schema create(SchemaPlus parentSchema, String name, Map<String, Object> operand) { | |
String directory = (String) operand.get("directory"); | |
File base = (File) operand.get(ModelHandler.ExtraOperand.BASE_DIRECTORY.camelName); | |
File directoryFile = new File(directory); | |
if (base != null && !directoryFile.isAbsolute()) { | |
directoryFile = new File(base, directory); | |
} | |
return new AvroSchema(directoryFile); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment