Is the following function (similar to thomae function) defined on a rectangle integrable? 
Let $I=[0,1]$. Define $f:I\times I \to \mathbb{R}$, is defined as follows:
  $$f(x,y)=\begin{cases} 1 & \mbox{if either x or y is irrational}\\ 1-\frac1q & \mbox{if} \ x=\frac{p}q, \ \mbox{gcd}(p,q)=1 \ \mbox{and} \ y\in\mathbb{Q}\\ 1 & \mbox{if} \ x=0\end{cases}$$ 
  Is $f$ integrable over $I\times I$?

$$\int\limits_{I^2}f(x,y)\,dx\,dy=\int\limits_{0}^1\left(\int\limits_{0}^1 f(x,y)\, dy\right)\,dx$$
Note that for a fixed $x \in \mathbb{Q}$, $\int_0^1 f(x,y)\,dy$ does not exists. Is it sufficient to conclude $f$ is not integrable? Why/why not?
By integrable I mean Riemann integrable.
 A: $f$ is Riemann integrable. Given $\epsilon>0$ choose an integer $Q$ such that $Q\,\epsilon<1$. Around each $p/q$ with $\gcd(p,q)=1$ and $q<Q$ take an interval $I_{p,q}=[p/q-\delta/2,p/q+\delta/2]$ with $\delta>0$ such that they are disjoint. This determines a partition of $I$ in two types of subintervals: the $I_{p,q}$ and those in between, that I will call generically $J$. Consider the difference between the upper and lower sums associated to it. Consider the partition of $I^2$ formed by the subrectangles $I_{p,q}\times I$ and $J\times I$. On any subrectangle, the supremum of $f$ is equal to $1$. On subrectanglesof type $J\times I$ the infimum of $f$ is greater or equal to $1-1/Q$. The difference between the upper and lower sums associated to the partition is bounded by
$$
\sum_{I_{p,q}}\Bigl(1-\inf_{I_{p,q}}f\Bigr)\delta+\sum_{J}(1-(1-1/Q)\text{length}(J)\le\delta\sum_{I_{p,q}}1+\epsilon.
$$
The sum deppends only on $Q$, so that $\delta$ can be chosen to make the expression in the right less than $2\,\epsilon$.
The fact that the iterated integral does not exist does not imply that $f$ is not Riemann integrable. Fubini's theorem for the Riemann integral states that it $f$ is integrable on $I^2$ and
$$
U(x)=\bar{\int_0^1}f(x,y)\,dy
$$
then $U$ is integrable on $I$ and
$$
\int_0^1U=\int_{I^2}f.
$$
