MCPcopy Create free account
hub / github.com/apache/arrow / TEST

Function TEST

cpp/src/arrow/engine/substrait/function_test.cc:183–496  ·  view source on GitHub ↗

These are not meant to be an exhaustive test of Substrait conformance. Instead, we should test just enough to ensure we are mapping to the correct function

Source from the content-addressed store, hash-verified

181// conformance. Instead, we should test just enough to ensure
182// we are mapping to the correct function
183TEST(FunctionMapping, ValidCases) {
184 const std::initializer_list<FunctionTestCase> valid_test_cases = {
185 {{kSubstraitArithmeticFunctionsUri, "add"},
186 {"127", "10"},
187 {{"overflow", {"SILENT", "ERROR"}}},
188 {int8(), int8()},
189 "-119",
190 int8()},
191 {{kArrowSimpleExtensionFunctionsUri, "add_checked"},
192 {"10", "15"},
193 kNoOptions,
194 {int8(), int8()},
195 "25",
196 int8()},
197 {{kSubstraitArithmeticFunctionsUri, "subtract"},
198 {"-119", "10"},
199 {{"overflow", {"SILENT", "ERROR"}}},
200 {int8(), int8()},
201 "127",
202 int8()},
203 {{kSubstraitArithmeticFunctionsUri, "multiply"},
204 {"10", "13"},
205 {{"overflow", {"SILENT", "ERROR"}}},
206 {int8(), int8()},
207 "-126",
208 int8()},
209 {{kSubstraitArithmeticFunctionsUri, "divide"},
210 {"-128", "-1"},
211 {{"overflow", {"SILENT", "ERROR"}}},
212 {int8(), int8()},
213 "0",
214 int8()},
215 {{kSubstraitArithmeticFunctionsUri, "sign"},
216 {"-1"},
217 kNoOptions,
218 {int8()},
219 "-1",
220 int8()},
221 {{kSubstraitArithmeticFunctionsUri, "power"},
222 {"2", "2"},
223 {{"overflow", {"SILENT", "ERROR"}}},
224 {int8(), int8()},
225 "4",
226 int8()},
227 {{kSubstraitArithmeticFunctionsUri, "sqrt"},
228 {"4"},
229 {{"overflow", {"SILENT", "ERROR"}}},
230 {int8()},
231 "2",
232 float64()},
233 {{kSubstraitArithmeticFunctionsUri, "exp"},
234 {"1"},
235 kNoOptions,
236 {float64()},
237 "2.718281828459045",
238 float64()},
239 {{kSubstraitArithmeticFunctionsUri, "abs"},
240 {"-1"},

Callers

nothing calls this directly

Calls 5

CheckValidTestCasesFunction · 0.85
CheckErrorTestCasesFunction · 0.85
CheckAggregateCasesFunction · 0.85
timestampFunction · 0.50

Tested by

no test coverage detected