From d3a3387064974efab840596587464941b57cbaf6 Mon Sep 17 00:00:00 2001 From: mu <59917266+4eUeP@users.noreply.github.com> Date: Wed, 13 Sep 2023 10:47:44 +0800 Subject: [PATCH] fix sql tests --- hstream-diffflow/test/DiffFlow/LoopSpec.hs | 133 ++++++++++++++------- hstream-sql/etc/syntax-test-cases.yaml | 6 +- 2 files changed, 96 insertions(+), 43 deletions(-) diff --git a/hstream-diffflow/test/DiffFlow/LoopSpec.hs b/hstream-diffflow/test/DiffFlow/LoopSpec.hs index acf6e5cd2..3561beda2 100644 --- a/hstream-diffflow/test/DiffFlow/LoopSpec.hs +++ b/hstream-diffflow/test/DiffFlow/LoopSpec.hs @@ -157,6 +157,19 @@ checkStep2 isDone reach_m reachSummary_m = describe "check reach summary out" $ #if MIN_VERSION_aeson(2,0,0) -------------------------------------------------------------------------------- +#if MIN_VERSION_hashable(1,4,0) +dcbs1 :: [[DataChange Object Word32]] +dcbs1 = dcbs1' + +dcbs2 :: [[DataChange Object Word32]] +dcbs2 = dcbs2' + +dcbs3 :: [[DataChange Object Word32]] +dcbs3 = dcbs3' + +dcbs4 :: [[DataChange Object Word32]] +dcbs4 = dcbs4' +#else dcbs1 :: [[DataChange Object Word32]] dcbs1 = [ [DataChange (A.fromList [("v1", "c"), ("v2", "a")]) (Timestamp 0 []) 1] , [DataChange (A.fromList [("v1", "a"), ("v2", "b")]) (Timestamp 0 []) 1] @@ -221,6 +234,7 @@ dcbs4 = [ [DataChange (A.fromList [("v1", "b"), ("reduced", "cd")]) (Timestamp 1 , [DataChange (A.fromList [("v1", "b"), ("reduced", "cda" )]) (Timestamp 1 [3]) 1 , DataChange (A.fromList [("v1", "b"), ("reduced", "cdab")]) (Timestamp 1 [3]) (-1)] ] +#endif -------------------------------------------------------------------------------- #else @@ -244,53 +258,92 @@ dcbs1 = [ [DataChange (A.fromList [("v1", "b"), ("v2", "c")]) (Timestamp 0 []) 1 ] dcbs2 :: [[DataChange Object Word32]] -dcbs2 = [ [DataChange (A.fromList [("v1", "b"), ("reduced", "cd")]) (Timestamp 0 [1]) 1] - , [DataChange (A.fromList [("v1", "a"), ("reduced", "b" )]) (Timestamp 0 [1]) 1] - , [DataChange (A.fromList [("v1", "c"), ("reduced", "a" )]) (Timestamp 0 [1]) 1] - - , [DataChange (A.fromList [("v1", "b"), ("reduced", "cd" )]) (Timestamp 0 [2]) (-1) - , DataChange (A.fromList [("v1", "b"), ("reduced", "cda")]) (Timestamp 0 [2]) 1] - , [DataChange (A.fromList [("v1", "a"), ("reduced", "b" )]) (Timestamp 0 [2]) (-1) - , DataChange (A.fromList [("v1", "a"), ("reduced", "bcd")]) (Timestamp 0 [2]) 1] - , [DataChange (A.fromList [("v1", "c"), ("reduced", "a" )]) (Timestamp 0 [2]) (-1) - , DataChange (A.fromList [("v1", "c"), ("reduced", "ab" )]) (Timestamp 0 [2]) 1] - - , [DataChange (A.fromList [("v1", "b"), ("reduced", "cda" )]) (Timestamp 0 [3]) (-1) - , DataChange (A.fromList [("v1", "b"), ("reduced", "cdab")]) (Timestamp 0 [3]) 1] - , [DataChange (A.fromList [("v1", "a"), ("reduced", "bcd" )]) (Timestamp 0 [3]) (-1) - , DataChange (A.fromList [("v1", "a"), ("reduced", "bcda")]) (Timestamp 0 [3]) 1] - , [DataChange (A.fromList [("v1", "c"), ("reduced", "ab" )]) (Timestamp 0 [3]) (-1) - , DataChange (A.fromList [("v1", "c"), ("reduced", "abcd")]) (Timestamp 0 [3]) 1] - ] +dcbs2 = dcbs2' dcbs3 :: [[DataChange Object Word32]] -dcbs3 = [ [DataChange (A.fromList [("v1", "b"), ("v2", "c")]) (Timestamp 1 []) (-1)] +dcbs3 = + [ [DataChange (A.fromList [("v1", "b"), ("v2", "c")]) (Timestamp 1 []) (-1)] - , [DataChange (A.fromList [("v1", "a"), ("v2", "c")]) (Timestamp 1 []) (-1)] - , [DataChange (A.fromList [("v1", "b"), ("v2", "a")]) (Timestamp 1 []) (-1)] + , [DataChange (A.fromList [("v1", "a"), ("v2", "c")]) (Timestamp 1 []) (-1)] + , [DataChange (A.fromList [("v1", "b"), ("v2", "a")]) (Timestamp 1 []) (-1)] - , [DataChange (A.fromList [("v1", "b"), ("v2", "b")]) (Timestamp 1 []) (-1)] - , [DataChange (A.fromList [("v1", "c"), ("v2", "c")]) (Timestamp 1 []) (-1)] - , [DataChange (A.fromList [("v1", "a"), ("v2", "a")]) (Timestamp 1 []) (-1)] - ] + , [DataChange (A.fromList [("v1", "b"), ("v2", "b")]) (Timestamp 1 []) (-1)] + , [DataChange (A.fromList [("v1", "c"), ("v2", "c")]) (Timestamp 1 []) (-1)] + , [DataChange (A.fromList [("v1", "a"), ("v2", "a")]) (Timestamp 1 []) (-1)] + ] dcbs4 :: [[DataChange Object Word32]] -dcbs4 = [ [DataChange (A.fromList [("v1", "b"), ("reduced", "cd")]) (Timestamp 1 [1]) (-1) - , DataChange (A.fromList [("v1", "b"), ("reduced", "d" )]) (Timestamp 1 [1]) 1] - - , [DataChange (A.fromList [("v1", "b"), ("reduced", "cd" )]) (Timestamp 1 [2]) 1 - , DataChange (A.fromList [("v1", "b"), ("reduced", "cda")]) (Timestamp 1 [2]) (-1)] - , [DataChange (A.fromList [("v1", "a"), ("reduced", "bcd")]) (Timestamp 1 [2]) (-1) - , DataChange (A.fromList [("v1", "a"), ("reduced", "bd" )]) (Timestamp 1 [2]) 1] - - , [DataChange (A.fromList [("v1", "b"), ("reduced", "cda" )]) (Timestamp 1 [3]) 1 - , DataChange (A.fromList [("v1", "b"), ("reduced", "cdab")]) (Timestamp 1 [3]) (-1)] - , [DataChange (A.fromList [("v1", "a"), ("reduced", "bcd" )]) (Timestamp 1 [3]) 1 - , DataChange (A.fromList [("v1", "a"), ("reduced", "bcda")]) (Timestamp 1 [3]) (-1)] - , [DataChange (A.fromList [("v1", "c"), ("reduced", "abcd")]) (Timestamp 1 [3]) (-1) - , DataChange (A.fromList [("v1", "c"), ("reduced", "abd" )]) (Timestamp 1 [3]) 1] - ] +dcbs4 = dcbs4' -------------------------------------------------------------------------------- #endif -------------------------------------------------------------------------------- + +dcbs1' :: [[DataChange Object Word32]] +dcbs1' = + [ [DataChange (A.fromList [("v1", "a"), ("v2", "b")]) (Timestamp 0 []) 1] + , [DataChange (A.fromList [("v1", "b"), ("v2", "d")]) (Timestamp 0 []) 1] + , [DataChange (A.fromList [("v1", "b"), ("v2", "c")]) (Timestamp 0 []) 1] + , [DataChange (A.fromList [("v1", "c"), ("v2", "a")]) (Timestamp 0 []) 1] + + , [DataChange (A.fromList [("v1", "a"), ("v2", "d")]) (Timestamp 0 []) 1] + , [DataChange (A.fromList [("v1", "b"), ("v2", "a")]) (Timestamp 0 []) 1] + , [DataChange (A.fromList [("v1", "c"), ("v2", "b")]) (Timestamp 0 []) 1] + , [DataChange (A.fromList [("v1", "a"), ("v2", "c")]) (Timestamp 0 []) 1] + + , [DataChange (A.fromList [("v1", "a"), ("v2", "a")]) (Timestamp 0 []) 1] + , [DataChange (A.fromList [("v1", "b"), ("v2", "b")]) (Timestamp 0 []) 1] + , [DataChange (A.fromList [("v1", "c"), ("v2", "d")]) (Timestamp 0 []) 1] + , [DataChange (A.fromList [("v1", "c"), ("v2", "c")]) (Timestamp 0 []) 1] + ] + +dcbs2' :: [[DataChange Object Word32]] +dcbs2' = + [ [DataChange (A.fromList [("v1", "b"), ("reduced", "cd")]) (Timestamp 0 [1]) 1] + , [DataChange (A.fromList [("v1", "a"), ("reduced", "b" )]) (Timestamp 0 [1]) 1] + , [DataChange (A.fromList [("v1", "c"), ("reduced", "a" )]) (Timestamp 0 [1]) 1] + + , [DataChange (A.fromList [("v1", "b"), ("reduced", "cd" )]) (Timestamp 0 [2]) (-1) + , DataChange (A.fromList [("v1", "b"), ("reduced", "cda")]) (Timestamp 0 [2]) 1] + , [DataChange (A.fromList [("v1", "a"), ("reduced", "b" )]) (Timestamp 0 [2]) (-1) + , DataChange (A.fromList [("v1", "a"), ("reduced", "bcd")]) (Timestamp 0 [2]) 1] + , [DataChange (A.fromList [("v1", "c"), ("reduced", "a" )]) (Timestamp 0 [2]) (-1) + , DataChange (A.fromList [("v1", "c"), ("reduced", "ab" )]) (Timestamp 0 [2]) 1] + + , [DataChange (A.fromList [("v1", "b"), ("reduced", "cda" )]) (Timestamp 0 [3]) (-1) + , DataChange (A.fromList [("v1", "b"), ("reduced", "cdab")]) (Timestamp 0 [3]) 1] + , [DataChange (A.fromList [("v1", "a"), ("reduced", "bcd" )]) (Timestamp 0 [3]) (-1) + , DataChange (A.fromList [("v1", "a"), ("reduced", "bcda")]) (Timestamp 0 [3]) 1] + , [DataChange (A.fromList [("v1", "c"), ("reduced", "ab" )]) (Timestamp 0 [3]) (-1) + , DataChange (A.fromList [("v1", "c"), ("reduced", "abcd")]) (Timestamp 0 [3]) 1] + ] + +dcbs3' :: [[DataChange Object Word32]] +dcbs3' = + [ [DataChange (A.fromList [("v1", "b"), ("v2", "c")]) (Timestamp 1 []) (-1)] + + , [DataChange (A.fromList [("v1", "b"), ("v2", "a")]) (Timestamp 1 []) (-1)] + , [DataChange (A.fromList [("v1", "a"), ("v2", "c")]) (Timestamp 1 []) (-1)] + + , [DataChange (A.fromList [("v1", "a"), ("v2", "a")]) (Timestamp 1 []) (-1)] + , [DataChange (A.fromList [("v1", "b"), ("v2", "b")]) (Timestamp 1 []) (-1)] + , [DataChange (A.fromList [("v1", "c"), ("v2", "c")]) (Timestamp 1 []) (-1)] + ] + +dcbs4' :: [[DataChange Object Word32]] +dcbs4' = + [ [DataChange (A.fromList [("v1", "b"), ("reduced", "cd")]) (Timestamp 1 [1]) (-1) + , DataChange (A.fromList [("v1", "b"), ("reduced", "d" )]) (Timestamp 1 [1]) 1] + + , [DataChange (A.fromList [("v1", "b"), ("reduced", "cd" )]) (Timestamp 1 [2]) 1 + , DataChange (A.fromList [("v1", "b"), ("reduced", "cda")]) (Timestamp 1 [2]) (-1)] + , [DataChange (A.fromList [("v1", "a"), ("reduced", "bcd")]) (Timestamp 1 [2]) (-1) + , DataChange (A.fromList [("v1", "a"), ("reduced", "bd" )]) (Timestamp 1 [2]) 1] + + , [DataChange (A.fromList [("v1", "b"), ("reduced", "cda" )]) (Timestamp 1 [3]) 1 + , DataChange (A.fromList [("v1", "b"), ("reduced", "cdab")]) (Timestamp 1 [3]) (-1)] + , [DataChange (A.fromList [("v1", "a"), ("reduced", "bcd" )]) (Timestamp 1 [3]) 1 + , DataChange (A.fromList [("v1", "a"), ("reduced", "bcda")]) (Timestamp 1 [3]) (-1)] + , [DataChange (A.fromList [("v1", "c"), ("reduced", "abcd")]) (Timestamp 1 [3]) (-1) + , DataChange (A.fromList [("v1", "c"), ("reduced", "abd" )]) (Timestamp 1 [3]) 1] + ] diff --git a/hstream-sql/etc/syntax-test-cases.yaml b/hstream-sql/etc/syntax-test-cases.yaml index 213a85eb6..2a16447b7 100644 --- a/hstream-sql/etc/syntax-test-cases.yaml +++ b/hstream-sql/etc/syntax-test-cases.yaml @@ -238,9 +238,9 @@ testSuiteCases: - testCaseFail: null testCaseLabel: Create Connectors testCaseResult: RQCreate (RCreateConnector "SOURCE" "source01" "mysql" False (RConnectorOptions - (fromList [("port",Number 3306.0),("host",String "mysql-s1"),("password",String - "password"),("user",String "root"),("database",String "d1"),("table",String "person"),("stream",String - "stream01")]))) + (fromList [("password",String "password"),("table",String "person"),("database",String + "d1"),("port",Number 3306.0),("stream",String "stream01"),("host",String "mysql-s1"),("user",String + "root")]))) testCaseStmts: - create source connector source01 from mysql with ("host" = 'mysql-s1', "port" = 3306, "user" = 'root', "password" = 'password', "database" = 'd1', "table" =