public class TableSchema extends Object
For optimal performance, it is recommended to cache and reuse the same TableSchema
instance
when writing data multiple times. The caching responsibility is delegated to the user since
the Ingester
client aims to minimize memory overhead by avoiding cache management.
Example usage:
TableSchema schema = TableSchema.newBuilder("my_table")
.addTag("tag1", DataType.String)
.addTimestamp("ts", DataType.TimestampMillisecond)
.addField("field1", DataType.Float64)
.build();
Table table = Table.from(schema);
// The order of the values must match the schema definition.
table.addRow(tag_value_1, now, field_value_1);
table.addRow(tag_value_2, now, field_value_2);
table.complete();
Modifier and Type | Class and Description |
---|---|
static class |
TableSchema.Builder |
Modifier and Type | Method and Description |
---|---|
List<String> |
getColumnNames() |
List<io.greptime.v1.Common.ColumnDataTypeExtension> |
getDataTypeExtensions() |
List<io.greptime.v1.Common.ColumnDataType> |
getDataTypes() |
List<io.greptime.v1.Common.SemanticType> |
getSemanticTypes() |
String |
getTableName() |
static TableSchema.Builder |
newBuilder(String tableName) |
public String getTableName()
public List<io.greptime.v1.Common.SemanticType> getSemanticTypes()
public List<io.greptime.v1.Common.ColumnDataType> getDataTypes()
public List<io.greptime.v1.Common.ColumnDataTypeExtension> getDataTypeExtensions()
public static TableSchema.Builder newBuilder(String tableName)
Copyright © 2025. All rights reserved.