You’re right, Dogukan. It looks like the “SQL Query” property is documented as 
supporting Expression Language, but the EL is never evaluated. I filed a JIRA 
[1] for the issue.

Thanks
-Mark


[1] https://issues.apache.org/jira/browse/NIFI-12314


On Nov 3, 2023, at 5:09 AM, Doğukan Levendoğlu | Obase 
<[email protected]<mailto:[email protected]>> wrote:

Apologies fort he horrible image quality:
<image003.png>

From: Doğukan Levendoğlu | Obase
Sent: 03 November 2023 12:06
To: '[email protected]<mailto:[email protected]>' 
<[email protected]<mailto:[email protected]>>
Subject: Expression Language does not work within QueryNifiReportingTask

Hello,

I’m trying to add additional fields to the query results obtained by 
QueryNifiReportingTask like below:
<image002.png>

SQL Query property in QueryNifiReportingTask indicates that it supports the 
expression language. My understanding is that the query needs to be evaluated 
before execution. However I am getting this error ( which tells me that’s not 
what’s happening):

QueryNiFiReportingTask[id=8fbb9a3a-018b-1000-ffff-ffffbb48d6d7] Error 
processing the query due to java.sql.SQLException: Error while preparing 
statement [SELECT
                               *,
                               'myCluster' as clusterName,
                               ${hostname(true)} as 'hostname'
FROM PROCESSOR_STATUS]: 
org.apache.nifi.reporting.sql.MetricsSqlQueryService$PreparedStatementException:
 java.sql.SQLException: Error while preparing statement [SELECT
                               *,
                               'myCluster' as clusterName,
                               ${hostname(true)} as 'hostname'
FROM PROCESSOR_STATUS]
- Caused by: java.sql.SQLException: Error while preparing statement [SELECT
                               *,
                               'myCluster' as clusterName,
                               ${hostname(true)} as 'hostname'
FROM PROCESSOR_STATUS]
- Caused by: java.lang.RuntimeException: parse failed: Encountered "$" at line 
4, column 2.
Was expecting one of:
    "ABS" ...
    "ARRAY" ...
    "AVG" ...
    "CARDINALITY" ...
    "CASE" ...
    "CAST" ...
    "CEIL" ...
    "CEILING" ...
    "CHAR" ...
.
.
.

We want to be able to monitor some processors on a per node basis. Is there a 
cleaner way to do this? I am on version 1.23.2.

Thank you,
Dogukan

Reply via email to