Update HiveQL to resolve data quality issues

Update HiveQL to resolve data quality issues