From 191943d5c6b245f6550d70ca1d3f2498f44dc9a5 Mon Sep 17 00:00:00 2001 From: Sam Ansmink Date: Tue, 14 May 2024 15:10:42 +0200 Subject: [PATCH] Refactor initialization of EngineSchemaVisitor object --- src/include/delta_utils.hpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/include/delta_utils.hpp b/src/include/delta_utils.hpp index 648b8d1..164ee69 100644 --- a/src/include/delta_utils.hpp +++ b/src/include/delta_utils.hpp @@ -15,22 +15,23 @@ class SchemaVisitor { static unique_ptr VisitSnapshotSchema(const ffi::SnapshotHandle* snapshot) { SchemaVisitor state; - ffi::EngineSchemaVisitor visitor = { - .data = &state, - .make_field_list = (uintptr_t (*)(void*, uintptr_t)) &MakeFieldList, - .visit_struct = (void (*)(void*, uintptr_t, ffi::KernelStringSlice, uintptr_t)) &VisitStruct, - .visit_string = VisitSimpleType(), - .visit_long = VisitSimpleType(), - .visit_integer = VisitSimpleType(), - .visit_byte = VisitSimpleType(), - .visit_float = VisitSimpleType(), - .visit_double = VisitSimpleType(), - .visit_boolean = VisitSimpleType(), - .visit_binary = VisitSimpleType(), // TODO: check - .visit_date = VisitSimpleType(), // TODO: check - .visit_timestamp = VisitSimpleType(), // TODO: check - .visit_timestamp_ntz = VisitSimpleType() // TODO: check - }; + ffi::EngineSchemaVisitor visitor; + + visitor.data = &state; + visitor.make_field_list = (uintptr_t (*)(void*, uintptr_t)) &MakeFieldList; + visitor.visit_struct = (void (*)(void*, uintptr_t, ffi::KernelStringSlice, uintptr_t)) &VisitStruct; + visitor.visit_string = VisitSimpleType(); + visitor.visit_long = VisitSimpleType(); + visitor.visit_integer = VisitSimpleType(); + visitor.visit_byte = VisitSimpleType(); + visitor.visit_float = VisitSimpleType(); + visitor.visit_double = VisitSimpleType(); + visitor.visit_boolean = VisitSimpleType(); + visitor.visit_binary = VisitSimpleType(); // TODO: check + visitor.visit_date = VisitSimpleType(); // TODO: check + visitor.visit_timestamp = VisitSimpleType(); // TODO: check + visitor.visit_timestamp_ntz = VisitSimpleType(); // TODO: check + uintptr_t result = visit_schema(snapshot, &visitor); return state.TakeFieldList(result); }