[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530691#comment-16530691 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > Fix For: 1.8.0 > > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530698#comment-16530698 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > Fix For: 1.8.0 > > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530696#comment-16530696 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > Fix For: 1.8.0 > > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530700#comment-16530700 ] ASF GitHub Bot commented on NIFI-5059: -- Github user asfgit closed the pull request at: https://github.com/apache/nifi/pull/2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > Fix For: 1.8.0 > > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530697#comment-16530697 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > Fix For: 1.8.0 > > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530694#comment-16530694 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > Fix For: 1.8.0 > > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530692#comment-16530692 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > Fix For: 1.8.0 > > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530693#comment-16530693 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > Fix For: 1.8.0 > > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530695#comment-16530695 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > Fix For: 1.8.0 > > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530686#comment-16530686 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530690#comment-16530690 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530689#comment-16530689 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530684#comment-16530684 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on the issue: https://github.com/apache/nifi/pull/2619 +1 LGTM, one of the unit tests in Travis is failing but it's not the fault of this code. I ran the unit tests and some tests on a live NiFi instance with "Infer" and "Schema Text" strategies, all looked well. Thanks for the addition! Merging to master > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530685#comment-16530685 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530687#comment-16530687 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530688#comment-16530688 ] ASF subversion and git services commented on NIFI-5059: --- Commit 22ec069acb39d59388d4adc4965929cfdba8f36b in nifi's branch refs/heads/master from [~mike.thomsen] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=22ec069 ] NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. NIFI-5059 Changed it to use a schema registry. NIFI-5059 Updated MongoDBLookupService to be a SchemaRegistryService. NIFI-5059 Added two changes from a code review. NIFI-5059 Fixed two bad references. NIFI-5059 Refactored schema strategy handling. NIFI-5059 Moved schema strategy handling to JsonInferenceSchemaRegistryService. NIFI-5059 Updated to use new LookupService method. NIFI-5059 fixed schema inference bug. NIFI-5059 Added test for schema text strategy NIFI-5059 incremented version number to make the build work. NIFI-5059 fixed a stray 1.7.0 reference. NIFI-5059 Added getDatabase to client service. NIFI-5059 Added changes requested in a code review. Signed-off-by: Matthew Burgess This closes #2619 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530358#comment-16530358 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r199602436 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/test/java/org/apache/nifi/mongodb/TestSchemaRegistry.java --- @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.mongodb; + +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.schema.access.SchemaField; +import org.apache.nifi.schemaregistry.services.SchemaRegistry; +import org.apache.nifi.serialization.SimpleRecordSchema; +import org.apache.nifi.serialization.record.RecordField; +import org.apache.nifi.serialization.record.RecordFieldType; +import org.apache.nifi.serialization.record.RecordSchema; +import org.apache.nifi.serialization.record.SchemaIdentifier; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class TestSchemaRegistry extends AbstractControllerService implements SchemaRegistry { --- End diff -- Yeah. Changed it to StubSchemaRegistry. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530359#comment-16530359 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @mattyb149 made the changes you requested. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530349#comment-16530349 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r199600826 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/serialization/JsonInferenceSchemaRegistryService.java --- @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.serialization; + +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.AllowableValue; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.schema.access.AvroSchemaTextStrategy; +import org.apache.nifi.schema.access.InferenceSchemaStrategy; +import org.apache.nifi.schema.access.JsonSchemaAccessStrategy; +import org.apache.nifi.schema.access.SchemaAccessStrategy; +import org.apache.nifi.schema.access.SchemaNamePropertyStrategy; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schemaregistry.services.SchemaRegistry; +import org.apache.nifi.serialization.record.RecordSchema; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static org.apache.nifi.schema.access.SchemaAccessUtils.INFER_SCHEMA; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_BRANCH_NAME; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_NAME; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_NAME_PROPERTY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_REGISTRY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_TEXT; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_TEXT_PROPERTY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_VERSION; + +public class JsonInferenceSchemaRegistryService extends SchemaRegistryService { +private String schemaAccess; + +@OnEnabled +public void onEnabled(ConfigurationContext context) { +this.storeSchemaAccessStrategy(context); +this.schemaAccess = context.getProperty(getSchemaAcessStrategyDescriptor()).getValue(); +} + +@Override +protected SchemaAccessStrategy getSchemaAccessStrategy(final String strategy, final SchemaRegistry schemaRegistry, final ConfigurationContext context) { --- End diff -- Done. I think that probably is the right thing to do here. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530339#comment-16530339 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r199597348 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/schema/access/SchemaAccessUtils.java --- @@ -50,7 +50,7 @@ "The content of the FlowFile contains a reference to a schema in the Schema Registry service. The reference is encoded as a single " + "'Magic Byte' followed by 4 bytes representing the identifier of the schema, as outlined at http://docs.confluent.io/current/schema-registry/docs/serializer-formatter.html. " + "This is based on version 3.2.x of the Confluent Schema Registry."); - +public static final AllowableValue INFER_SCHEMA = new AllowableValue("infer", "Infer from JSON"); --- End diff -- Probably. I'll go ahead and make that change. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530015#comment-16530015 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r199519266 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/test/java/org/apache/nifi/mongodb/TestSchemaRegistry.java --- @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.mongodb; + +import org.apache.nifi.controller.AbstractControllerService; +import org.apache.nifi.schema.access.SchemaField; +import org.apache.nifi.schemaregistry.services.SchemaRegistry; +import org.apache.nifi.serialization.SimpleRecordSchema; +import org.apache.nifi.serialization.record.RecordField; +import org.apache.nifi.serialization.record.RecordFieldType; +import org.apache.nifi.serialization.record.RecordSchema; +import org.apache.nifi.serialization.record.SchemaIdentifier; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class TestSchemaRegistry extends AbstractControllerService implements SchemaRegistry { --- End diff -- Should this be called StubSchemaRegistry or MockSchemaRegistry? With Test at the front, I imagine it gets picked up by JUnit (although there are no @Test methods, but still) > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530014#comment-16530014 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r199518028 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/serialization/JsonInferenceSchemaRegistryService.java --- @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.serialization; + +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.AllowableValue; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.schema.access.AvroSchemaTextStrategy; +import org.apache.nifi.schema.access.InferenceSchemaStrategy; +import org.apache.nifi.schema.access.JsonSchemaAccessStrategy; +import org.apache.nifi.schema.access.SchemaAccessStrategy; +import org.apache.nifi.schema.access.SchemaNamePropertyStrategy; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.schemaregistry.services.SchemaRegistry; +import org.apache.nifi.serialization.record.RecordSchema; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static org.apache.nifi.schema.access.SchemaAccessUtils.INFER_SCHEMA; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_BRANCH_NAME; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_NAME; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_NAME_PROPERTY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_REGISTRY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_TEXT; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_TEXT_PROPERTY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_VERSION; + +public class JsonInferenceSchemaRegistryService extends SchemaRegistryService { +private String schemaAccess; + +@OnEnabled +public void onEnabled(ConfigurationContext context) { +this.storeSchemaAccessStrategy(context); +this.schemaAccess = context.getProperty(getSchemaAcessStrategyDescriptor()).getValue(); +} + +@Override +protected SchemaAccessStrategy getSchemaAccessStrategy(final String strategy, final SchemaRegistry schemaRegistry, final ConfigurationContext context) { --- End diff -- Since this impl is specifically for JSON inference, perhaps it should override getDefaultSchemaAccessStrategy() to return the Infer one? > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16530016#comment-16530016 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r199517358 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/schema/access/SchemaAccessUtils.java --- @@ -50,7 +50,7 @@ "The content of the FlowFile contains a reference to a schema in the Schema Registry service. The reference is encoded as a single " + "'Magic Byte' followed by 4 bytes representing the identifier of the schema, as outlined at http://docs.confluent.io/current/schema-registry/docs/serializer-formatter.html. " + "This is based on version 3.2.x of the Confluent Schema Registry."); - +public static final AllowableValue INFER_SCHEMA = new AllowableValue("infer", "Infer from JSON"); --- End diff -- Shouldn't this be "Infer from Result" or something? It could be used by other processors to infer the schema from whatever object is returned. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16529399#comment-16529399 ] ASF GitHub Bot commented on NIFI-5059: -- Github user zenfenan commented on the issue: https://github.com/apache/nifi/pull/2619 @MikeThomsen I'm actually traveling with limited access to mails and internet. I'll try to take a look as soon as I can, if someone doesn't get to already. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16528656#comment-16528656 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @zenfenan can you review? I think we're almost at close out point. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16523590#comment-16523590 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @mattyb149 can we close the loop on this? > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16517080#comment-16517080 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @mattyb149 @ijokarumawak do either of you have time to get this reviewed before 1.7.0 release vote starts? > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504762#comment-16504762 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 That was the original approach. I'm now leaning toward going back to that because it's feeling like "less is more" here. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504757#comment-16504757 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193770298 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/schema/access/JsonSchemaAccessStrategy.java --- @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.schema.access; + +import org.apache.nifi.serialization.record.RecordSchema; + +import java.io.IOException; +import java.util.Map; + +public interface JsonSchemaAccessStrategy extends SchemaAccessStrategy { --- End diff -- You're not missing anything... > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504719#comment-16504719 ] ASF GitHub Bot commented on NIFI-5059: -- Github user bbende commented on the issue: https://github.com/apache/nifi/pull/2619 I haven't gone too deep looking at this, but if the goal is to have a re-usable way to infer a schema from JSON across various NoSQL components, have we considered just putting some utility code in a JAR somewhere under nifi-nar-bundles/nifi-extension-utils rather than trying to hook into the SchemaAccessStrategy/SchemaRegistryService? I'm just on the fence about whether the schema access stuff makes sense here since that was designed for the readers/writers, and this is really coming from a different angle of already having some Map object in memory. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504655#comment-16504655 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193740195 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/serialization/JsonInferenceSchemaRegistryService.java --- @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.serialization; + +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.AllowableValue; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.schema.access.JsonSchemaAccessStrategy; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.serialization.record.RecordSchema; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static org.apache.nifi.schema.access.SchemaAccessUtils.INFER_SCHEMA; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_BRANCH_NAME; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_NAME; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_NAME_PROPERTY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_REGISTRY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_TEXT; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_TEXT_PROPERTY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_VERSION; + +public class JsonInferenceSchemaRegistryService extends SchemaRegistryService { --- End diff -- Yeah, if this gets expanded into the readers I could definitely see that being the case. For now, this is limited to being used by LookupServices that need schema access + JSON help like this one, the ES one and possibly later something like a RethinkDBLookupService. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504654#comment-16504654 ] ASF GitHub Bot commented on NIFI-5059: -- Github user bbende commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193739859 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/schema/access/JsonSchemaAccessStrategy.java --- @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.schema.access; + +import org.apache.nifi.serialization.record.RecordSchema; + +import java.io.IOException; +import java.util.Map; + +public interface JsonSchemaAccessStrategy extends SchemaAccessStrategy { --- End diff -- Ok but I'm confused because I'm not seeing an actual call that uses the new method... The MongoLookupService does this: ``` private RecordSchema loadSchema(Map coordinates, Document doc) { +Map variables = coordinates.entrySet().stream() +.collect(Collectors.toMap( +e -> e.getKey(), +e -> e.getValue().toString() +)); +ObjectMapper mapper = new ObjectMapper(); +try { +byte[] bytes = mapper.writeValueAsBytes(doc); +return getSchema(variables, new ByteArrayInputStream(bytes), null); +} catch (Exception ex) { +return null; +} +} So since we are reserializing the Doc here and putting the coordinates as variables, I'm not seeing where we call the new method, but I may be missing it. ``` > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504649#comment-16504649 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193738667 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/schema/access/SchemaAccessUtils.java --- @@ -176,6 +176,8 @@ public static SchemaAccessStrategy getSchemaAccessStrategy(final String allowabl return new HortonworksAttributeSchemaReferenceStrategy(schemaRegistry); } else if (allowableValue.equalsIgnoreCase(CONFLUENT_ENCODED_SCHEMA.getValue())) { return new ConfluentSchemaRegistryStrategy(schemaRegistry); +} else if (allowableValue.equalsIgnoreCase(INFER_SCHEMA.getValue())) { --- End diff -- Ok. I'll work on that. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504643#comment-16504643 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193737082 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/schema/access/JsonSchemaAccessStrategy.java --- @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.schema.access; + +import org.apache.nifi.serialization.record.RecordSchema; + +import java.io.IOException; +import java.util.Map; + +public interface JsonSchemaAccessStrategy extends SchemaAccessStrategy { --- End diff -- The client APIs for the third party systems usually return a Map, not a String that we can just pass on. I didn't want to serialize the client's output and then deserialize it later. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504637#comment-16504637 ] ASF GitHub Bot commented on NIFI-5059: -- Github user bbende commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193733115 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/schema/access/SchemaAccessUtils.java --- @@ -176,6 +176,8 @@ public static SchemaAccessStrategy getSchemaAccessStrategy(final String allowabl return new HortonworksAttributeSchemaReferenceStrategy(schemaRegistry); } else if (allowableValue.equalsIgnoreCase(CONFLUENT_ENCODED_SCHEMA.getValue())) { return new ConfluentSchemaRegistryStrategy(schemaRegistry); +} else if (allowableValue.equalsIgnoreCase(INFER_SCHEMA.getValue())) { --- End diff -- Since this inference only works when the content is JSON, I think this option should only be available when using a JSON related record reader, and not available in the default case. This would be similar to how the AvroReader makes available the option for "Embedded Avro Schema" - https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/avro/AvroReader.java#L63 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504636#comment-16504636 ] ASF GitHub Bot commented on NIFI-5059: -- Github user bbende commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193735509 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/serialization/JsonInferenceSchemaRegistryService.java --- @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.serialization; + +import org.apache.nifi.annotation.lifecycle.OnEnabled; +import org.apache.nifi.components.AllowableValue; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.controller.ConfigurationContext; +import org.apache.nifi.schema.access.JsonSchemaAccessStrategy; +import org.apache.nifi.schema.access.SchemaNotFoundException; +import org.apache.nifi.serialization.record.RecordSchema; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static org.apache.nifi.schema.access.SchemaAccessUtils.INFER_SCHEMA; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_BRANCH_NAME; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_NAME; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_NAME_PROPERTY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_REGISTRY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_TEXT; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_TEXT_PROPERTY; +import static org.apache.nifi.schema.access.SchemaAccessUtils.SCHEMA_VERSION; + +public class JsonInferenceSchemaRegistryService extends SchemaRegistryService { --- End diff -- I'm not totally sure about this, but I think if we take the approach mentioned in my other comments, we probably wouldn't need this class since the JSON readers would handle the logic for when schemaAccess is set to "JSON Inference", similar to how AvroReader handles when embedded schema is selected - https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/avro/AvroReader.java#L78 > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504635#comment-16504635 ] ASF GitHub Bot commented on NIFI-5059: -- Github user bbende commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193734191 --- Diff: nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/schema/access/JsonSchemaAccessStrategy.java --- @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.nifi.schema.access; + +import org.apache.nifi.serialization.record.RecordSchema; + +import java.io.IOException; +import java.util.Map; + +public interface JsonSchemaAccessStrategy extends SchemaAccessStrategy { --- End diff -- Can this be done without introducing a new method to the interface? The original interface has: `getSchema(Map variables, InputStream contentStream, RecordSchema readSchema` Since we know the content has to be json in this case, can't we read contentStream into the Map in the implementation of the access strategy, rather than requiring callers to do that first? > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504604#comment-16504604 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @mattyb149 @ijokarumawak @bbende I built on the schema registry service to add a new option for NoSQL options like Mongo, ES, Solr, etc. to just throw JSON in `Map` form and say "you figure it out." Please take a look at the new schema code when you get a chance. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16503563#comment-16503563 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193480390 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java --- @@ -52,68 +54,125 @@ "The query is limited to the first result (findOne in the Mongo documentation). If no \"Lookup Value Field\" is specified " + "then the entire MongoDB result document minus the _id field will be returned as a record." ) -public class MongoDBLookupService extends MongoDBControllerService implements LookupService { +public class MongoDBLookupService extends SchemaRegistryService implements LookupService { +public static final PropertyDescriptor CONTROLLER_SERVICE = new PropertyDescriptor.Builder() +.name("mongo-lookup-client-service") +.displayName("Client Service") +.description("A MongoDB controller service to use with this lookup service.") +.required(true) +.identifiesControllerService(MongoDBClientService.class) +.build(); public static final PropertyDescriptor LOOKUP_VALUE_FIELD = new PropertyDescriptor.Builder() -.name("mongo-lookup-value-field") -.displayName("Lookup Value Field") -.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + -"MongoDB result document minus the _id field will be returned as a record.") -.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) -.required(false) -.build(); +.name("mongo-lookup-value-field") +.displayName("Lookup Value Field") +.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + +"MongoDB result document minus the _id field will be returned as a record.") +.addValidator(Validator.VALID) +.required(false) +.build(); +public static final PropertyDescriptor PROJECTION = new PropertyDescriptor.Builder() +.name("mongo-lookup-projection") +.displayName("Projection") +.description("Specifies a projection for limiting which fields will be returned.") +.required(false) +.build(); private String lookupValueField; -private static final List lookupDescriptors; - -static { -lookupDescriptors = new ArrayList<>(); -lookupDescriptors.addAll(descriptors); -lookupDescriptors.add(LOOKUP_VALUE_FIELD); -} - @Override public Optional lookup(Map coordinates) throws LookupFailureException { -Map clean = new HashMap<>(); -clean.putAll(coordinates); +Map clean = coordinates.entrySet().stream() +.filter(e -> !schemaNameProperty.equals(String.format("${%s}", e.getKey( +.collect(Collectors.toMap( +e -> e.getKey(), +e -> e.getValue() +)); Document query = new Document(clean); if (coordinates.size() == 0) { throw new LookupFailureException("No keys were configured. Mongo query would return random documents."); } try { -Document result = this.findOne(query); +Document result = projection != null ? controllerService.findOne(query, projection) : controllerService.findOne(query); if(result == null) { return Optional.empty(); } else if (!StringUtils.isEmpty(lookupValueField)) { return Optional.ofNullable(result.get(lookupValueField)); } else { -final List fields = new ArrayList<>(); +RecordSchema schema = loadSchema(coordinates); -for (String key : result.keySet()) { -if (key.equals("_id")) { -continue; -} -fields.add(new RecordField(key, RecordFieldType.STRING.getDataType())); -} - -final RecordSchema schema = new SimpleRecordSchema(fields); -return Optional.ofNullable(new MapRecord(schema, result)); +RecordSchema toUse = schema != null ? schema : convertSchema(result); --- End diff -- That's probably the
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16503278#comment-16503278 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193406221 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java --- @@ -52,68 +54,125 @@ "The query is limited to the first result (findOne in the Mongo documentation). If no \"Lookup Value Field\" is specified " + "then the entire MongoDB result document minus the _id field will be returned as a record." ) -public class MongoDBLookupService extends MongoDBControllerService implements LookupService { +public class MongoDBLookupService extends SchemaRegistryService implements LookupService { +public static final PropertyDescriptor CONTROLLER_SERVICE = new PropertyDescriptor.Builder() +.name("mongo-lookup-client-service") +.displayName("Client Service") +.description("A MongoDB controller service to use with this lookup service.") +.required(true) +.identifiesControllerService(MongoDBClientService.class) +.build(); public static final PropertyDescriptor LOOKUP_VALUE_FIELD = new PropertyDescriptor.Builder() -.name("mongo-lookup-value-field") -.displayName("Lookup Value Field") -.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + -"MongoDB result document minus the _id field will be returned as a record.") -.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) -.required(false) -.build(); +.name("mongo-lookup-value-field") +.displayName("Lookup Value Field") +.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + +"MongoDB result document minus the _id field will be returned as a record.") +.addValidator(Validator.VALID) +.required(false) +.build(); +public static final PropertyDescriptor PROJECTION = new PropertyDescriptor.Builder() +.name("mongo-lookup-projection") +.displayName("Projection") +.description("Specifies a projection for limiting which fields will be returned.") +.required(false) +.build(); private String lookupValueField; -private static final List lookupDescriptors; - -static { -lookupDescriptors = new ArrayList<>(); -lookupDescriptors.addAll(descriptors); -lookupDescriptors.add(LOOKUP_VALUE_FIELD); -} - @Override public Optional lookup(Map coordinates) throws LookupFailureException { -Map clean = new HashMap<>(); -clean.putAll(coordinates); +Map clean = coordinates.entrySet().stream() +.filter(e -> !schemaNameProperty.equals(String.format("${%s}", e.getKey( +.collect(Collectors.toMap( +e -> e.getKey(), +e -> e.getValue() +)); Document query = new Document(clean); if (coordinates.size() == 0) { throw new LookupFailureException("No keys were configured. Mongo query would return random documents."); } try { -Document result = this.findOne(query); +Document result = projection != null ? controllerService.findOne(query, projection) : controllerService.findOne(query); if(result == null) { return Optional.empty(); } else if (!StringUtils.isEmpty(lookupValueField)) { return Optional.ofNullable(result.get(lookupValueField)); } else { -final List fields = new ArrayList<>(); +RecordSchema schema = loadSchema(coordinates); -for (String key : result.keySet()) { -if (key.equals("_id")) { -continue; -} -fields.add(new RecordField(key, RecordFieldType.STRING.getDataType())); -} - -final RecordSchema schema = new SimpleRecordSchema(fields); -return Optional.ofNullable(new MapRecord(schema, result)); +RecordSchema toUse = schema != null ? schema : convertSchema(result); --- End diff -- One thing you could
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16503180#comment-16503180 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r193381877 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java --- @@ -52,68 +54,125 @@ "The query is limited to the first result (findOne in the Mongo documentation). If no \"Lookup Value Field\" is specified " + "then the entire MongoDB result document minus the _id field will be returned as a record." ) -public class MongoDBLookupService extends MongoDBControllerService implements LookupService { +public class MongoDBLookupService extends SchemaRegistryService implements LookupService { +public static final PropertyDescriptor CONTROLLER_SERVICE = new PropertyDescriptor.Builder() +.name("mongo-lookup-client-service") +.displayName("Client Service") +.description("A MongoDB controller service to use with this lookup service.") +.required(true) +.identifiesControllerService(MongoDBClientService.class) +.build(); public static final PropertyDescriptor LOOKUP_VALUE_FIELD = new PropertyDescriptor.Builder() -.name("mongo-lookup-value-field") -.displayName("Lookup Value Field") -.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + -"MongoDB result document minus the _id field will be returned as a record.") -.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) -.required(false) -.build(); +.name("mongo-lookup-value-field") +.displayName("Lookup Value Field") +.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + +"MongoDB result document minus the _id field will be returned as a record.") +.addValidator(Validator.VALID) +.required(false) +.build(); +public static final PropertyDescriptor PROJECTION = new PropertyDescriptor.Builder() +.name("mongo-lookup-projection") +.displayName("Projection") +.description("Specifies a projection for limiting which fields will be returned.") +.required(false) +.build(); private String lookupValueField; -private static final List lookupDescriptors; - -static { -lookupDescriptors = new ArrayList<>(); -lookupDescriptors.addAll(descriptors); -lookupDescriptors.add(LOOKUP_VALUE_FIELD); -} - @Override public Optional lookup(Map coordinates) throws LookupFailureException { -Map clean = new HashMap<>(); -clean.putAll(coordinates); +Map clean = coordinates.entrySet().stream() +.filter(e -> !schemaNameProperty.equals(String.format("${%s}", e.getKey( +.collect(Collectors.toMap( +e -> e.getKey(), +e -> e.getValue() +)); Document query = new Document(clean); if (coordinates.size() == 0) { throw new LookupFailureException("No keys were configured. Mongo query would return random documents."); } try { -Document result = this.findOne(query); +Document result = projection != null ? controllerService.findOne(query, projection) : controllerService.findOne(query); if(result == null) { return Optional.empty(); } else if (!StringUtils.isEmpty(lookupValueField)) { return Optional.ofNullable(result.get(lookupValueField)); } else { -final List fields = new ArrayList<>(); +RecordSchema schema = loadSchema(coordinates); -for (String key : result.keySet()) { -if (key.equals("_id")) { -continue; -} -fields.add(new RecordField(key, RecordFieldType.STRING.getDataType())); -} - -final RecordSchema schema = new SimpleRecordSchema(fields); -return Optional.ofNullable(new MapRecord(schema, result)); +RecordSchema toUse = schema != null ? schema : convertSchema(result); --- End diff -- @mattyb149 I think
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16502784#comment-16502784 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on the issue: https://github.com/apache/nifi/pull/2619 I may have shot myself in the foot here by asking that this extend SchemaRegistryService, as that requires you supply some way to get to the schema. In this current form, how would I get to the code path where the Mongo document's schema is gleaned vs being provided from somewhere else? > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16502254#comment-16502254 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @mattyb149 can we close this one out? It's a good starting point for [this cleanup task](https://issues.apache.org/jira/browse/NIFI-5239). > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500703#comment-16500703 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r192841468 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java --- @@ -52,68 +54,125 @@ "The query is limited to the first result (findOne in the Mongo documentation). If no \"Lookup Value Field\" is specified " + "then the entire MongoDB result document minus the _id field will be returned as a record." ) -public class MongoDBLookupService extends MongoDBControllerService implements LookupService { +public class MongoDBLookupService extends SchemaRegistryService implements LookupService { +public static final PropertyDescriptor CONTROLLER_SERVICE = new PropertyDescriptor.Builder() +.name("mongo-lookup-client-service") +.displayName("Client Service") +.description("A MongoDB controller service to use with this lookup service.") +.required(true) +.identifiesControllerService(MongoDBControllerService.class) +.build(); public static final PropertyDescriptor LOOKUP_VALUE_FIELD = new PropertyDescriptor.Builder() -.name("mongo-lookup-value-field") -.displayName("Lookup Value Field") -.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + -"MongoDB result document minus the _id field will be returned as a record.") -.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) -.required(false) -.build(); +.name("mongo-lookup-value-field") +.displayName("Lookup Value Field") +.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + +"MongoDB result document minus the _id field will be returned as a record.") +.addValidator(Validator.VALID) +.required(false) +.build(); +public static final PropertyDescriptor PROJECTION = new PropertyDescriptor.Builder() +.name("mongo-lookup-projection") +.displayName("Projection") +.description("Specifies a projection for limiting which fields will be returned.") +.required(false) +.build(); private String lookupValueField; -private static final List lookupDescriptors; - -static { -lookupDescriptors = new ArrayList<>(); -lookupDescriptors.addAll(descriptors); -lookupDescriptors.add(LOOKUP_VALUE_FIELD); -} - @Override public Optional lookup(Map coordinates) throws LookupFailureException { -Map clean = new HashMap<>(); -clean.putAll(coordinates); +Map clean = coordinates.entrySet().stream() +.filter(e -> !schemaNameProperty.equals(String.format("${%s}", e.getKey( +.collect(Collectors.toMap( +e -> e.getKey(), +e -> e.getValue() +)); Document query = new Document(clean); if (coordinates.size() == 0) { throw new LookupFailureException("No keys were configured. Mongo query would return random documents."); } try { -Document result = this.findOne(query); +Document result = projection != null ? controllerService.findOne(query, projection) : controllerService.findOne(query); if(result == null) { return Optional.empty(); } else if (!StringUtils.isEmpty(lookupValueField)) { return Optional.ofNullable(result.get(lookupValueField)); } else { -final List fields = new ArrayList<>(); +RecordSchema schema = loadSchema(coordinates); -for (String key : result.keySet()) { -if (key.equals("_id")) { -continue; -} -fields.add(new RecordField(key, RecordFieldType.STRING.getDataType())); -} - -final RecordSchema schema = new SimpleRecordSchema(fields); -return Optional.ofNullable(new MapRecord(schema, result)); +RecordSchema toUse = schema != null ? schema : convertSchema(result); +return
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500728#comment-16500728 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @mattyb149 updated, but looks like Travis is busted at the moment (saying it can't find our repo) > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500481#comment-16500481 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on the issue: https://github.com/apache/nifi/pull/2619 Agreed, I'll try to get this one in today then take a look at the ES one. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500471#comment-16500471 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @mattyb149 once this and the ES one are merged, it would probably be a good time to discuss extracting the schema builder code into a utility class. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500463#comment-16500463 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 Accidentally rebased it a while and so I had to force push. Sorry about that. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500458#comment-16500458 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r192802039 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java --- @@ -52,68 +54,125 @@ "The query is limited to the first result (findOne in the Mongo documentation). If no \"Lookup Value Field\" is specified " + "then the entire MongoDB result document minus the _id field will be returned as a record." ) -public class MongoDBLookupService extends MongoDBControllerService implements LookupService { +public class MongoDBLookupService extends SchemaRegistryService implements LookupService { +public static final PropertyDescriptor CONTROLLER_SERVICE = new PropertyDescriptor.Builder() --- End diff -- I added to the property list. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500459#comment-16500459 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r192802068 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java --- @@ -52,68 +54,125 @@ "The query is limited to the first result (findOne in the Mongo documentation). If no \"Lookup Value Field\" is specified " + "then the entire MongoDB result document minus the _id field will be returned as a record." ) -public class MongoDBLookupService extends MongoDBControllerService implements LookupService { +public class MongoDBLookupService extends SchemaRegistryService implements LookupService { +public static final PropertyDescriptor CONTROLLER_SERVICE = new PropertyDescriptor.Builder() +.name("mongo-lookup-client-service") +.displayName("Client Service") +.description("A MongoDB controller service to use with this lookup service.") +.required(true) +.identifiesControllerService(MongoDBControllerService.class) +.build(); public static final PropertyDescriptor LOOKUP_VALUE_FIELD = new PropertyDescriptor.Builder() -.name("mongo-lookup-value-field") -.displayName("Lookup Value Field") -.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + -"MongoDB result document minus the _id field will be returned as a record.") -.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) -.required(false) -.build(); +.name("mongo-lookup-value-field") +.displayName("Lookup Value Field") +.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + +"MongoDB result document minus the _id field will be returned as a record.") +.addValidator(Validator.VALID) +.required(false) +.build(); +public static final PropertyDescriptor PROJECTION = new PropertyDescriptor.Builder() +.name("mongo-lookup-projection") +.displayName("Projection") +.description("Specifies a projection for limiting which fields will be returned.") +.required(false) +.build(); private String lookupValueField; -private static final List lookupDescriptors; - -static { -lookupDescriptors = new ArrayList<>(); -lookupDescriptors.addAll(descriptors); -lookupDescriptors.add(LOOKUP_VALUE_FIELD); -} - @Override public Optional lookup(Map coordinates) throws LookupFailureException { -Map clean = new HashMap<>(); -clean.putAll(coordinates); +Map clean = coordinates.entrySet().stream() +.filter(e -> !schemaNameProperty.equals(String.format("${%s}", e.getKey( +.collect(Collectors.toMap( +e -> e.getKey(), +e -> e.getValue() +)); Document query = new Document(clean); if (coordinates.size() == 0) { throw new LookupFailureException("No keys were configured. Mongo query would return random documents."); } try { -Document result = this.findOne(query); +Document result = projection != null ? controllerService.findOne(query, projection) : controllerService.findOne(query); if(result == null) { return Optional.empty(); } else if (!StringUtils.isEmpty(lookupValueField)) { return Optional.ofNullable(result.get(lookupValueField)); } else { -final List fields = new ArrayList<>(); +RecordSchema schema = loadSchema(coordinates); -for (String key : result.keySet()) { -if (key.equals("_id")) { -continue; -} -fields.add(new RecordField(key, RecordFieldType.STRING.getDataType())); -} - -final RecordSchema schema = new SimpleRecordSchema(fields); -return Optional.ofNullable(new MapRecord(schema, result)); +RecordSchema toUse = schema != null ? schema : convertSchema(result); +return
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500380#comment-16500380 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r192783531 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java --- @@ -52,68 +54,125 @@ "The query is limited to the first result (findOne in the Mongo documentation). If no \"Lookup Value Field\" is specified " + "then the entire MongoDB result document minus the _id field will be returned as a record." ) -public class MongoDBLookupService extends MongoDBControllerService implements LookupService { +public class MongoDBLookupService extends SchemaRegistryService implements LookupService { +public static final PropertyDescriptor CONTROLLER_SERVICE = new PropertyDescriptor.Builder() --- End diff -- AFAICT this property is never added to the list of supported property descriptors, so I couldn't set it on the UI which causes an NPE when lookup() is called. Seems odd that for a required property that is not supported, setting it (in tests) would not complain. I haven't run the integration tests yet, just put the NARs into a live NiFi to try it out. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500381#comment-16500381 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r192783725 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java --- @@ -52,68 +54,125 @@ "The query is limited to the first result (findOne in the Mongo documentation). If no \"Lookup Value Field\" is specified " + "then the entire MongoDB result document minus the _id field will be returned as a record." ) -public class MongoDBLookupService extends MongoDBControllerService implements LookupService { +public class MongoDBLookupService extends SchemaRegistryService implements LookupService { +public static final PropertyDescriptor CONTROLLER_SERVICE = new PropertyDescriptor.Builder() +.name("mongo-lookup-client-service") +.displayName("Client Service") +.description("A MongoDB controller service to use with this lookup service.") +.required(true) +.identifiesControllerService(MongoDBControllerService.class) --- End diff -- I believe this is supposed to be an interface not the impl class (see my other comment below), so I think you want `MongoDBClientService` here. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500382#comment-16500382 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r192784028 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java --- @@ -52,68 +54,125 @@ "The query is limited to the first result (findOne in the Mongo documentation). If no \"Lookup Value Field\" is specified " + "then the entire MongoDB result document minus the _id field will be returned as a record." ) -public class MongoDBLookupService extends MongoDBControllerService implements LookupService { +public class MongoDBLookupService extends SchemaRegistryService implements LookupService { +public static final PropertyDescriptor CONTROLLER_SERVICE = new PropertyDescriptor.Builder() +.name("mongo-lookup-client-service") +.displayName("Client Service") +.description("A MongoDB controller service to use with this lookup service.") +.required(true) +.identifiesControllerService(MongoDBControllerService.class) +.build(); public static final PropertyDescriptor LOOKUP_VALUE_FIELD = new PropertyDescriptor.Builder() -.name("mongo-lookup-value-field") -.displayName("Lookup Value Field") -.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + -"MongoDB result document minus the _id field will be returned as a record.") -.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) -.required(false) -.build(); +.name("mongo-lookup-value-field") +.displayName("Lookup Value Field") +.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + +"MongoDB result document minus the _id field will be returned as a record.") +.addValidator(Validator.VALID) +.required(false) +.build(); +public static final PropertyDescriptor PROJECTION = new PropertyDescriptor.Builder() +.name("mongo-lookup-projection") +.displayName("Projection") +.description("Specifies a projection for limiting which fields will be returned.") +.required(false) +.build(); private String lookupValueField; -private static final List lookupDescriptors; - -static { -lookupDescriptors = new ArrayList<>(); -lookupDescriptors.addAll(descriptors); -lookupDescriptors.add(LOOKUP_VALUE_FIELD); -} - @Override public Optional lookup(Map coordinates) throws LookupFailureException { -Map clean = new HashMap<>(); -clean.putAll(coordinates); +Map clean = coordinates.entrySet().stream() +.filter(e -> !schemaNameProperty.equals(String.format("${%s}", e.getKey( +.collect(Collectors.toMap( +e -> e.getKey(), +e -> e.getValue() +)); Document query = new Document(clean); if (coordinates.size() == 0) { throw new LookupFailureException("No keys were configured. Mongo query would return random documents."); } try { -Document result = this.findOne(query); +Document result = projection != null ? controllerService.findOne(query, projection) : controllerService.findOne(query); if(result == null) { return Optional.empty(); } else if (!StringUtils.isEmpty(lookupValueField)) { return Optional.ofNullable(result.get(lookupValueField)); } else { -final List fields = new ArrayList<>(); +RecordSchema schema = loadSchema(coordinates); -for (String key : result.keySet()) { -if (key.equals("_id")) { -continue; -} -fields.add(new RecordField(key, RecordFieldType.STRING.getDataType())); -} - -final RecordSchema schema = new SimpleRecordSchema(fields); -return Optional.ofNullable(new MapRecord(schema, result)); +RecordSchema toUse = schema != null ? schema : convertSchema(result); +return
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16500336#comment-16500336 ] ASF GitHub Bot commented on NIFI-5059: -- Github user mattyb149 commented on the issue: https://github.com/apache/nifi/pull/2619 Reviewing... > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16495040#comment-16495040 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @mattyb149 can you review this? > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16481623#comment-16481623 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on a diff in the pull request: https://github.com/apache/nifi/pull/2619#discussion_r189434124 --- Diff: nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-services/src/main/java/org/apache/nifi/mongodb/MongoDBLookupService.java --- @@ -52,68 +54,125 @@ "The query is limited to the first result (findOne in the Mongo documentation). If no \"Lookup Value Field\" is specified " + "then the entire MongoDB result document minus the _id field will be returned as a record." ) -public class MongoDBLookupService extends MongoDBControllerService implements LookupService { +public class MongoDBLookupService extends SchemaRegistryService implements LookupService { +public static final PropertyDescriptor CONTROLLER_SERVICE = new PropertyDescriptor.Builder() +.name("mongo-lookup-client-service") +.displayName("Client Service") +.description("A MongoDB controller service to use with this lookup service.") +.required(true) +.identifiesControllerService(MongoDBControllerService.class) +.build(); public static final PropertyDescriptor LOOKUP_VALUE_FIELD = new PropertyDescriptor.Builder() -.name("mongo-lookup-value-field") -.displayName("Lookup Value Field") -.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + -"MongoDB result document minus the _id field will be returned as a record.") -.addValidator(StandardValidators.NON_EMPTY_VALIDATOR) -.required(false) -.build(); +.name("mongo-lookup-value-field") +.displayName("Lookup Value Field") +.description("The field whose value will be returned when the lookup key(s) match a record. If not specified then the entire " + +"MongoDB result document minus the _id field will be returned as a record.") +.addValidator(Validator.VALID) +.required(false) +.build(); +public static final PropertyDescriptor PROJECTION = new PropertyDescriptor.Builder() +.name("mongo-lookup-projection") +.displayName("Projection") +.description("Specifies a projection for limiting which fields will be returned.") +.required(false) +.build(); private String lookupValueField; -private static final List lookupDescriptors; - -static { -lookupDescriptors = new ArrayList<>(); -lookupDescriptors.addAll(descriptors); -lookupDescriptors.add(LOOKUP_VALUE_FIELD); -} - @Override public Optional lookup(Mapcoordinates) throws LookupFailureException { -Map clean = new HashMap<>(); -clean.putAll(coordinates); +Map clean = coordinates.entrySet().stream() +.filter(e -> !schemaNameProperty.equals(String.format("${%s}", e.getKey( +.collect(Collectors.toMap( +e -> e.getKey(), +e -> e.getValue() +)); Document query = new Document(clean); if (coordinates.size() == 0) { throw new LookupFailureException("No keys were configured. Mongo query would return random documents."); } try { -Document result = this.findOne(query); +Document result = projection != null ? controllerService.findOne(query, projection) : controllerService.findOne(query); if(result == null) { return Optional.empty(); } else if (!StringUtils.isEmpty(lookupValueField)) { return Optional.ofNullable(result.get(lookupValueField)); } else { -final List fields = new ArrayList<>(); +RecordSchema schema = loadSchema(coordinates); -for (String key : result.keySet()) { -if (key.equals("_id")) { -continue; -} -fields.add(new RecordField(key, RecordFieldType.STRING.getDataType())); -} - -final RecordSchema schema = new SimpleRecordSchema(fields); -return Optional.ofNullable(new MapRecord(schema, result)); +RecordSchema toUse = schema != null ? schema :
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16481621#comment-16481621 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @pvillard31 @mattyb149 I updated this to have a clean separation between the controller and lookup service code and subclassed the lookup service from SchemaRegistryService. Can one of you do a review sometime soon? > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16448900#comment-16448900 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @mattyb149 Any chance you can take a look? > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16433079#comment-16433079 ] Mike Thomsen commented on NIFI-5059: Done [~mattyb149] > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > > MongoDBLookupService should have two schema handling modes: > # Where a schema is provided as a configuration parameter to be applied to > the Record object generated from the result document. > # A schema will be generated by examining the result object and building one > that roughly translates from BSON into the Record API. > In both cases, the schema will be applied to the Mongo result Document object > that is returned if one comes back. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16433074#comment-16433074 ] Matt Burgess commented on NIFI-5059: Can you add a Description to this Jira to explain the use case and what you're proposing? It wasn't clear to me when you'd supply a schema, for example. Thanks in advance! > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16432140#comment-16432140 ] ASF GitHub Bot commented on NIFI-5059: -- Github user MikeThomsen commented on the issue: https://github.com/apache/nifi/pull/2619 @mattyb149 Had to change the schema handling in MongoDBLookupService. Can you take a look? > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (NIFI-5059) MongoDBLookupService should be able to determine a schema or have one provided
[ https://issues.apache.org/jira/browse/NIFI-5059?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16430735#comment-16430735 ] ASF GitHub Bot commented on NIFI-5059: -- GitHub user MikeThomsen opened a pull request: https://github.com/apache/nifi/pull/2619 NIFI-5059 Updated MongoDBLookupService to be able to detect record sc… …hemas or take one provided by the user. Thank you for submitting a contribution to Apache NiFi. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [ ] Does your PR title start with NIFI- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)? - [ ] Is your initial contribution a single, squashed commit? ### For code changes: - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder? - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly? - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly? - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties? ### For documentation related changes: - [ ] Have you ensured that format looks appropriate for the output in which it is rendered? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. You can merge this pull request into a Git repository by running: $ git pull https://github.com/MikeThomsen/nifi NIFI-5059 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/nifi/pull/2619.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #2619 commit 40cbd11915e15e87c5b568a2cd918e57126bb7b4 Author: Mike ThomsenDate: 2018-04-09T11:28:40Z NIFI-5059 Updated MongoDBLookupService to be able to detect record schemas or take one provided by the user. > MongoDBLookupService should be able to determine a schema or have one provided > -- > > Key: NIFI-5059 > URL: https://issues.apache.org/jira/browse/NIFI-5059 > Project: Apache NiFi > Issue Type: Improvement >Reporter: Mike Thomsen >Assignee: Mike Thomsen >Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)