Grackle seems to call BigDecimal.equals a lot. In my case, these take 50% of the thread's time which processes the query (490 of 1091 samples) (see highlighted region):

One of, if not the main culprit, seems to be assert(leafFocus != FailedJoin) in SqlMapping.
Replacing the equals with eq and thus referential equality (which should be safe here since FailedJoin is a singleton) there and in a few other related areas gets rid of the costly BigDecimals.equals completely, avoiding the expensive stack trace creation.
Grackle seems to call

BigDecimal.equalsa lot. In my case, these take 50% of the thread's time which processes the query (490 of 1091 samples) (see highlighted region):One of, if not the main culprit, seems to be
assert(leafFocus != FailedJoin)in SqlMapping.Replacing the equals with eq and thus referential equality (which should be safe here since FailedJoin is a singleton) there and in a few other related areas gets rid of the costly BigDecimals.equals completely, avoiding the expensive stack trace creation.