LucidDB / luciddb

DEFUNCT: See README
https://github.com/LucidDB/luciddb
Apache License 2.0
53 stars 24 forks source link

[FRG-260] Measure columns for GROUP BY with non-empty key should retain nullability of input columns #612

Open dynamobi-build opened 12 years ago

dynamobi-build commented 12 years ago

[reporter="jvs", created="Fri, 23 Mar 2007 22:57:58 -0500 (GMT-05:00)"] COUNT is always NOT NULL since it produces a count of zero even if all inputs were null. This is already correctly implemented.

However, currently we force SUM/MAX/MIN/AVG measure column outputs to nullable even when the input type is NOT NULL. The reason is that we don't discriminate between the case where the measure is being computed in a GROUP BY vs. a measure in a full-table aggregation (no GROUP BY or GROUP BY with empty column set). In the full-table case, it's necessary to force to nullable, since if there are no rows to be grouped, the result comes out as NULL.

This can't be fixed in just the validator alone, because some executor code is dependent on it since it has to produce matching physical tuple descriptors.

See fennel/exec/SortedAggExecStream.cpp, method prepare, and fennel/lucidera/hashexe/LhxAggExecStream.cpp, method setHashInfo.

dynamobi-build commented 12 years ago

[author="jvs", created="Fri, 23 Mar 2007 23:03:59 -0500 (GMT-05:00)"] Jack, if for whatever reason you need to make the validator changes without making the corresponding executor changes, we'll need to figure out how to integrate your change to //open/dev disabled, and then make the executor changes and re-enable it. But if you want to make the validator and executor changes together, Rushan and I can help with suggestions on the Fennel part.