-
Notifications
You must be signed in to change notification settings - Fork 62
feat: custom schema #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
darthmiguel
commented
Jul 31, 2018
- add custom schema flag to the config
- refactor toStruct method
- refactor toStruct implementation StringStructConverter
- refactor toStruct implementation JsonStructConverter
- ConverterUtils, methods to extract the schema from the record value
* add custom schema flag to the config * refactor toStruct method * refactor toStruct implementation StringStructConverter * refactor toStruct implementation JsonStructConverter * ConverterUtils, methods to extract the schema from the record value
Struct messageStruct = getStruct(message); | ||
String topic = getTopic(message); | ||
String db = getDB(message); | ||
String timestamp = getTimestamp(message); | ||
records.add(new SourceRecord(Collections.singletonMap("mongodb", db), Collections.singletonMap(db, timestamp), topic, messageStruct.schema(), messageStruct)); | ||
Object objectKey = ((Map<String, Object>) message.get("o")).get("_id"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please clean up the extraneous whitespace here and at line 152?
} | ||
|
||
try{ | ||
customSchema = Boolean.parseBoolean(map.get(MongodbSourceConfig.CUSTOM_SCHEMA)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest making the boolean optional (check for existence with map.containsKey()), and if not specified, default to false to allow the original behavior. The new behavior will be opt-in then.