The column datatypes are correctly analyzed for simple select query. Note that the problematic column is not selected anywhere in the complicated scenario.
Let's say Select * from a;
Now let's say there is a query involving temporary view on another table and its join with this table.
Let's call that table b (temporary view on a dataframe);
select * from jq ( select a.col1, b.col2 from a,b where a.col3=b=col3)
Fails with exception on some column not part of the projection in the join query
Exception in thread "main" org.apache.spark.sql.AnalysisException: Cannot up cast `a`.col5 from from decimal(8,0) to col5#1234: decimal(6,2) as it may truncate.