[SPARK-2917] [SQL] Avoid table creation in logical plan analyzing for CTAS

Seems it only check if we have resolved the logical plan. If not, we throw an exception. If you mark a `InsertIntoCreatedTable` as not resolved because of `databaseName` is None. Where do you resolve the `databaseName `?