MCPcopy Create free account
hub / github.com/Query-farm/airport / LoadEntries

Method LoadEntries

src/storage/airport_table_function_set.cpp:707–819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

705 }
706
707 void AirportTableFunctionSet::LoadEntries(ClientContext &context)
708 {
709 // auto &transaction = AirportTransaction::Get(context, catalog);
710 auto &db = *context.db;
711
712 auto &airport_catalog = catalog.Cast<AirportCatalog>();
713
714 auto contents = AirportAPI::GetSchemaItems(
715 db,
716 catalog.GetDBPath(),
717 schema.name,
718 schema.serialized_source(),
719 cache_directory_,
720 airport_catalog.attach_parameters());
721
722 // There can be functions with the same name.
723 std::unordered_map<AirportFunctionCatalogSchemaNameKey, std::vector<AirportAPITableFunction>> functions_by_name;
724
725 for (auto &function : contents->table_functions)
726 {
727 AirportFunctionCatalogSchemaNameKey function_key{function.catalog_name(), function.schema_name(), function.name()};
728 functions_by_name[function_key].emplace_back(function);
729 }
730
731 for (const auto &pair : functions_by_name)
732 {
733 TableFunctionSet flight_func_set(pair.first.name);
734 vector<FunctionDescription> function_descriptions;
735
736 for (const auto &function : pair.second)
737 {
738 // These input types are available since they are specified in the metadata, but the
739 // schema that is returned likely should be requested dynamically from the dynamic
740 // flight function.
741
742 auto input_types = AirportSchemaToLogicalTypesWithNaming(context, function.input_schema(), function);
743
744 // Determine if we have a table input.
745 bool has_table_input = false;
746 if (std::find(input_types.all.begin(), input_types.all.end(), LogicalType(LogicalTypeId::TABLE)) != input_types.all.end())
747 {
748 has_table_input = true;
749 }
750
751 FunctionDescription description;
752 description.parameter_types = input_types.positional;
753 description.parameter_names = input_types.positional_names;
754 description.description = function.description();
755 function_descriptions.push_back(std::move(description));
756
757 TableFunction table_func;
758 if (!has_table_input)
759 {
760 table_func = TableFunction(
761 input_types.positional,
762 AirportTakeFlight,
763 AirportDynamicTableBind,
764 AirportArrowScanInitGlobal,

Callers

nothing calls this directly

Calls 1

GetDBPathMethod · 0.80

Tested by

no test coverage detected