[SPARK-3688][SQL]LogicalPlan can't resolve column correctlly

we should add some judgements base on the datatype to handle some particular sql described in https://issues.apache.org/jira/browse/SPARK-3688
It might be a little clearer to do do something like:

```scala
val optionalNestedReferences = remainingParts.tail
(option.dataType, optionalNestedReferences) match {
....
```

Which I think is equivalent to what you did, but calls out exactly what we are matching on explicitly.