public static List < Expression > dropFields ( List < String > inputFields , List < Expression > dropExpressions ) { Set < String > columnsToDrop = dropExpressions . stream ( ) . map ( expr -> expr . accept ( dropColumnsExtractor ) ) . collect ( Collectors . toSet ( ) ) ; columnsToDrop . forEach ( c -> { if ( ! inputFields . contains ( c ) ) { throw new ValidationException ( format ( "Field %s does not exist in source table" , c ) ) ; } } ) ; return inputFields . stream ( ) . filter ( oldName -> ! columnsToDrop . contains ( oldName ) ) . map ( UnresolvedReferenceExpression :: new ) . collect ( Collectors . toList ( ) ) ; }
Creates a projection list that removes given columns .