Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add java doc for TableSchema #21

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@
import java.util.List;

/**
* Table schema for write.
*
* Table schema for write data to the database.
* <p>
* If the same `TableSchema` will be used multiple times, it is advisable to cache it
* to prevent redundant creation. The responsibility of caching lies with the user,
* as the `Ingester` client should strive to avoid managing the cache and excessive
* memory consumption.
*
* @author jiachun.fjc
*/
public class TableSchema {
Expand Down Expand Up @@ -70,10 +75,27 @@ public Builder(String tableName) {
this.tableName = tableName;
}

/**
* Add column schema.
*
* @param name the name of this column
* @param semanticType the semantic type of this column (`Tag`, `Field` or `Timestamp`)
* @param dataType the data type of this column
* @return this builder
*/
public Builder addColumn(String name, SemanticType semanticType, DataType dataType) {
return addColumn(name, semanticType, dataType, null);
}

/**
* Add column schema.
*
* @param name the name of this column
* @param semanticType the semantic type of this column (`Tag`, `Field` or `Timestamp`)
* @param dataType the data type of this column
* @param decimalTypeExtension the decimal type extension of this column(only for `DataType.Decimal128`)
* @return this builder
*/
public Builder addColumn(String name, SemanticType semanticType, DataType dataType,
DataType.DecimalTypeExtension decimalTypeExtension) {
Ensures.ensureNonNull(name, "Null column name");
Expand All @@ -95,6 +117,11 @@ public Builder addColumn(String name, SemanticType semanticType, DataType dataTy
return this;
}

/**
* Build the table schema.
*
* @return the table schema
*/
public TableSchema build() {
Ensures.ensureNonNull(this.tableName, "Null table name");
Ensures.ensureNonNull(this.columnNames, "Null column names");
Expand Down
Loading