You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "yakshup (via GitHub)" <gi...@apache.org> on 2025/02/01 18:52:28 UTC
[PR] NIFI-14219 JoltTransform Enhancement for EL in path [nifi]
yakshup opened a new pull request, #9682:
URL: https://github.com/apache/nifi/pull/9682
<!-- 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. -->
# Summary
[NIFI-00000](https://issues.apache.org/jira/browse/NIFI-00000)
# Tracking
Please complete the following tracking steps prior to pull request creation.
### Issue Tracking
- [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
### Pull Request Tracking
- [x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
- [x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
### Pull Request Formatting
- [x] Pull Request based on current revision of the `main` branch
- [x] Pull Request refers to a feature branch with one commit containing changes
# Verification
Please indicate the verification steps performed prior to pull request creation.
### Build
- [ ] Build completed using `mvn clean install -P contrib-check`
- [x] JDK 21
### Licensing
- [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
- [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
### Documentation
- [x] Documentation formatting appears as expected in rendered files
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14219 JoltTransform Enhancement for EL in path [nifi]
Posted by "yakshup (via GitHub)" <gi...@apache.org>.
yakshup commented on PR #9682:
URL: https://github.com/apache/nifi/pull/9682#issuecomment-2629260676
I see the change which you have done @exceptionfactory. This was my first approach, but I had my apprehensions around keeping things in single field and design in other components of nifi. I will test your PR in my setup and get back to you.
Also, I see a lot of test cases modified and assert statements removed. Are you sure those are required to be removed.?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14219 JoltTransform Enhancement for EL in path [nifi]
Posted by "yakshup (via GitHub)" <gi...@apache.org>.
yakshup commented on PR #9682:
URL: https://github.com/apache/nifi/pull/9682#issuecomment-2629217087
@exceptionfactory Thank you for the review and feedback.
### Clarification on the Motivation for the New Property
The primary reason for introducing a separate property for the filename is to resolve an existing issue with how `JOLT_SPEC ` handles Expression Language (EL).
Currently, the `JOLT_SPEC` property serves two distinct purposes:
- Accepting inline JOLT specifications as JSON.
- Accepting a file path (which may also contain EL).
The problem arises when the property value contains Expression Language referring to a file path.
The current logic evaluates EL first and always assumes the result is a JSON specification, even if the value was intended to be a file path. This creates an edge case where valid file paths containing EL become invalid, as they are incorrectly parsed as JSON.
By introducing a dedicated property for the filename, we can:
- Clearly distinguish between inline JSON specs and file-based specs.
- Ensure correct handling of EL, whether used for JSON content or file paths.
- Improve maintainability by eliminating ambiguity in `JOLT_SPEC`.
**Use of the Resource Abstraction**
The existing implementation already utilizes the `readTransform` method from the Jolt abstraction layer, which ensures proper handling of file paths and JSON parsing. Additionally, necessary validations are already in place to verify that the file path is valid before processing.
Could you clarify if the concern is specifically about file access within `readTransform`, or if it is a general recommendation to adopt NiFi's Resource abstraction for consistency? If required, I can explore integrating `ResourceReference` to enhance how NiFi handles file-based properties.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14219 JoltTransform Enhancement for EL in path [nifi]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #9682:
URL: https://github.com/apache/nifi/pull/9682#issuecomment-2629247822
Thanks for the quick reply @yakshup.
On closer evaluation, the current behavior of `JoltTransformJSON` has an unnecessary conditional around the Expression Language evaluation. Instead of introducing a new property, removing the conditional and always evaluating EL before attempting to read the `Jolt Specification` as a Resource enables support for file paths with Expression Language.
Given the significant difference in the approach, I put together a new pull request #9684 implementing the changes. The PR includes a new unit test method that exercises the use case. If you could take a look at that approach to determine whether it enables the use case you described, that would be helpful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14219 JoltTransform Enhancement for EL in path [nifi]
Posted by "yakshup (via GitHub)" <gi...@apache.org>.
yakshup closed pull request #9682: NIFI-14219 JoltTransform Enhancement for EL in path
URL: https://github.com/apache/nifi/pull/9682
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] NIFI-14219 JoltTransform Enhancement for EL in path [nifi]
Posted by "yakshup (via GitHub)" <gi...@apache.org>.
yakshup commented on PR #9682:
URL: https://github.com/apache/nifi/pull/9682#issuecomment-2629069514
I have added a separate field for Jolt Spec File, as this is the standard practice from all the other modules.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org