Not sure why you state "the data is corrupted".
The 3701 is a parser error. You can open an incident with Teradata support to analyze the associated "crashdump". They will probably also need all the associated DDL (both the CREATE TABLE and the definitions of any tables/views referenced in the subqueries).
Need to open an incident with Teradata support. They can guide you through diagnosis and workaroud/resolution.
If you don't have access to Teradata support, find your Teradata DBA/Admin team member who should have that access.