on master help sign in
shift tuple hashing of unverified tuples to mitigate vector exception (when tuple and attribute counts are not equal)
6dd3abdAgentM
ProjectM36/TupleSet.hs+2−4
@@ -24,12 +24,10 @@ verifyTupleSet attrs tupleSet = do
24 if length (lefts tupleList) > 0 then
24 if length (lefts tupleList) > 0 then
25 Left $ head (lefts tupleList)
25 Left $ head (lefts tupleList)
26 else
26 else
27− return $ RelationTupleSet (rights tupleList)
27+ return $ RelationTupleSet $ (HS.toList . HS.fromList) (rights tupleList)
28
28
29mkTupleSet :: Attributes -> [RelationTuple] -> Either RelationalError RelationTupleSet
29mkTupleSet :: Attributes -> [RelationTuple] -> Either RelationalError RelationTupleSet
30−mkTupleSet attrs tuples = verifyTupleSet attrs tupSet
30+mkTupleSet attrs tuples = verifyTupleSet attrs (RelationTupleSet tuples)
31− where
32− tupSet = RelationTupleSet $ (HS.toList . HS.fromList) tuples
33
31
34mkTupleSetFromList :: Attributes -> [[Atom]] -> Either RelationalError RelationTupleSet
32mkTupleSetFromList :: Attributes -> [[Atom]] -> Either RelationalError RelationTupleSet
35mkTupleSetFromList attrs atomMatrix = mkTupleSet attrs $ map (\atomList -> mkRelationTuple attrs (V.fromList atomList)) atomMatrix
33mkTupleSetFromList attrs atomMatrix = mkTupleSet attrs $ map (\atomList -> mkRelationTuple attrs (V.fromList atomList)) atomMatrix