Changes

Summary

  1. [SPARK-37533][SQL] New SQL function: try_element_at (details)
Commit f705e522bc26085feebe1e5efc92313858df58d1 by gengliang
[SPARK-37533][SQL] New SQL function: try_element_at

### What changes were proposed in this pull request?

Add New SQL functions `try_element_at`, which is identical to the `element_at` except that it returns null if error occurs

### Why are the changes needed?

After some data science on real world SQL queries, we found that some users are using the following queries
```
select ... where mapCol.key is not null
select ... where arrayCol[index] is not null
```

### Does this PR introduce _any_ user-facing change?

Yes, an alternative function `try_element_at` which will return null on array index out of bound or map key doesn't exist under ANSI mode.

### How was this patch tested?

Unit tests

Closes #34796 from gengliangwang/try_element_at.

Authored-by: Gengliang Wang <gengliang@apache.org>
Signed-off-by: Gengliang Wang <gengliang@apache.org>
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala (diff)
The file was addedsql/core/src/test/resources/sql-tests/results/ansi/try_element_at.sql.out
The file was modifiedsql/core/src/test/resources/sql-tests/results/ansi/array.sql.out (diff)
The file was modifiedcore/src/main/resources/error/error-classes.json (diff)
The file was modifiedsql/core/src/test/resources/sql-functions/sql-expression-schema.md (diff)
The file was addedsql/core/src/test/resources/sql-tests/inputs/ansi/try_element_at.sql
The file was modifiedsql/core/src/test/resources/sql-tests/results/ansi/map.sql.out (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/TryEval.scala (diff)
The file was modifiedsql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/TryEvalSuite.scala (diff)
The file was modifiedcore/src/test/scala/org/apache/spark/SparkThrowableSuite.scala (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala (diff)
The file was addedsql/core/src/test/resources/sql-tests/results/try_element_at.sql.out
The file was addedsql/core/src/test/resources/sql-tests/inputs/try_element_at.sql
The file was modifieddocs/sql-ref-ansi-compliance.md (diff)
The file was modifiedsql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryExecutionErrors.scala (diff)