Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@ endif ()

add_custom_target(build_all_plugins)

# Declared here so add_compile_definitions reaches all sibling nes-* targets.
# nes-plugins/CMakeLists.txt re-declares the same option (no-op when cached).
option(NES_ENABLE_MEOS "Enable MEOS plugin (requires libmeos installed on the system)" ON)
if(NES_ENABLE_MEOS)
add_compile_definitions(NES_ENABLE_MEOS)
endif()

# Add target for common lib, which contains a minimal set
# of shared functionality used by all components of nes
file(GLOB NES_DIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "nes-*")
Expand Down
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
tbb
python3
openjdk21
paho-mqtt-c
paho-mqtt-cpp
]) ++ [ follyPkg antlr4Pkg ];

antlr4Jar = pkgs.fetchurl {
Expand Down Expand Up @@ -244,6 +246,7 @@
"-DNES_ENABLES_TESTS=ON"
"-DCMAKE_MODULE_PATH=${libdwarfModule}/share/cmake/Modules"
"-DANTLR4_JAR_LOCATION=${antlr4Jar}"
"-DNES_ENABLE_MEOS=OFF"
];

enableParallelBuilding = true;
Expand Down Expand Up @@ -347,6 +350,7 @@
"-DLLVM_DIR=${commonCmakeEnv.LLVM_DIR}"
"-DANTLR4_JAR_LOCATION=${antlr4Jar}"
"-DCMAKE_MODULE_PATH=${libdwarfModule}/share/cmake/Modules"
"-DNES_ENABLE_MEOS=OFF"
];
shellHook = ''
unset NES_PREBUILT_VCPKG_ROOT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
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

https://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 <Functions/LogicalFunction.hpp>
#include <string_view>
#include <utility>
#include <vector>

namespace NES {

/**
* @brief Per-event tfloat_cos: single-instant tfloat transform, value extracted -> double.
*
* Generated by tools/codegen/codegen_nebula.py from the MEOS function
* `tfloat_cos`. Per-event scalar operator following the
* TemporalEDWithinGeometry pattern.
*/
class TfloatCosLogicalFunction : public LogicalFunctionConcept {
public:
static constexpr std::string_view NAME = "TfloatCos";

TfloatCosLogicalFunction(LogicalFunction value,
LogicalFunction ts);

DataType getDataType() const override;
LogicalFunction withDataType(const DataType& dataType) const override;
std::vector<LogicalFunction> getChildren() const override;
LogicalFunction withChildren(const std::vector<LogicalFunction>& children) const override;
std::string_view getType() const override;
bool operator==(const LogicalFunctionConcept& rhs) const override;
std::string explain(ExplainVerbosity verbosity) const override;
LogicalFunction withInferredDataType(const Schema& schema) const override;
SerializableFunction serialize() const override;

private:
DataType dataType;
std::vector<LogicalFunction> parameters;
};

} // namespace NES
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
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

https://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 <Functions/LogicalFunction.hpp>
#include <string_view>
#include <utility>
#include <vector>

namespace NES {

/**
* @brief Per-event tfloat_sin: single-instant tfloat transform, value extracted -> double.
*
* Generated by tools/codegen/codegen_nebula.py from the MEOS function
* `tfloat_sin`. Per-event scalar operator following the
* TemporalEDWithinGeometry pattern.
*/
class TfloatSinLogicalFunction : public LogicalFunctionConcept {
public:
static constexpr std::string_view NAME = "TfloatSin";

TfloatSinLogicalFunction(LogicalFunction value,
LogicalFunction ts);

DataType getDataType() const override;
LogicalFunction withDataType(const DataType& dataType) const override;
std::vector<LogicalFunction> getChildren() const override;
LogicalFunction withChildren(const std::vector<LogicalFunction>& children) const override;
std::string_view getType() const override;
bool operator==(const LogicalFunctionConcept& rhs) const override;
std::string explain(ExplainVerbosity verbosity) const override;
LogicalFunction withInferredDataType(const Schema& schema) const override;
SerializableFunction serialize() const override;

private:
DataType dataType;
std::vector<LogicalFunction> parameters;
};

} // namespace NES
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
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

https://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 <Functions/LogicalFunction.hpp>
#include <string_view>
#include <utility>
#include <vector>

namespace NES {

/**
* @brief Per-event tfloat_tan: single-instant tfloat transform, value extracted -> double.
*
* Generated by tools/codegen/codegen_nebula.py from the MEOS function
* `tfloat_tan`. Per-event scalar operator following the
* TemporalEDWithinGeometry pattern.
*/
class TfloatTanLogicalFunction : public LogicalFunctionConcept {
public:
static constexpr std::string_view NAME = "TfloatTan";

TfloatTanLogicalFunction(LogicalFunction value,
LogicalFunction ts);

DataType getDataType() const override;
LogicalFunction withDataType(const DataType& dataType) const override;
std::vector<LogicalFunction> getChildren() const override;
LogicalFunction withChildren(const std::vector<LogicalFunction>& children) const override;
std::string_view getType() const override;
bool operator==(const LogicalFunctionConcept& rhs) const override;
std::string explain(ExplainVerbosity verbosity) const override;
LogicalFunction withInferredDataType(const Schema& schema) const override;
SerializableFunction serialize() const override;

private:
DataType dataType;
std::vector<LogicalFunction> parameters;
};

} // namespace NES
3 changes: 3 additions & 0 deletions nes-logical-operators/src/Functions/Meos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ add_plugin(TemporalAIntersectsGeometry LogicalFunction nes-logical-operators Tem
add_plugin(TemporalEContainsGeometry LogicalFunction nes-logical-operators TemporalEContainsGeometryLogicalFunction.cpp)
add_plugin(TemporalEDWithinGeometry LogicalFunction nes-logical-operators TemporalEDWithinGeometryLogicalFunction.cpp)
add_plugin(TemporalAtStBox LogicalFunction nes-logical-operators TemporalAtStBoxLogicalFunction.cpp)
add_plugin(TfloatCos LogicalFunction nes-logical-operators TfloatCosLogicalFunction.cpp)
add_plugin(TfloatSin LogicalFunction nes-logical-operators TfloatSinLogicalFunction.cpp)
add_plugin(TfloatTan LogicalFunction nes-logical-operators TfloatTanLogicalFunction.cpp)
102 changes: 102 additions & 0 deletions nes-logical-operators/src/Functions/Meos/TfloatCosLogicalFunction.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
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

https://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 <Functions/Meos/TfloatCosLogicalFunction.hpp>

#include <DataTypes/DataType.hpp>
#include <DataTypes/DataTypeProvider.hpp>
#include <DataTypes/Schema.hpp>
#include <ErrorHandling.hpp>
#include <LogicalFunctionRegistry.hpp>
#include <Serialization/DataTypeSerializationUtil.hpp>
#include <fmt/format.h>
#include <SerializableVariantDescriptor.pb.h>

namespace NES
{

TfloatCosLogicalFunction::TfloatCosLogicalFunction(LogicalFunction value,
LogicalFunction ts)
: dataType(DataTypeProvider::provideDataType(DataType::Type::FLOAT64))
{
parameters.reserve(2);
parameters.push_back(std::move(value));
parameters.push_back(std::move(ts));
}

DataType TfloatCosLogicalFunction::getDataType() const { return dataType; }

LogicalFunction TfloatCosLogicalFunction::withDataType(const DataType& newDataType) const
{
auto copy = *this; copy.dataType = newDataType; return copy;
}

std::vector<LogicalFunction> TfloatCosLogicalFunction::getChildren() const { return parameters; }

LogicalFunction TfloatCosLogicalFunction::withChildren(const std::vector<LogicalFunction>& children) const
{
PRECONDITION(children.size() == 2, "TfloatCosLogicalFunction requires 2 children, but got {}", children.size());
auto copy = *this; copy.parameters = children; return copy;
}

std::string_view TfloatCosLogicalFunction::getType() const { return NAME; }

bool TfloatCosLogicalFunction::operator==(const LogicalFunctionConcept& rhs) const
{
if (const auto* other = dynamic_cast<const TfloatCosLogicalFunction*>(&rhs))
return parameters == other->parameters;
return false;
}

std::string TfloatCosLogicalFunction::explain(ExplainVerbosity verbosity) const
{
std::string args;
for (size_t index = 0; index < parameters.size(); ++index) {
if (index > 0) args += ", ";
args += parameters[index].explain(verbosity);
}
return fmt::format("{}({})", NAME, args);
}

LogicalFunction TfloatCosLogicalFunction::withInferredDataType(const Schema& schema) const
{
std::vector<LogicalFunction> newChildren;
newChildren.reserve(parameters.size());
for (const auto& child : parameters)
newChildren.emplace_back(child.withInferredDataType(schema));
return withChildren(newChildren);
}

SerializableFunction TfloatCosLogicalFunction::serialize() const
{
SerializableFunction proto;
proto.set_function_type(std::string(NAME));
DataTypeSerializationUtil::serializeDataType(dataType, proto.mutable_data_type());
for (const auto& child : parameters)
proto.add_children()->CopyFrom(child.serialize());
return proto;
}

LogicalFunctionRegistryReturnType LogicalFunctionGeneratedRegistrar::RegisterTfloatCosLogicalFunction(
LogicalFunctionRegistryArguments arguments)
{
PRECONDITION(arguments.children.size() == 2,
"TfloatCosLogicalFunction requires 2 children but got {}",
arguments.children.size());
auto arg0 = std::move(arguments.children[0]);
auto arg1 = std::move(arguments.children[1]);
return TfloatCosLogicalFunction(std::move(arg0), std::move(arg1));
}

} // namespace NES
Loading
Loading