'Question with sql execution in Azure Databricks

I'm new in this of Spark and Azure Databricks, I hope you can understand my question.

We have a query that is created in another company department, and we just need to execute it and store the data. It is a very simple query that should return something like this:

enter image description here

%sql    
Select 
From Table_1 as A inner join Table_2 as B
on A.PK = B.FK
Where A.columnA = 'h' or B.columnaB = 'g'

However, we are facing a behaviour that we can not understand. With the current where sentences, the query is not showing any result. If we execute any of the two conditions apart (Where A.columnA = 'h' or B.columnaB = 'g') we will get some rows. But the only way in which we can see any output from the original where is comparing one of the column (or both) against a capital letter:

Where A.columnA = 'H' or B.columnaB = 'G'
Where A.columnA = 'h' or B.columnaB = 'G'
Where A.columnA = 'H' or B.columnaB = 'g'

Just to add more doubts, during the test we saw that by changing the or operator for an and condition the query provides a result.

What could be a reason for this or how can we check what is happening?

This is just to simplify the question, we can not modify the query. We need to inform what the issue is and the other team will fix it.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source