OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExecutionResultSerializer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include "QueryEngine/RelAlgDag.h"
20 
21 #include <boost/serialization/tracking.hpp>
22 
23 // Because RexSubQuery::result_ is a shared_ptr of a shared_ptr, boost by default will not
24 // track it appropriately during serialization. We need to change the default behavior and
25 // let boost track the shared_pt<ExecutionResult> so that it can be serialized and loaded.
26 // Without the track_selectively registration below, a compilation error would be thrown
27 // when attempting to serialize RexSubQuery::result_
29  boost::serialization::track_selectively)
30 
31 namespace boost {
32 namespace serialization {
33 
34 template <class Archive>
35 void serialize(Archive& ar,
37  const unsigned int version) {
38  // Noop - this should do nothing. Results should never be serialized. Serialization
39  // should happen before RelAlgExecutor gets its hands on the dag.
40  // This serialize method is only used to avoid compilation errors.
41  CHECK(result == nullptr);
42 }
43 
44 } // namespace serialization
45 } // namespace boost
string version
Definition: setup.in.py:73
BOOST_CLASS_TRACKING(RexSubQuery::ExecutionResultShPtr, boost::serialization::track_selectively) namespace boost
void serialize(Archive &ar, RegisteredQueryHint &query_hint, const unsigned int version)
#define CHECK(condition)
Definition: Logger.h:291
std::shared_ptr< const ExecutionResult > ExecutionResultShPtr
Definition: RelAlgDag.h:965