How far does the table move before reversing? An encoder failure would most likely either run full speed in one direction, or just "dither" back and forth a very short distance (just a few encoder counts). If it's moving any significant distance, the problem is much more likely to be either a failed drive, or a problem with the DIR signal. I would first swap out the drive, and see if that fixes it.
Regards,
Ray L.