[
https://issues.apache.org/jira/browse/NIFI-3010?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15765915#comment-15765915
]
ASF GitHub Bot commented on NIFI-3010:
--------------------------------------
GitHub user YolandaMDavis opened a pull request:
https://github.com/apache/nifi/pull/1348
NIFI-3010 - Incorporate Expression Language support for JoltTransformJSON
This PR contains several feature enhancements:
- Support of expression language within the specification
- Support of expression language testing using Advanced UI with new Test
Attributes dialog
- Update of Jolt library to version 0.1
- Added support for new Modifier library (Jolt Beta functionality)
For Testing:
Expression language can now be referenced within a Jolt Specification.
Expressions can be written on either side on the left hand side ( matching
input json keys) or the right hand side (output of json data) of the
specification. The Advanced UI can test expressions that reference attributes
using the Attributes dialog which allows users to provide key/value pairs that
will be resolved when testing a transformation.
<img width="1552" alt="joltspecel"
src="https://cloud.githubusercontent.com/assets/1371858/21375258/4e9f1878-c6fa-11e6-9a45-2213e6f42107.png">
<img width="1552" alt="joltspecel-variabledialog"
src="https://cloud.githubusercontent.com/assets/1371858/21375261/52c60d44-c6fa-11e6-9fff-9e815c6e7ce9.png">
Jolt 0.1 has added support for transformation of data within a given schema
through the Modifier library. Modifier introduces more sophisticated data
manipulation capabilities including for strings, lists, type conversion, etc.
<img width="1552" alt="joltspec-modfiers"
src="https://cloud.githubusercontent.com/assets/1371858/21375249/4080ccb4-c6fa-11e6-8e34-c41c33644aa9.png">
Below is an example chain specification that can be used against Twitter
payload for testing. When testing in the Advanced UI ensure that attributes
referenced in expression language are provided for testing (${rating.var} and
${id.var}) and that left side variable content match actual input (e.g. id.var
should equal 'id' for twitter json to match). Custom attributes can also be
configured with nifi to use this specification within an actual flow.
`
[{
"operation": "shift",
"spec": {
"created_at": "created_date_time",
"id": "tweet_id",
"text": "tweet_text",
"user": {
"${id.var}": "user_id"
}
}
},
{
"operation": "default",
"spec":{
"user-rating" : 4,
"twitter-rating" : "${rating.var}"
}
},{
"operation": "modify-default-beta",
"spec": {
"~in_reply_to_status_id": 0,
"~in_reply_to_status_id_str": 0,
"~in_reply_to_user_id": "",
"~in_reply_to_user_id_str": 0,
"~in_reply_to_screen_name": ""
}
},{
"operation": "modify-define-beta",
"spec": {
"user_nearby_address":"na"
}
},{
"operation": "modify-overwrite-beta",
"spec": {
"truncate" : true
}
}
]
`
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:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [x] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number
you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [x] Has your PR been rebased against the latest commit within the target
branch (typically master)?
- [x] Is your initial contribution a single, squashed commit?
### For code changes:
- [x] Have you ensured that the full suite of tests is executed via mvn
-Pcontrib-check clean install at the root nifi folder?
- [x] 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:
- [x] 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/YolandaMDavis/nifi NIFI-3010
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/1348.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 #1348
----
commit 3f48b3c5bcf757f8eec9f629afa36036e7e70b51
Author: Yolanda M. Davis <[email protected]>
Date: 2016-12-19T17:40:03Z
NIFI-3010 - Incorporate expression language support for jolt-spec for
processor and Advance UI. Upgraded jolt library to latest version for support
of modify functions. Also refactored to interact with JoltTransform interface
and updated styling
----
> Add expression language support for JoltTransformJson processor
> ---------------------------------------------------------------
>
> Key: NIFI-3010
> URL: https://issues.apache.org/jira/browse/NIFI-3010
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Core Framework
> Affects Versions: 1.0.0
> Reporter: Yolanda M. Davis
> Assignee: Yolanda M. Davis
>
> Provide the ability to incorporate expression language within a Jolt
> Specification so that certain operations, such as dynamic creation of
> key/value pairs can be achieved.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)