Two different things. Pleasure and sorrow. Cosmos and inner world of one's mind. I am always amazed that Bach has expressed two opposite things at the same time in a music. Even a melody expresses ambivalence. This ambivalence won't irritate our mind at all but rather soothe us. It is words of comfort by music to those struggling in the actual world.
Allemande in Partita Nr 2. The tonality is d minor. It would have been governed by a sad mood. But we listen a sense of pleasure as well as sorrow at the same time. I used to listen to this music quite often in my school days. Hilary Hahn performs it with perfect technique. In her blog, she wrote she always started practising violin with one of the unaccompanied sonata/partita like this. It seems this music has become a part of her life.