Class SchemaObj
Defined in File datasets.h
Class Documentation
-
class SchemaObj
A schema object to set column type, data type and data shape.
Public Functions
-
inline explicit SchemaObj(const std::string &schema_file = "")
Constructor.
-
~SchemaObj() = default
Destructor.
-
inline Status add_column(const std::string &name, mindspore::DataType ms_type)
Add new column to the schema with unknown shape of rank 1.
- Parameters
name – [in] Name of the column.
ms_type – [in] Data type of the column(mindspore::DataType).
- Returns
Status code
-
inline Status add_column(const std::string &name, const std::string &ms_type)
Add new column to the schema with unknown shape of rank 1.
- Parameters
name – [in] Name of the column.
ms_type – [in] Data type of the column(std::string).
shape – [in] Shape of the column.
- Returns
Status code
-
inline Status add_column(const std::string &name, mindspore::DataType ms_type, const std::vector<int32_t> &shape)
Add new column to the schema.
- Parameters
name – [in] Name of the column.
ms_type – [in] Data type of the column(mindspore::DataType).
shape – [in] Shape of the column.
- Returns
Status code
-
inline Status add_column(const std::string &name, const std::string &ms_type, const std::vector<int32_t> &shape)
Add new column to the schema.
- Parameters
name – [in] Name of the column.
ms_type – [in] Data type of the column(std::string).
shape – [in] Shape of the column.
- Returns
Status code
-
inline std::string to_json()
Get a JSON string of the schema.
- Returns
JSON string of the schema
-
inline std::string to_string()
Get a JSON string of the schema.
-
void set_dataset_type(std::string dataset_type)
Set a new value to dataset_type.
-
void set_num_rows(int32_t num_rows)
Set a new value to num_rows.
-
int32_t get_num_rows() const
Get the current num_rows.
-
Status from_json(nlohmann::json json_obj)
Get schema file from JSON file.
- Parameters
json_obj – [in] parsed JSON object
- Returns
Status code
-
inline Status FromJSONString(const std::string &json_string)
Get schema file from JSON file.
- Parameters
json_string – [in] Name of JSON file to be parsed.
- Returns
Status code
-
inline Status ParseColumnString(const std::string &json_string)
Parse and add column information.
- Parameters
json_string – [in] Name of JSON string for column dataset attribute information, decoded from schema file.
- Returns
Status code
-
inline explicit SchemaObj(const std::string &schema_file = "")