TITLE: morphisms of affine schemes question
QUESTION [5 upvotes]: So, in chapter 2, section 2 of Hartshorne, (prop 2.3), he describes how if $\varphi : A\rightarrow B$ is a homomorphism of rings, then you get a morphism of (affine schemes):
$\newcommand{\Spec}{\textrm{Spec }}$
$\newcommand{\oO}{\mathcal{O}}$
$\newcommand{\mf}[1]{\mathfrak{#1}}$
$(f,f^\sharp) : (\Spec B, \oO_{\Spec B})\rightarrow (\Spec A, \oO_{\Spec A})$
where $f:\Spec B\rightarrow\Spec A$ is given by $f(\mf{p}) = \varphi^{-1}(\mf{p})$. Here, for each $\mf{p}\in\Spec B$, $\varphi$ also gives us a map of localizations $\varphi_\mf{p} : A_{\varphi^{-1}(\mf{p})}\rightarrow B_\mf{p}$.
Also, $f^\sharp : \oO_{\Spec A}\rightarrow f_*\oO_{\Spec B}$ is given by sending $\sigma\in\oO_{\Spec A}(V)$ (for each open $V$), to the function $[\mf{p}\mapsto \varphi_\mf{p}(\sigma(f(\mf{p})))] \in \oO_{\Spec B}(f^{-1}(V)) = f_*\oO_{\Spec B}(V)$
So, my question is... What are the stalks of the direct image sheaf $f_*\oO_{\Spec B}$?
This is clearly a sheaf on $\Spec A$, so there should be a stalk for each $\mf{p}\in\Spec A$. There are two cases.
Firstly, suppose $\mf{p}\in\Spec A$ is in the image of $f$, then by definition, the stalk of $(f_*\oO_{\Spec B})_{\mf{p}}$ is the direct limit:
$\lim_{U\supset f^{-1}(\mf{p})}\oO_{\Spec B}(U)$
But this is not quite a stalk of $\oO_{\Spec B}$ (since $f$ may not be injective). However, Hartshorne seems to suggest that this is actually just $(\oO_{\Spec B})_{\mf{q}}$ which is just the localization of $B$ at $\mf{q}$, where $\mf{q}$ is any point of $f^{-1}(\mf{p})$. I don't really see why this must be true. (Especially since he seems to suggest that all the localizations at $\mf{q}$ are the same, for any $\mf{q}\in f^{-1}(\mf{p})$.
Secondly, suppose $\mf{p}\in\Spec A$ is not in the image of $f$. Then what? I can imagine that if there is some neighborhood $V$ of $\mf{p}$ such that $f^{-1}(V)$ is empty, then the stalk would be zero. But suppose there is no such $V$? Then What? (Alternatively, must there always exist such a $V$ in this case?)
Thanks guys

will

REPLY [3 votes]: You consider $B$ as an $A$-module. Then $f_*O_X$ ($X = Spec B$) is the quasi-coherent $O_Y$-module ($Y = Spec A$) corresponding to the $A$-module $B$. Thus for a prime ideal $y \in Y$, $(f_*O_X)_y$ is the localization of the $A$-module $B$ in $y$.