July 25, 2014

Checking the subset sum set problem with set processing

Hi,

Here is an easy way to run the subset sum check from SQL, which you can then distribute with Shard-Query:

Notice there is no 16 in the list. We did not pass the check. There are enough 15s though. The distinct value count for each item in the output set, must at least match the cardinality of each item in the input set).

Notice that I have a lot of numbers in my list:

Now insert a value which will cause our check to pass:

Of course, I can use a materialized view and check the expression in subsecond.

About Justin Swanhart

Speak Your Mind

*