Line data Source code
1 : #ifndef BIGQUERY_EMULATOR_BACKEND_CATALOG_EMULATOR_ML_TEST_CATALOG_H_
2 : #define BIGQUERY_EMULATOR_BACKEND_CATALOG_EMULATOR_ML_TEST_CATALOG_H_
3 :
4 : #include "absl/status/status.h"
5 : #include "absl/types/span.h"
6 : #include "backend/catalog/emulator_ml_tvf_extensions.h"
7 : #include "googlesql/public/catalog.h"
8 : #include "googlesql/public/simple_catalog.h"
9 :
10 : namespace bigquery_emulator {
11 : namespace backend {
12 : namespace catalog {
13 :
14 : // Test/catalog helper that resolves any MODEL path to a placeholder
15 : // `SimpleModel` so ML.* TVF analysis can proceed without CREATE MODEL
16 : // metadata.
17 : class EmulatorMlTestCatalog : public ::googlesql::SimpleCatalog {
18 : public:
19 : using ::googlesql::SimpleCatalog::SimpleCatalog;
20 :
21 : absl::Status FindModel(const absl::Span<const std::string>& path,
22 : const ::googlesql::Model** model,
23 8 : const FindOptions& options = FindOptions()) override {
24 8 : return ResolveMlStubModelForAnalysis(
25 8 : *this, type_factory(), path, model, options);
26 8 : }
27 : };
28 :
29 : } // namespace catalog
30 : } // namespace backend
31 : } // namespace bigquery_emulator
32 :
33 : #endif // BIGQUERY_EMULATOR_BACKEND_CATALOG_EMULATOR_ML_TEST_CATALOG_H_
|