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

Function ggandiva_if_node_new

c_glib/gandiva-glib/node.cpp:1310–1351  ·  view source on GitHub ↗

* ggandiva_if_node_new: * @condition_node: the node with the condition for if-else expression. * @then_node: the node in case the condition node is true. * @else_node: the node in case the condition node is false. * @return_type: A #GArrowDataType. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable): A newly created #GGandivaIfNode or %NULL on error. * *

Source from the content-addressed store, hash-verified

1308 * Since: 0.12.0
1309 */
1310GGandivaIfNode *
1311ggandiva_if_node_new(GGandivaNode *condition_node,
1312 GGandivaNode *then_node,
1313 GGandivaNode *else_node,
1314 GArrowDataType *return_type,
1315 GError **error)
1316{
1317 if (!condition_node || !then_node || !else_node || !return_type) {
1318 /* TODO: Improve error message to show which arguments are invalid. */
1319 g_set_error(error,
1320 GARROW_ERROR,
1321 GARROW_ERROR_INVALID,
1322 "[gandiva][if-literal-node][new] "
1323 "all arguments must not NULL");
1324 return NULL;
1325 }
1326 auto gandiva_condition_node = ggandiva_node_get_raw(condition_node);
1327 auto gandiva_then_node = ggandiva_node_get_raw(then_node);
1328 auto gandiva_else_node = ggandiva_node_get_raw(else_node);
1329 auto arrow_return_type = garrow_data_type_get_raw(return_type);
1330 auto gandiva_node = gandiva::TreeExprBuilder::MakeIf(gandiva_condition_node,
1331 gandiva_then_node,
1332 gandiva_else_node,
1333 arrow_return_type);
1334 if (!gandiva_node) {
1335 g_set_error(error,
1336 GARROW_ERROR,
1337 GARROW_ERROR_INVALID,
1338 "[gandiva][if-literal-node][new] "
1339 "failed to create: if (<%s>) {<%s>} else {<%s>} -> <%s>",
1340 gandiva_condition_node->ToString().c_str(),
1341 gandiva_then_node->ToString().c_str(),
1342 gandiva_else_node->ToString().c_str(),
1343 arrow_return_type->ToString().c_str());
1344 return NULL;
1345 }
1346 return ggandiva_if_node_new_raw(&gandiva_node,
1347 condition_node,
1348 then_node,
1349 else_node,
1350 return_type);
1351}
1352
1353typedef struct GGandivaBooleanNodePrivate_
1354{

Callers

nothing calls this directly

Calls 3

garrow_data_type_get_rawFunction · 0.85
ggandiva_if_node_new_rawFunction · 0.85
ToStringMethod · 0.45

Tested by

no test coverage detected