User GuidesAPI ReferenceRelease Notes
Doc HomeHelp CenterLog In
User Guides

Using Logical Comparators

Use logical comparisons in Tamr transformation functions.

There are are many ways to compare data in Tamr. These comparators are most often used in JOIN and FILTER statements and case expressions.

SyntaxData TypesExampleExplanation
IS NULLAnystate IS NULLReturns true when “state” is a true null value.
IS NOT NULLAnystate IS NOT NULLReturns true when “state” is anything other than a true null value.
IS EMPTYAnystate IS EMPTYReturns true when “state” is a true null value, a blank string (a string with no content'' or a string containing only whitespace characters like spaces and tabs ' '), an empty array ([]), or an array containing only blank strings and true nulls ([' ', null])
IS NOT EMPTYAnystate IS NOT EMPTYReturns true when “state” is anything other than a true null value, a blank string a string with no content'' or a string containing only whitespace characters like spaces and tabs ' '), an empty array ([]), or an array containing only blank strings and true nulls ([' ', null])
==Anystate == 'MA'Returns true when “state” is equal to 'MA'
=Anystate = 'MA'Returns true when “state” is equal to 'MA'
!=Anystate != 'MA'Returns true when “state” is not equal to 'MA'
>Any Numericcost > 10.0Returns true when “cost” is greater than 10.0
>=Any Numericcost >= 10.0Returns true when “cost” is greater than or equal to 10.0
<Any Numericcost < 10.0Returns true when “cost” is less than 10.0
<=Any Numericcost <= 10.0Returns true when “cost” is less than or equal to 10.0

Logical comparisons can be modified using NOT to reverse its logic. Logical conditions can also be combined with AND and OR.

Examples:
Keep (filter down to) rows that have a populated "company_name" or have a populated parent_company_name:

FILTER company_name IS NOT EMPTY OR parent_company_name IS NOT EMPTY;

Lookup the exchange rate of a currency for a given year by matching on exact values in the year and currency columns

LOOKUP exchange_rate
FROM "currency_exchange.csv" AS currency_lookup
ON year == currency_lookup.year AND currency == currency_lookup.currency;

Create a new attribute "price_in_words", set it to 'expensive' when the price is greater than 100. Otherwise, set it to 'cheap':

SELECT *,
CASE 
WHEN price > 100 THEN 'expensive' 
ELSE 'cheap' 
END AS price_category;