forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[POAE7-1497] The TypeConvetor of Substrait utils code refactor (faceb…
…ookincubator#7) * Pass project Tests for round-trip trans when batchSize=1 * clean some debug info * change code style and using log instead of cout * Pass project Tests for round-trip plan transform * use full names for more readable in tests * Pass FilterNode Tests for round-trip plan transform * [POAE7-1448] Add AggregateNode, nullValue APIs and pass six tests about transform from velox to substrait * address the comments * [POAE7-1448] pass the round-trip test of aggregatesNode * address comments and update the url of substrait submodule * [POAE7-1497] The header and CMake files after refine * [POAE7-1497] The header and CMake files after refine * address comments * [POAE7-1497]the TypeConvertor of Substrait utils code refactor * [POAE7-1497]the GlobalCommonVariable of Substrait utils code refactor * remove header file except TypeConvertor * make global variables into a singleton class
- Loading branch information
Showing
5 changed files
with
664 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "GlobalCommonVariable.h" | ||
|
||
namespace facebook::velox { | ||
|
||
GlobalCommonVarSingleton& GlobalCommonVarSingleton::getInstance() { | ||
static GlobalCommonVarSingleton instance; | ||
return instance; | ||
} | ||
|
||
io::substrait::Plan* GlobalCommonVarSingleton::getSPlan() const { | ||
return sPlan_; | ||
} | ||
void GlobalCommonVarSingleton::setSPlan(io::substrait::Plan* s_plan) { | ||
sPlan_ = s_plan; | ||
} | ||
const std::unordered_map<uint64_t, std::string>& | ||
GlobalCommonVarSingleton::getFunctionsMap() const { | ||
return functions_map_; | ||
} | ||
void GlobalCommonVarSingleton::setFunctionsMap( | ||
const std::unordered_map<uint64_t, std::string>& functions_map) { | ||
functions_map_ = functions_map; | ||
} | ||
// Substrait is ordinal based field reference implementation. sGlobalMapping | ||
// is used to tracked the mapping from ID to field reference. | ||
io::substrait::Type_NamedStruct* sGlobalMapping_ = | ||
new io::substrait::Type_NamedStruct(); | ||
} // namespace facebook::velox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "plan.pb.h" | ||
|
||
namespace facebook::velox { | ||
class GlobalCommonVarSingleton { | ||
public: | ||
static GlobalCommonVarSingleton& getInstance(); | ||
GlobalCommonVarSingleton(GlobalCommonVarSingleton const&) = delete; | ||
GlobalCommonVarSingleton& operator=(GlobalCommonVarSingleton const&) = delete; | ||
~GlobalCommonVarSingleton(){}; | ||
|
||
io::substrait::Plan* getSPlan() const; | ||
void setSPlan(io::substrait::Plan* s_plan); | ||
const std::unordered_map<uint64_t, std::string>& getFunctionsMap() const; | ||
void setFunctionsMap( | ||
const std::unordered_map<uint64_t, std::string>& functions_map); | ||
|
||
protected: | ||
// An intermediate variable to help us get the corresponding function mapping | ||
// relationship when convert from substrait to velox | ||
io::substrait::Plan* sPlan_; | ||
|
||
// parse the function mapping from substrait plan. | ||
std::unordered_map<uint64_t, std::string> functions_map_; | ||
|
||
private: | ||
GlobalCommonVarSingleton() | ||
: sPlan_(new io::substrait::Plan), functions_map_({{0, ""}}){}; | ||
}; | ||
|
||
// Substrait is ordinal based field reference implementation. sGlobalMapping | ||
// is used to tracked the mapping from ID to field reference. | ||
extern io::substrait::Type_NamedStruct* sGlobalMapping_; | ||
} // namespace facebook::velox |
Oops, something went wrong.