Continuity equation and Bernoulli equation on inclined pipes I came across the following problem in Fluid Mechanics. We are asked to find the velocity in 3.

The pipe diameter from 2 to 3 is constant. I calculated the velocity in 2 using $\sqrt{2g\times50}$ and then from the continuity equation I deduced that the velocity in 3 had to be equal to the velocity in 2 (same diameter implies same cross sectional area, plus water is incompressible).
However the textbook solution is different. They arrive to the following form of the ideal Bernoulli equation:
$$p_1 + \rho g 350 = p_3 + \frac{1}{2}\rho v_3^2$$
They then assume $p_1 = p_3$ and find $v_3 = \sqrt{2g\times350}$, a very different value. By my previous reasoning, it seems to me that this would violate the continuity equation. I also do not understand the assumption that $p_1 = p_3$, since point 3 is inside the pipe. Is the text book right? If so, what is the flaw with my reasoning regarding the continuity equation?
 A: In this problem, the two points that are used in the application of the Bernoulli equation are points 1 and 3.  As @V.F. correctly points out, the pressures at points 1 and 3 are both atmospheric, so these pressures cancel.  The fluid velocity at point 1 is essentially zero, and the elevation z at point 1 is 350 m above the datum, situated at point 3.  
For point 3, the elevation z is 0, and the velocity is $v_3$.  This all leads to the equation presented in the OP.  And, of course, the continuity equation is not violated, since $v_2=v_3$.
Of course, the velocity at point 2 is not equal to $\sqrt{2g\times 50}$ because the pressure at point 2 is not equal to the pressure at point 
Before completing this solution, it is of interest to check the pressure at point 2 to ascertain whether the fluid is cavitating.  Applying Bernoulli to points 2 and 3, we have:
$$p_2+\rho g(300)+\frac{1}{2}\rho v_2^2=p_3+\frac{1}{2}\rho v_3^2$$Solving for $p_2$ yields $$p_2=-300\rho g$$This is well below the value of $-10\rho g$ which would be required to cause cavitation.  Since the fluid will be cavitating, the tube between points 2 and 3 will not be running full, and there will be a vacuum of nearly $10 \rho g$ in the empty section above the column of fluid in the tube (situated above point 3).  The pressure at point 2 will be $p_2=-10\rho g$.  Then, applying the Bernoulli equation to points 1 and 2, we would have:
$$0+50 \rho g+0=-10\rho g+0+\frac{1}{2}\rho v_2^2$$So, $$v_2=\sqrt{120 \rho g}$$We can now calculate the elevation of the fluid level in the partially filled column between points 2 and 3.  Applying the Bernoulli equation in conjunction to the continuity equation to the column gives:
$$p_2+\rho g h+\frac{1}{2}\rho v_2^2=p_3+\frac{1}{2}\rho v_3^2$$or$$-10\rho g+\rho g h=0$$Therefore, as one might expect, the height of the column will be 10 meters.  Because of the cavitation, the other 290 meters will essentially be vacuum (more precisely, at the absolute vapor pressure of water at the system temperature).
A: Since the pipe at the bottom is open, the pressure at the bottom, $p_3$, will be atmospheric. This explains the statement $p_1=p_3$.
The water in the pipe, lacking support at the bottom, will submit to gravity and accelerate. As a result, $v_3$ will be greater than $v_2$.
So, for the continuity equation $v_2A_2=v_3A_3$ to hold, $A_3$ will have to be smaller than $A_2$, i.e., the pipe at the bottom won't be filled. 
What's left in the Bernoulli equation reflects the transformation of the potential energy of the water at the top to its kinetic energy at the bottom. 

Adding to reflect the comments and discussions.
It is possible that the flow in the pipe will develop cavitation. In this case the textbook solution won't be applicable. This case is addressed in the answer from ChesteMiller.
