Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
eeb98a9a
Commit
eeb98a9a
authored
7 months ago
by
Arseniy Volynets
Browse files
Options
Downloads
Patches
Plain Diff
chore: remove duplicate tests from test_groupby.lua
parent
b1b021bf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1414
sbroad import
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sbroad-cartridge/test_app/test/integration/groupby_test.lua
+0
-323
0 additions, 323 deletions
sbroad-cartridge/test_app/test/integration/groupby_test.lua
with
0 additions
and
323 deletions
sbroad-cartridge/test_app/test/integration/groupby_test.lua
+
0
−
323
View file @
eeb98a9a
...
...
@@ -1843,83 +1843,6 @@ groupby_queries.test_total_with_groupby = function()
})
end
groupby_queries
.
test_having1
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
-- with having
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT "a", sum("b") as "sum" from "arithmetic_space"
group by "a"
having sum("b") > 5
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"a"
,
type
=
"integer"
},
{
name
=
"sum"
,
type
=
"decimal"
}
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
2
,
6
}
})
-- without having
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT "a", sum("b") as "sum" from "arithmetic_space"
group by "a"
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"a"
,
type
=
"integer"
},
{
name
=
"sum"
,
type
=
"decimal"
}
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
2
,
6
},
{
1
,
3
}
})
end
groupby_queries
.
test_having2
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT "a", sum("b") as "sum" from "arithmetic_space"
group by "a"
having "a" = 1
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"a"
,
type
=
"integer"
},
{
name
=
"sum"
,
type
=
"decimal"
}
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
1
,
3
}
})
end
groupby_queries
.
test_having3
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT "boolean_col", sum(distinct "f") as "sum" from "arithmetic_space"
group by "boolean_col"
having "boolean_col" = true
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"boolean_col"
,
type
=
"boolean"
},
{
name
=
"sum"
,
type
=
"decimal"
}
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
true
,
2
}
})
end
groupby_queries
.
test_having_with_sq
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
local
query_str
=
[[
...
...
@@ -1957,252 +1880,6 @@ groupby_queries.test_having_with_sq = function()
})
end
groupby_queries
.
test_having_no_groupby
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
-- having condition is true
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT sum("a"), sum(distinct "a"), count("a"), count(distinct "a") from "arithmetic_space"
having count(distinct "a") > 1
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
-- todo: if executed on single tarantool instance, types are: (integer, integer, integer, integer)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"COL_1"
,
type
=
"decimal"
},
{
name
=
"COL_2"
,
type
=
"decimal"
},
{
name
=
"COL_3"
,
type
=
"decimal"
},
{
name
=
"COL_4"
,
type
=
"integer"
},
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
6
,
3
,
4
,
2
}
})
-- having condition is false
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT sum("a"), sum(distinct "a"), count("a"), count(distinct "a") from "arithmetic_space"
having count(distinct "a") > 100
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"COL_1"
,
type
=
"decimal"
},
{
name
=
"COL_2"
,
type
=
"decimal"
},
{
name
=
"COL_3"
,
type
=
"decimal"
},
{
name
=
"COL_4"
,
type
=
"integer"
},
})
t
.
assert_items_equals
(
r
.
rows
,
{})
end
groupby_queries
.
test_having_selection
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
-- with having
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT "string_col", count(distinct "string_col"), count("string_col")
from "arithmetic_space"
where "id" > 2 or "string_col" = 'a'
group by "string_col"
having sum(distinct "a") > 1
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"string_col"
,
type
=
"string"
},
{
name
=
"COL_1"
,
type
=
"integer"
},
{
name
=
"COL_2"
,
type
=
"decimal"
}
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
'c'
,
1
,
2
}
})
-- without having
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT "string_col", count(distinct "string_col"), count("string_col")
from "arithmetic_space"
where "id" > 2 or "string_col" = 'a'
group by "string_col"
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"string_col"
,
type
=
"string"
},
{
name
=
"COL_1"
,
type
=
"integer"
},
{
name
=
"COL_2"
,
type
=
"decimal"
}
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
'a'
,
1
,
2
},
{
'c'
,
1
,
2
}
})
end
groupby_queries
.
test_having_join
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT sum(distinct "a"), "b", s
from "arithmetic_space" as t1 inner join
(
select cast(sum("a") / 6 as integer) as s
from "arithmetic_space2"
having count(distinct "a") > 1
) as t2
on t1."c" = t2.s
group by s, t1."b"
having sum(distinct "a") in (2, 3) and count(distinct t2.s) = 1
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"COL_1"
,
type
=
"decimal"
},
{
name
=
"b"
,
type
=
"integer"
},
{
name
=
"S"
,
type
=
"integer"
}
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
2
,
3
,
1
}
})
end
groupby_queries
.
test_having_full_query
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
-- data after join + where
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT t1."a", t2.b, t2.s, t1."d"
from "arithmetic_space" as t1 inner join
(select "b" as b, "string_col" as s from "arithmetic_space2") as t2
on t1."a" = t2.b
where t1."d" + t1."a" > 2
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"T1.a"
,
type
=
"integer"
},
{
name
=
"T2.B"
,
type
=
"integer"
},
{
name
=
"T2.S"
,
type
=
"string"
},
{
name
=
"T1.d"
,
type
=
"integer"
},
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
1
,
1
,
"a"
,
2
},
{
1
,
1
,
"b"
,
2
},
{
1
,
1
,
"b"
,
2
},
{
2
,
2
,
"a"
,
2
},
{
2
,
2
,
"a"
,
1
},
})
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
SELECT t1."a", count(distinct s)
from "arithmetic_space" as t1 inner join
(select "b" as b, "string_col" as s from "arithmetic_space2") as t2
on t1."a" = t2.b
where t1."d" + t1."a" > 2
group by "a"
having count(distinct s) > 1
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"a"
,
type
=
"integer"
},
{
name
=
"COL_1"
,
type
=
"integer"
},
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
1
,
2
}
})
end
groupby_queries
.
test_having_inside_union
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
select sum(distinct "e") from "arithmetic_space"
having count(distinct "d") > 1
union all
select "b" from "arithmetic_space"
group by "b"
having count(distinct "d") > 1
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"COL_1"
,
type
=
"decimal"
},
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
2
},
{
3
}
})
end
groupby_queries
.
test_having_inside_union1
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
select "e" from "arithmetic_space"
union all
select "b" from "arithmetic_space"
group by "b"
having count(distinct "d") > 1
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"e"
,
type
=
"integer"
},
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
2
},
{
2
},
{
2
},
{
2
},
{
3
}
})
end
groupby_queries
.
test_having_inside_except
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
select count("e") - 1 from "arithmetic_space"
having count("e") = 4
except
select "b" from "arithmetic_space"
group by "b"
having count(distinct "d") > 1
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"COL_1"
,
type
=
"decimal"
},
})
t
.
assert_items_equals
(
r
.
rows
,
{})
end
groupby_queries
.
test_having_inside_except1
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
local
r
,
err
=
api
:
call
(
"sbroad.execute"
,
{
[[
select "d" from "arithmetic_space"
group by "d"
except
select sum(distinct "c") from "arithmetic_space"
having count(distinct "c") = 1
]]
,
{}
})
t
.
assert_equals
(
err
,
nil
)
t
.
assert_equals
(
r
.
metadata
,
{
{
name
=
"d"
,
type
=
"integer"
},
})
t
.
assert_items_equals
(
r
.
rows
,
{
{
2
},
})
end
groupby_queries
.
test_having1
=
function
()
local
api
=
cluster
:
server
(
"api-1"
).
net_box
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment