Boolean aggregation?

Nine Stars

Boolean aggregation?

Hi,
Is there any way to use tAggregateRow or a similar component to manipulate boolean data?
For example, I've got a job that produces a row with three columns: filename (String), test_id (String), test_result (Boolean).
I would like to know for each filename, if there any true test_result to reject the file.
At first, I wanted to use this:
tFilterColumns (keeping filename and test_result columns) -- row --> tAggregateRow (max or sum or whatever on the test_result column using filename as key)
But it seems that tAggregateRow doesn't manipulate Boolean despite this note I found (https://jira.talendforge.org/browse/TDI-643).
Any other component for that or do I have to convert Boolean type to Integer?
Regards.
Alexis
Moderator

Re: Boolean aggregation?

Hi,
Have you tried to use tMap component with expression? What's your input source?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Nine Stars

Re: Boolean aggregation?

Hello,
I'm not sure to understand what you mean by "use tMap component with expression"? I already have tMap in the full job, but I don't see how they could help me here?
Here is an example of data:
input :
 filename | test_id | test_result
----------+---------+-------------
a.csv | TEST1 | false
a.csv | TEST2 | false
a.csv | TEST3 | false
b.csv | TEST1 | false
b.csv | TEST2 | true
b.csv | TEST3 | false
c.csv | TEST1 | true
c.csv | TEST2 | true

output (test_result is an "OR" between all test_result values for a specific file) :
 filename | test_result
----------+-------------
a.csv | false
b.csv | true
c.csv | true

If I replace the Boolean values with Integer (true = 1 / false = 0), I can use a tAggregateRow with a max(test_result) and filename as key.
Regards.
Alexis

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog