Patent attributes
A computer-implemented method for executing a query specification can include evaluating the query specification by a first computing device to identify a candidate expression in the query specification to be executed by a second computing device hosting a source of data specified in the candidate expression. A cost estimate for executing the candidate expression at the first computing device is determined. Whether the cost estimate of executing the candidate expression at the first computing device is greater than a threshold is determined. The candidate expression is replaced with a native query function when the cost estimate of executing the candidate expression at the first computing device is greater than the threshold. The native query function can be executed at the second computing device. It can be determined whether a runtime context is necessary, and if necessary, a context parameter is injected into the native query function.