From 51c26dd9fcab87f7da562c3419fa4e600b37e8c9 Mon Sep 17 00:00:00 2001 From: Brandon Rozek Date: Fri, 12 Dec 2025 14:49:32 -0500 Subject: [PATCH] Optimization in computing meets and joins --- model.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/model.py b/model.py index 615e6ee..6272d48 100644 --- a/model.py +++ b/model.py @@ -129,6 +129,12 @@ class OrderTable: candidates = X.intersection(Y) + if not candidates: + return None + + if len(candidates) == 1: + return next(iter(candidates)) + # Grab all elements greater than each of the candidates candidate_ge_maps = (self.ge_map[candidate] for candidate in candidates) common_ge_values = reduce(set.intersection, candidate_ge_maps) @@ -147,6 +153,12 @@ class OrderTable: candidates = X.intersection(Y) + if not candidates: + return None + + if len(candidates) == 1: + return next(iter(candidates)) + # Grab all elements smaller than each of the candidates candidate_le_maps = (self.le_map[candidate] for candidate in candidates) common_le_values = reduce(set.intersection, candidate_le_maps)