Skip to content

Commit

Permalink
fix: Rename namespace 'substrait' to 'io::substrait'
Browse files Browse the repository at this point in the history
  • Loading branch information
westonpace authored Jan 30, 2023
2 parents cb8a023 + 04f183e commit 717bb01
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 47 deletions.
4 changes: 2 additions & 2 deletions include/substrait/common/Exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <utility>
#include <fmt/format.h>

namespace substrait::common {
namespace io::substrait::common {
namespace error_code {

//====================== User Error Codes ======================:
Expand Down Expand Up @@ -133,4 +133,4 @@ std::string errorMessage(fmt::string_view fmt, const Args&... args) {
substrait::common::error_code::kInvalidArgument, \
##__VA_ARGS__)

} // namespace substrait::common
} // namespace io::substrait::common
4 changes: 2 additions & 2 deletions include/substrait/function/Extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "substrait/function/FunctionSignature.h"
#include "substrait/type/Type.h"

namespace substrait {
namespace io::substrait {

struct TypeVariant {
std::string name;
Expand Down Expand Up @@ -80,4 +80,4 @@ class Extension {

using ExtensionPtr = std::shared_ptr<const Extension>;

} // namespace substrait
} // namespace io::substrait
4 changes: 2 additions & 2 deletions include/substrait/function/Function.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "substrait/type/Type.h"
#include "substrait/function/FunctionSignature.h"

namespace substrait {
namespace io::substrait {

struct FunctionArgument {
[[nodiscard]] virtual bool isRequired() const = 0;
Expand Down Expand Up @@ -113,4 +113,4 @@ struct AggregateFunctionImplementation : public FunctionImplementation {
bool tryMatch(const FunctionSignature& signature) override;
};

} // namespace substrait
} // namespace io::substrait
4 changes: 2 additions & 2 deletions include/substrait/function/FunctionLookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "substrait/function/Extension.h"
#include "substrait/function/FunctionSignature.h"

namespace substrait {
namespace io::substrait {

class FunctionLookup {
public:
Expand Down Expand Up @@ -58,4 +58,4 @@ class WindowFunctionLookup : public FunctionLookup {
}
};

} // namespace substrait
} // namespace io::substrait
4 changes: 2 additions & 2 deletions include/substrait/function/FunctionSignature.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#include "substrait/type/Type.h"

namespace substrait {
namespace io::substrait {

struct FunctionSignature {
std::string name;
std::vector<TypePtr> arguments;
TypePtr returnType;
};

} // namespace substrait
} // namespace io::substrait
4 changes: 2 additions & 2 deletions include/substrait/type/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <utility>
#include <vector>

namespace substrait {
namespace io::substrait {

enum class TypeKind : int8_t {
kBool = 1,
Expand Down Expand Up @@ -653,4 +653,4 @@ std::shared_ptr<const Map> MAP(

std::shared_ptr<const Struct> STRUCT(const std::vector<TypePtr>& children);

} // namespace substrait
} // namespace io::substrait
4 changes: 2 additions & 2 deletions substrait/common/Exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <fmt/format.h>
#include "substrait/common/Exceptions.h"

namespace substrait::common {
namespace io::substrait::common {

SubstraitException::SubstraitException(
const std::string& exceptionCode,
Expand All @@ -21,4 +21,4 @@ SubstraitException::SubstraitException(
__FILE__,
std::to_string(__LINE__))) {}

} // namespace substrait::common
} // namespace io::substrait::common
50 changes: 25 additions & 25 deletions substrait/function/Extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

bool decodeFunctionVariant(
const YAML::Node& node,
substrait::FunctionImplementation& function) {
io::substrait::FunctionImplementation& function) {
const auto& returnType = node["return"];
if (returnType && returnType.IsScalar()) {
/// Return type can be an expression.
Expand All @@ -17,22 +17,22 @@ bool decodeFunctionVariant(
std::string lastReturnType;
while (std::getline(ss, lastReturnType, '\n')) {
}
function.returnType = substrait::Type::decode(lastReturnType);
function.returnType = io::substrait::Type::decode(lastReturnType);
}
const auto& args = node["args"];
if (args && args.IsSequence()) {
for (auto& arg : args) {
if (arg["options"]) { // enum argument
auto enumArgument = std::make_shared<substrait::EnumArgument>(
arg.as<substrait::EnumArgument>());
auto enumArgument = std::make_shared<io::substrait::EnumArgument>(
arg.as<io::substrait::EnumArgument>());
function.arguments.emplace_back(enumArgument);
} else if (arg["value"]) { // value argument
auto valueArgument = std::make_shared<substrait::ValueArgument>(
arg.as<substrait::ValueArgument>());
auto valueArgument = std::make_shared<io::substrait::ValueArgument>(
arg.as<io::substrait::ValueArgument>());
function.arguments.emplace_back(valueArgument);
} else { // type argument
auto typeArgument = std::make_shared<substrait::TypeArgument>(
arg.as<substrait::TypeArgument>());
auto typeArgument = std::make_shared<io::substrait::TypeArgument>(
arg.as<io::substrait::TypeArgument>());
function.arguments.emplace_back(typeArgument);
}
}
Expand All @@ -43,7 +43,7 @@ bool decodeFunctionVariant(
auto& min = variadic["min"];
auto& max = variadic["max"];
if (min) {
function.variadic = std::make_optional<substrait::FunctionVariadic>(
function.variadic = std::make_optional<io::substrait::FunctionVariadic>(
{min.as<int>(),
max ? std::make_optional<int>(max.as<int>()) : std::nullopt});
} else {
Expand All @@ -57,8 +57,8 @@ bool decodeFunctionVariant(
}

template <>
struct YAML::convert<substrait::EnumArgument> {
static bool decode(const Node& node, substrait::EnumArgument& argument) {
struct YAML::convert<io::substrait::EnumArgument> {
static bool decode(const Node& node, io::substrait::EnumArgument& argument) {
// 'options' is required property
const auto& options = node["options"];
if (options && options.IsSequence()) {
Expand All @@ -72,23 +72,23 @@ struct YAML::convert<substrait::EnumArgument> {
};

template <>
struct YAML::convert<substrait::ValueArgument> {
static bool decode(const Node& node, substrait::ValueArgument& argument) {
struct YAML::convert<io::substrait::ValueArgument> {
static bool decode(const Node& node, io::substrait::ValueArgument& argument) {
const auto& value = node["value"];
if (value && value.IsScalar()) {
auto valueType = value.as<std::string>();
argument.type = substrait::Type::decode(valueType);
argument.type = io::substrait::Type::decode(valueType);
return true;
}
return false;
}
};

template <>
struct YAML::convert<substrait::TypeArgument> {
struct YAML::convert<io::substrait::TypeArgument> {
static bool decode(
const YAML::Node& node,
substrait::TypeArgument& argument) {
io::substrait::TypeArgument& argument) {
// no properties need to populate for type argument, just return true if
// 'type' element exists.
if (node["type"]) {
Expand All @@ -99,34 +99,34 @@ struct YAML::convert<substrait::TypeArgument> {
};

template <>
struct YAML::convert<substrait::ScalarFunctionImplementation> {
struct YAML::convert<io::substrait::ScalarFunctionImplementation> {
static bool decode(
const Node& node,
substrait::ScalarFunctionImplementation& function) {
io::substrait::ScalarFunctionImplementation& function) {
return decodeFunctionVariant(node, function);
};
};

template <>
struct YAML::convert<substrait::AggregateFunctionImplementation> {
struct YAML::convert<io::substrait::AggregateFunctionImplementation> {
static bool decode(
const Node& node,
substrait::AggregateFunctionImplementation& function) {
io::substrait::AggregateFunctionImplementation& function) {
const auto& res = decodeFunctionVariant(node, function);
if (res) {
const auto& intermediate = node["intermediate"];
if (intermediate) {
function.intermediate =
substrait::ParameterizedType::decode(intermediate.as<std::string>());
io::substrait::ParameterizedType::decode(intermediate.as<std::string>());
}
}
return res;
}
};

template <>
struct YAML::convert<substrait::TypeVariant> {
static bool decode(const Node& node, substrait::TypeVariant& typeAnchor) {
struct YAML::convert<io::substrait::TypeVariant> {
static bool decode(const Node& node, io::substrait::TypeVariant& typeAnchor) {
const auto& name = node["name"];
if (name && name.IsScalar()) {
typeAnchor.name = name.as<std::string>();
Expand All @@ -136,7 +136,7 @@ struct YAML::convert<substrait::TypeVariant> {
}
};

namespace substrait {
namespace io::substrait {

std::shared_ptr<Extension> Extension::load(const std::string& basePath) {
static const std::vector<std::string> extensionFiles{
Expand Down Expand Up @@ -276,4 +276,4 @@ void Extension::addAggregateFunctionVariant(
}
}

} // namespace substrait
} // namespace io::substrait
4 changes: 2 additions & 2 deletions substrait/function/Function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <sstream>
#include "substrait/function/Function.h"

namespace substrait {
namespace io::substrait {

bool FunctionImplementation::tryMatch(const FunctionSignature& signature) {
const auto& actualTypes = signature.arguments;
Expand Down Expand Up @@ -83,4 +83,4 @@ bool AggregateFunctionImplementation::tryMatch(const FunctionSignature& signatur
return matched;
}

} // namespace substrait
} // namespace io::substrait
4 changes: 2 additions & 2 deletions substrait/function/FunctionLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "substrait/function/FunctionLookup.h"

namespace substrait {
namespace io::substrait {

FunctionImplementationPtr FunctionLookup::lookupFunction(
const FunctionSignature& signature) const {
Expand All @@ -19,4 +19,4 @@ FunctionImplementationPtr FunctionLookup::lookupFunction(
return nullptr;
}

} // namespace substrait
} // namespace io::substrait
2 changes: 1 addition & 1 deletion substrait/function/tests/FunctionLookupTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <gtest/gtest.h>
#include "substrait/function/FunctionLookup.h"

using namespace substrait;
using namespace io::substrait;

class FunctionLookupTest : public ::testing::Test {
protected:
Expand Down
4 changes: 2 additions & 2 deletions substrait/type/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "substrait/type/Type.h"
#include "substrait/common/Exceptions.h"

namespace substrait {
namespace io::substrait {

namespace {

Expand Down Expand Up @@ -504,4 +504,4 @@ bool StringLiteral::isMatch(
}
}

} // namespace substrait
} // namespace io::substrait
2 changes: 1 addition & 1 deletion substrait/type/tests/TypeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <gtest/gtest.h>
#include "substrait/type/Type.h"

using namespace substrait;
using namespace io::substrait;

class TypeTest : public ::testing::Test {
protected:
Expand Down

0 comments on commit 717bb01

Please sign in to comment.