Kudu C++ client API
Loading...
Searching...
No Matches
kudu::client::KuduSchema Class Reference

A representation of a table's schema. More...

#include <schema.h>

Public Member Functions

 KuduSchema (const KuduSchema &other)
Status Reset (const std::vector< KuduColumnSchema > &columns, int key_columns) WARN_UNUSED_RESULT
bool Equals (const KuduSchema &other) const
bool operator== (const KuduSchema &rhs) const
bool operator!= (const KuduSchema &rhs) const
KuduColumnSchema Column (size_t idx) const
bool HasColumn (const std::string &col_name, KuduColumnSchema *col_schema) const
size_t num_columns () const
void GetPrimaryKeyColumnIndexes (std::vector< int > *indexes) const
int GetAutoIncrementingColumnIndex () const
KuduPartialRowNewRow () const
std::string ToString () const
Assign/copy the schema
KuduSchemaoperator= (const KuduSchema &other)
void CopyFrom (const KuduSchema &other)

Static Public Member Functions

static const char *const GetAutoIncrementingColumnName ()

Detailed Description

A representation of a table's schema.

Constructor & Destructor Documentation

◆ KuduSchema()

kudu::client::KuduSchema::KuduSchema ( const KuduSchema & other)

Create a KuduSchema object as a copy of the other one.

Parameters
[in]otherThe other KuduSchema object to use as a reference.

Member Function Documentation

◆ Column()

KuduColumnSchema kudu::client::KuduSchema::Column ( size_t idx) const
Parameters
[in]idxColumn index.
Returns
Schema for the specified column.

◆ CopyFrom()

void kudu::client::KuduSchema::CopyFrom ( const KuduSchema & other)
Parameters
[in]otherThe source KuduSchema object to use as a reference.

◆ Equals()

bool kudu::client::KuduSchema::Equals ( const KuduSchema & other) const

Check whether the schema is identical to the other one.

Deprecated
use operator==(const KuduSchema&) instead
Parameters
[in]otherThe other KuduSchema object to compare with.
Returns
true iff this KuduSchema object is identical to the specified one.

◆ GetAutoIncrementingColumnIndex()

int kudu::client::KuduSchema::GetAutoIncrementingColumnIndex ( ) const

Get the index of the auto incrementing column within this Schema.

Attention
In current versions of Kudu, key column indexes will always be contiguous indexes starting with 0. The auto incrementing column is always the last key column. However, in future versions this assumption may not hold, so callers should not assume it is the case.
Returns
The index of the auto incrementing column. If the column does not exist the return value is -1.

◆ GetAutoIncrementingColumnName()

const char *const kudu::client::KuduSchema::GetAutoIncrementingColumnName ( )
static

Utility function to return the actual name of the auto incrementing column.

Returns
The name of the auto incrementing column.

◆ GetPrimaryKeyColumnIndexes()

void kudu::client::KuduSchema::GetPrimaryKeyColumnIndexes ( std::vector< int > * indexes) const

Get the indexes of the primary key columns within this Schema.

Attention
In current versions of Kudu, these will always be contiguous column indexes starting with 0. However, in future versions this assumption may not hold, so callers should not assume it is the case.
Parameters
[out]indexesThe placeholder for the result.

◆ HasColumn()

bool kudu::client::KuduSchema::HasColumn ( const std::string & col_name,
KuduColumnSchema * col_schema ) const
Parameters
[in]col_nameColumn name.
[out]col_schemaIf not null pointer, then the schema for the specified column.
Returns
true iff the specified column exists.

◆ NewRow()

KuduPartialRow * kudu::client::KuduSchema::NewRow ( ) const

Create a new row corresponding to this schema.

Note
The new row refers to this KuduSchema object, so it must be destroyed before the KuduSchema object to avoid dangling pointers.
Returns
A pointer to the newly created row. The caller takes ownership of the created row.

◆ num_columns()

size_t kudu::client::KuduSchema::num_columns ( ) const
Returns
The number of columns in the schema.

◆ operator!=()

bool kudu::client::KuduSchema::operator!= ( const KuduSchema & rhs) const

Check whether the schema is not identical to the other one.

Parameters
[in]rhsKuduSchema object to compare this one with.
Returns
true iff this KuduSchema object is not identical to the specified one.

◆ operator=()

KuduSchema & kudu::client::KuduSchema::operator= ( const KuduSchema & other)
Parameters
[in]otherThe source KuduSchema object to use as a reference.
Returns
Copy of 'other'

◆ operator==()

bool kudu::client::KuduSchema::operator== ( const KuduSchema & rhs) const

Check whether the schema is identical to the other one.

Parameters
[in]rhsKuduSchema object to compare this one with.
Returns
true iff this KuduSchema object is identical to the specified one.

◆ Reset()

Status kudu::client::KuduSchema::Reset ( const std::vector< KuduColumnSchema > & columns,
int key_columns )
Deprecated
This method will be removed soon.
Todo
Remove KuduSchema::Reset().
Note
KuduSchema::Reset() is deprecated API. It does not support non-unique primary key and does not add auto incrementing column.
Parameters
[in]columnsPer-column schema information.
[in]key_columnsNumber of key columns in the schema.
Returns
Operation result status.

◆ ToString()

std::string kudu::client::KuduSchema::ToString ( ) const

Stringify this KuduSchema.

Returns
A string describing this schema.

The documentation for this class was generated from the following file: