Schema¶
The schema of a row or table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schema |
Map<String, ColumnType> |
- | - |
Stub code in Schema.sdsstub
columnCount¶
The number of columns.
Type: Int
columnNames¶
The names of the columns.
Type: List<String>
getColumnType¶
Get the type of a column.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
String |
The name of the column. | - |
Results:
| Name | Type | Description |
|---|---|---|
type |
ColumnType |
The type of the column. |
Examples:
pipeline example {
val schema = Schema({"a": ColumnType.int64(), "b": ColumnType.float32()});
out schema.getColumnType("a");
// int64
out schema.getColumnType("b");
// float32
}
Stub code in Schema.sdsstub
hasColumn¶
Check if the schema has a column with a specific name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name |
String |
The name of the column. | - |
Results:
| Name | Type | Description |
|---|---|---|
hasColumn |
Boolean |
Whether the schema has a column with the specified name. |
Examples:
pipeline example {
val schema = Schema({"a": ColumnType.int64(), "b": ColumnType.float32()});
out schema.hasColumn("a");
// true
out schema.hasColumn("c");
// false
}
Stub code in Schema.sdsstub
toMap¶
Return a map from column names to column types.
Results:
| Name | Type | Description |
|---|---|---|
data |
Map<String, ColumnType> |
The map representation of the schema. |
Examples: