Kudu C++ client API
Public Member Functions | List of all members
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
 
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
 
KuduPartialRowNewRow () const
 
std::string ToString () const
 
Assign/copy the schema
Parameters
[in]otherThe source KuduSchema object to use as a reference.
KuduSchemaoperator= (const KuduSchema &other)
 
void CopyFrom (const KuduSchema &other)
 

Detailed Description

A representation of a table's schema.

Constructor & Destructor Documentation

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

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

Check whether the schema is identical to the other one.

Parameters
[in]otherThe other KuduSchema object to compare with.
Returns
true iff this KuduSchema object is identical to the specified one.
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.
bool kudu::client::KuduSchema::HasColumn ( const std::string &  col_name,
KuduColumnSchema col_schema 
) const
Parameters
[in]col_nameColumn name.
[out]col_schemaSchema for the specified column.
Returns
true iff the specified column exists.
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.
size_t kudu::client::KuduSchema::num_columns ( ) const
Returns
The number of columns in the schema.
Status kudu::client::KuduSchema::Reset ( const std::vector< KuduColumnSchema > &  columns,
int  key_columns 
)
Deprecated:
This method will be removed soon.
Todo:
Remove KuduSchema::Reset().
Parameters
[in]columnsPer-column schema information.
[in]key_columnsNumber of key columns in the schema.
Returns
Operation result status.
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: