KNOWLEDGE BASE

Error "WHERE clause should return  type bool, but returns <...>" After Upgrading to Tableau 10.3 Queries and Attempting to Connect to Google BigQuery


Published: 09 Jul 2017
Last Modified Date: 10 Jul 2017

Issue

After upgrading to Tableau Desktop and/or Tableau Server 10.3, connecting your workbooks to Google BigQuery is the :
query: AND requires all arguments to be of type bool. The 1st operand was of type int32 (error code: invalidQuery) 
WHERE clause should return  type bool, but returns INT64 [1:139]

 
Additionally, the issue occurs if a calculated field returns boolean calculation type such as TRUE / FALSE. An example would be: 
[Param_State] = 'ALL' OR [Param_State]=[State]

Tableau Desktop 10.2 and earlier versions would create a SQL statement similar to:
SELECT ..... FROM <some table> WHERE 1(1<>0) Group By 2

Whereas Tableau Desktop 10.3, the below WHERE clause is incorrect and as a result, the execution of the SQL statement fails. An example of a wrong SQL statement would be:
SELECT ..... FROM <some table> WHERE 1 Group By 2

Environment

  • Tableau Desktop 10.3.0
  • Tableau Server 10.3.0
  • Google BigQuery

Resolution

Update the calculated field so that the format becomes something similar to: IF ... THEN ... ELSE ... END.

For example: 
  • Current calculation: [Param_State] = 'ALL'  OR [Param_State] = [State]
  • Fixed calculation: IF [Param_State] = 'ALL'  OR [Param_State] = [State] THEN 1 ELSE 0 END 

Cause

Our team is currently investigating this issue. 
Did this article resolve the issue?