|
NebulaStream
0.6.213
NebulaStream is a data and application management framework for the internet of things
|
#include <Schema.hpp>
Public Types | |
| enum class | MemoryLayoutType : uint8_t { ROW_LAYOUT = 0 , COLUMNAR_LAYOUT = 1 } |
| Enum to identify the memory layout in which we want to represent the schema physically. More... | |
Public Member Functions | |
| Schema (MemoryLayoutType layoutType=MemoryLayoutType::ROW_LAYOUT) | |
| Schema (SchemaPtr const &query, MemoryLayoutType layoutType=MemoryLayoutType::ROW_LAYOUT) | |
| SchemaPtr | updateSourceName (const std::string &srcName) const |
| Prepends the srcName to the substring after the last occurrence of ATTRIBUTE_NAME_SEPARATOR in every field name of the schema. More... | |
| SchemaPtr | copy () const |
| Creates a copy of this schema. More... | |
| SchemaPtr | copyFields (const SchemaPtr &otherSchema) |
| Copy all fields of otherSchema into this schema. More... | |
| SchemaPtr | addField (const AttributeFieldPtr &attribute) |
| appends a AttributeField to the schema and returns a copy of this schema. More... | |
| SchemaPtr | addField (const std::string &name, const BasicType &type) |
| appends a field with a basic type to the schema and returns a copy of this schema. More... | |
| SchemaPtr | addField (const std::string &name, DataTypePtr data) |
| appends a field with a data type to the schema and returns a copy of this schema. More... | |
| void | removeField (const AttributeFieldPtr &field) |
| removes a AttributeField from the schema More... | |
| void | replaceField (const std::string &name, const DataTypePtr &type) |
| Replaces a field, which is already part of the schema. More... | |
| AttributeFieldPtr | getField (const std::string &fieldName) const |
| Returns the attribute field based on a qualified or unqualified field name. More... | |
| uint64_t | getIndex (const std::string &fieldName) const |
| Checks if attribute field name is defined in the schema and returns its index. If item not in the list, then the return value is equal to fields.size(). More... | |
| AttributeFieldPtr | get (const std::string &fieldName) const |
| Finds a attribute field by name in the schema. More... | |
| AttributeFieldPtr | get (uint32_t index) |
| Finds a attribute field by index in the schema. More... | |
| uint64_t | getSize () const |
| Returns the number of fields in the schema. More... | |
| uint64_t | getSchemaSizeInBytes () const |
| Returns the number of bytes all fields in this schema occupy. More... | |
| bool | equals (const SchemaPtr &schema, bool considerOrder=true) |
| Checks if two Schemas are equal to each other. More... | |
| bool | hasEqualTypes (const SchemaPtr &otherSchema) |
| Checks if two schemas have same datatypes at same index location. More... | |
| bool | contains (const std::string &fieldName) const |
| Checks if the field exists in the schema. More... | |
| std::string | toString (const std::string &prefix="", const std::string &sep=" ", const std::string &suffix="") const |
| returns a string representation More... | |
| std::string | getLayoutTypeAsString () const |
| returns the string representation of layout More... | |
| std::string | getSourceNameQualifier () const |
| Method to return the source name qualifier, thus everything that is before $. More... | |
| std::string | getQualifierNameForSystemGeneratedFields () const |
| method to get the qualifier of the source without $ More... | |
| std::string | getQualifierNameForSystemGeneratedFieldsWithSeparator () const |
| method to get the qualifier of the source with $ More... | |
| void | clear () |
| Remove all fields and qualifying name. More... | |
| bool | empty () const |
| Is checks if the schema is empty (if it has no fields). More... | |
| MemoryLayoutType | getLayoutType () const |
| method to get the type of the memory layout More... | |
| void | setLayoutType (MemoryLayoutType layoutType) |
| method to set the memory layout More... | |
| std::vector< std::string > | getFieldNames () const |
| Get the field names as a vector of strings. More... | |
Static Public Member Functions | |
| static SchemaPtr | create (MemoryLayoutType layoutType=MemoryLayoutType::ROW_LAYOUT) |
| Factory method to create a new SchemaPtr. More... | |
| static SchemaPtr | createFromSchemaType (const Configurations::SchemaTypePtr &schemaType, MemoryLayoutType layoutType=MemoryLayoutType::ROW_LAYOUT) |
| Factory method to create a new SchemaPtr from schema type. More... | |
Public Attributes | |
| std::vector< AttributeFieldPtr > | fields |
Static Public Attributes | |
| constexpr static const char *const | ATTRIBUTE_NAME_SEPARATOR = "$" |
| Schema qualifier separator. More... | |
|
strong |
|
explicit |
| NES::Schema::Schema | ( | SchemaPtr const & | query, |
| MemoryLayoutType | layoutType = MemoryLayoutType::ROW_LAYOUT |
||
| ) |
| SchemaPtr NES::Schema::addField | ( | const AttributeFieldPtr & | attribute | ) |
appends a AttributeField to the schema and returns a copy of this schema.
| attribute |
References copy(), and fields.
Referenced by addField().
appends a field with a basic type to the schema and returns a copy of this schema.
| field |
References addField(), NES::DataTypeFactory::createType(), and type.
| SchemaPtr NES::Schema::addField | ( | const std::string & | name, |
| DataTypePtr | data | ||
| ) |
appends a field with a data type to the schema and returns a copy of this schema.
| field |
References addField(), NES::AttributeField::create(), and data.
| void NES::Schema::clear | ( | ) |
Remove all fields and qualifying name.
References fields.
| bool NES::Schema::contains | ( | const std::string & | fieldName | ) | const |
| SchemaPtr NES::Schema::copy | ( | ) | const |
Creates a copy of this schema.
Referenced by addField(), copyFields(), and updateSourceName().
|
static |
Factory method to create a new SchemaPtr.
Referenced by NES::createDefaultSourceWithoutSchemaForOneBuffer(), createFromSchemaType(), NES::DistributedNemoJoinIntegrationTest::createTestHarness(), NES::QueryAPITest::SetUp(), NES::FilterPushDownTest::SetUp(), NES::UnionDeploymentTest::SetUp(), GPUQueryExecutionTest::SetUp(), NES::Runtime::Execution::CountMinBuildExecutionTest::SetUp(), NES::Runtime::Execution::HyperLogLogBuildExecutionTest::SetUp(), UnionQueryExecutionTest::SetUp(), WindowAggregationFunctionTest::SetUp(), NES::RequestProcessor::AddQueryRequestTest::SetUp(), NES::SourceTest::SetUp(), NES::TCPSourceTest::SetUp(), NES::DefaultStatisticQueryGeneratorTest::SetUp(), NES::Runtime::MemoryLayouts::DynamicMemoryLayoutTestParameterized::SetUp(), NES::Runtime::MemoryLayouts::TestTupleBufferTest::SetUp(), ColumnLayoutGPUPipelineStage::setup(), NES::StatisticIdsExtractorTest::setUpSourceCatalog(), NES::TEST_F(), NES::Runtime::MemoryLayouts::TEST_F(), TEST_F(), NES::Runtime::TEST_F(), NES::Spatial::TEST_F(), NES::Runtime::Execution::TEST_F(), NES::RequestProcessor::TEST_F(), NES::Runtime::Execution::TEST_P(), NES::TEST_P(), and TEST_P().
|
static |
Factory method to create a new SchemaPtr from schema type.
References create().
Referenced by NES::Monitoring::CpuMetrics::getSchema(), NES::Monitoring::DiskMetrics::getSchema(), NES::Monitoring::MemoryMetrics::getSchema(), NES::Monitoring::NetworkMetrics::getSchema(), NES::Monitoring::RegistrationMetrics::getSchema(), NES::Monitoring::RuntimeMetrics::getSchema(), and NES::NesCoordinator::startCoordinator().
| bool NES::Schema::empty | ( | ) | const |
| bool NES::Schema::equals | ( | const SchemaPtr & | schema, |
| bool | considerOrder = true |
||
| ) |
Checks if two Schemas are equal to each other.
| schema | |
| considerOrder | takes into account if the order of fields in a schema matter. |
References fields.
| AttributeFieldPtr NES::Schema::get | ( | const std::string & | fieldName | ) | const |
Finds a attribute field by name in the schema.
| fieldName |
References fields, and NES_FATAL_ERROR.
| AttributeFieldPtr NES::Schema::get | ( | uint32_t | index | ) |
Finds a attribute field by index in the schema.
| index |
References fields, index, and NES_FATAL_ERROR.
| AttributeFieldPtr NES::Schema::getField | ( | const std::string & | fieldName | ) | const |
Returns the attribute field based on a qualified or unqualified field name.
If an unqualified field name is given (e.g., getField("fieldName")), the function will match attribute fields with any source name. If a qualified field name is given (e.g., getField("source$fieldName")), the entire qualified field must match.
| fieldName | Name of the attribute field that should be returned. |
nullptr. References ATTRIBUTE_NAME_SEPARATOR, and fields.
| std::vector< std::string > NES::Schema::getFieldNames | ( | ) | const |
Get the field names as a vector of strings.
References fields.
| uint64_t NES::Schema::getIndex | ( | const std::string & | fieldName | ) | const |
Checks if attribute field name is defined in the schema and returns its index. If item not in the list, then the return value is equal to fields.size().
| fieldName |
References fields, and NES::startsWith().
| Schema::MemoryLayoutType NES::Schema::getLayoutType | ( | ) | const |
method to get the type of the memory layout
| std::string NES::Schema::getLayoutTypeAsString | ( | ) | const |
returns the string representation of layout
| layout |
References COLUMNAR_LAYOUT, and ROW_LAYOUT.
| std::string NES::Schema::getQualifierNameForSystemGeneratedFields | ( | ) | const |
method to get the qualifier of the source without $
References ATTRIBUTE_NAME_SEPARATOR, fields, magic_enum::detail::find(), and NES_ERROR.
Referenced by getQualifierNameForSystemGeneratedFieldsWithSeparator().
| std::string NES::Schema::getQualifierNameForSystemGeneratedFieldsWithSeparator | ( | ) | const |
method to get the qualifier of the source with $
References ATTRIBUTE_NAME_SEPARATOR, and getQualifierNameForSystemGeneratedFields().
| uint64_t NES::Schema::getSchemaSizeInBytes | ( | ) | const |
| uint64_t NES::Schema::getSize | ( | ) | const |
| std::string NES::Schema::getSourceNameQualifier | ( | ) | const |
Method to return the source name qualifier, thus everything that is before $.
References ATTRIBUTE_NAME_SEPARATOR, fields, and magic_enum::detail::find().
| bool NES::Schema::hasEqualTypes | ( | const SchemaPtr & | otherSchema | ) |
Checks if two schemas have same datatypes at same index location.
| otherSchema | the other schema to compare agains |
References fields.
| void NES::Schema::removeField | ( | const AttributeFieldPtr & | field | ) |
| void NES::Schema::replaceField | ( | const std::string & | name, |
| const DataTypePtr & | type | ||
| ) |
Replaces a field, which is already part of the schema.
| name | of the field we want to replace |
| DataTypePtr |
References NES::AttributeField::create(), fields, and type.
| void NES::Schema::setLayoutType | ( | Schema::MemoryLayoutType | layoutType | ) |
method to set the memory layout
| layoutType |
| std::string NES::Schema::toString | ( | const std::string & | prefix = "", |
| const std::string & | sep = " ", |
||
| const std::string & | suffix = "" |
||
| ) | const |
returns a string representation
| prefix | of the string |
| delimitor | between each field |
| suffix,for | the end of the string |
References fields.
| SchemaPtr NES::Schema::updateSourceName | ( | const std::string & | srcName | ) | const |
Prepends the srcName to the substring after the last occurrence of ATTRIBUTE_NAME_SEPARATOR in every field name of the schema.
| srcName |
References ATTRIBUTE_NAME_SEPARATOR, copy(), and fields.
|
staticconstexpr |
Schema qualifier separator.
Referenced by getField(), getQualifierNameForSystemGeneratedFields(), getQualifierNameForSystemGeneratedFieldsWithSeparator(), getSourceNameQualifier(), and updateSourceName().
| std::vector<AttributeFieldPtr> NES::Schema::fields |
Referenced by addField(), clear(), contains(), copyFields(), empty(), equals(), get(), getField(), getFieldNames(), getIndex(), getQualifierNameForSystemGeneratedFields(), getSchemaSizeInBytes(), getSize(), getSourceNameQualifier(), hasEqualTypes(), removeField(), replaceField(), toString(), and updateSourceName().