What is the difference between the `try_sum` and `sum` functions in Databricks SQL, and when should I use one over the other?
The `try_sum` and `sum` functions in Databricks SQL are both used to calculate the sum of values in a group, but they differ in how they handle overflow situations.

The `sum` function returns an error if the result overflows the result type, while the `try_sum` function returns NULL in case of an overflow. This makes `try_sum` a safer option when dealing with large values or intervals that may potentially overflow, as it prevents the query from failing and allows it to return a result.

In terms of syntax and usage, both functions can be used with the `ALL`, `DISTINCT`, and `FILTER` clauses, and can also be invoked as window functions using the `OVER` clause.

In summary, you should use `try_sum` over `sum` when dealing with large values or intervals that may potentially overflow, as it provides a more graceful handling of overflow situations. However, if you prefer to be notified of overflow situations through an error, you should use the `sum` function instead.