[SPARK-3198] [SQL] Generate the expression id when necessary

Yes, you're right, we need to think about the id usage, but currently it is the workaround for performance. I noticed that the aggregation performance is not so good because large number of `AggregateFunction` objects were created during the execution on slave, you know the `AggregationFunction` is a sub class of `TreeNode`, actually the id generation here is the bottleneck in multithreading env(because of the memory barrier in a multi-core system).

On the other hand, I don't think we have the logic to call the `eq` of an expression object during the execution time on slaves directly or indirectly. Those calls are supposed to be done in master(for example in logical plan analysis & optimization).

So I am OK to merge this PR for the quick fix or rewrite the code for getting ride of the id entirely.