Support Questions
Find answers, ask questions, and share your expertise

​Sum of Table Column in NiFi

Expert Contributor

I need to create checksums in my ETL process. Therefore I need to sum up a numeric column in my JDBC-connected table(s). Copying the data works fine so far, but I was not able to find the correct NiFi processor for this aggregation task.

How can I calculate the sum of a table column? Which processor to use (is there something similar for the SelectHiveQL processor, which works fine for the same aggregation task)? And how to compare these two results (from two different tables) to check if the sums are equal?

I already tried to use a ExecuteSQL processor but there I get an SchemaParseException:

49384-unbenannt.png

I'm using NiFi 1.4.0 and Hive 1.2.1.

1 ACCEPTED SOLUTION

Super Guru
@Daniel Müller

Can you create alias name for the aggregate column sum(menge) as menge then the processor will work.

Change the SQL Query as

Select sum(menge)menge from <table>

View solution in original post

2 REPLIES 2

Super Guru
@Daniel Müller

Can you create alias name for the aggregate column sum(menge) as menge then the processor will work.

Change the SQL Query as

Select sum(menge)menge from <table>

Expert Contributor

Yes, that was the solution! Thank you very much!

Everything works fine with the following statement now:

SELECT SUM(menge) menge FROM mytable
Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.