Skip to content

Commit

Permalink
docs: add java doc (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengjiachun authored Jan 12, 2024
1 parent 4d2e2ce commit 84e9390
Showing 1 changed file with 29 additions and 2 deletions.
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

0 comments on commit 84e9390

Please sign in to comment.