Hi
I'm writing a new msgpack data source for Drill. I would like to be able to
configure the reader using the alter session mechanism using sqlline,
something like "alter session set `store.msgpack.reader.learnschema` =
true".
However I'm unable to make this work. In my format plugin I have added this
code to my MsgpackRecordReader. Note I'm taking inspiration from the
JSONRecordReader.
public static final String MSGPACK_LEARN_SCHEMA =
"store.msgpack.reader.learnschema";
public static final BooleanValidator MSGPACK_LEARN_SCHEMA_VALIDATOR = new
BooleanValidator(MSGPACK_LEARN_SCHEMA, null);
public MsgpackRecordReader(MsgpackFormatConfig config, final
FragmentContext fragmentContext, final String inputPath,
final DrillFileSystem fileSystem, final List<SchemaPath> columns) {
Preconditions.checkArgument((inputPath != null), "InputPath must be
set.");
this.hadoopPath = new Path(inputPath);
this.fileSystem = fileSystem;
this.fragmentContext = fragmentContext;
this.learnSchema =
fragmentContext.getOptions().getOption(MSGPACK_LEARN_SCHEMA_VALIDATOR);
setColumns(columns);
}
However this is not working. I noticed that the JSONRecordReader registers
it's properties in the SystemOptionManager like so. Is there a way for a
format plugin in the "contrib" folder to be able to do the same?
public class SystemOptionManager extends BaseOptionManager implements
AutoCloseable {
/**
* Creates all the OptionDefinitions to be registered with the {@link
SystemOptionManager}.
* @return A map
*/
public static CaseInsensitiveMap<OptionDefinition>
createDefaultOptionDefinitions() {
new
OptionDefinition(ExecConstants.JSON_SKIP_MALFORMED_RECORDS_VALIDATOR),
Thank you
jc