Upvote:3
In theory you can enter Poland up to and including the last day of validity of your type D visa. You may be asked to show a credible plan to leave before it expires, unless you can show that you are planning to apply for a residence permit in Poland to replace the visa. If you already have a Polish residence permit then you can enter on the basis of the residence permit without regard to the expiration of the visa.