MCPcopy Create free account
hub / github.com/datasweet/datatable / sampleForConcat

Function sampleForConcat

concat_test.go:12–48  ·  view source on GitHub ↗

Sample from https://sql.sh/cours/union

(t *testing.T)

Source from the content-addressed store, hash-verified

10
11// Sample from https://sql.sh/cours/union
12func sampleForConcat(t *testing.T) (*datatable.DataTable, *datatable.DataTable, *datatable.DataTable) {
13 a := datatable.New("magasin1")
14 a.AddColumn("prenom", datatable.String)
15 a.AddColumn("nom", datatable.String)
16 a.AddColumn("ville", datatable.String)
17 a.AddColumn("date_naissance", datatable.Time)
18 a.AddColumn("total_achat", datatable.Int64)
19
20 a.AppendRow("Léon", "Dupuis", "Paris", "1983-03-06", 135)
21 a.AppendRow("Marie", "Bernard", "Paris", "1993-07-03", 75)
22 a.AppendRow("Sophie", "Dupond", "Marseille", "1986-02-22", 27)
23 a.AppendRow("Marcel", "Martin", "Paris", "1976-11-24", 39)
24
25 b := datatable.New("magasin2")
26 b.AddColumn("prenom", datatable.String)
27 b.AddColumn("nom", datatable.String)
28 b.AddColumn("ville", datatable.String)
29 b.AddColumn("date_naissance", datatable.Time)
30 b.AddColumn("total_achat", datatable.Int64)
31
32 b.AppendRow("Marion", "Leroy", "Lyon", "1982-10-27", 285)
33 b.AppendRow("Paul", "Moreau", "Lyon", "1976-04-19", 133)
34 b.AppendRow("Marie", "Bernard", "Paris", "1993-07-03", 75)
35 b.AppendRow("Marcel", "Martin", "Paris", "1976-11-24", 39)
36
37 c := datatable.New("magasin3")
38 c.AddColumn("prenom", datatable.String)
39 c.AddColumn("nom", datatable.String)
40 c.AddColumn("ville", datatable.String)
41 c.AddColumn("date_naissance", datatable.Time)
42 c.AddColumn("marge", datatable.Float64)
43
44 c.AppendRow("Marion", "Leroy", "Lyon", "1982-10-27", 5.2)
45 c.AppendRow("Marie", "Bernard", "Paris", "1993-07-03", 0.8)
46
47 return a, b, c
48}
49
50func TestSimpleConcat(t *testing.T) {
51 a, b, _ := sampleForConcat(t)

Callers 3

TestSimpleConcatFunction · 0.85
TestGrowColConcatFunction · 0.85
TestConcatWithExprFunction · 0.85

Calls 3

NewFunction · 0.92
AddColumnMethod · 0.80
AppendRowMethod · 0.80

Tested by

no test coverage detected