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

chore: add some comment about naming convention #37

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
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 @@ -29,6 +29,13 @@
@Target(ElementType.FIELD)
public @interface Column {

/**
* The name of the column in the table.
* <p>
* It is strongly recommended to use snake case naming convention and avoid
* using camel case. This is because GreptimeDB treats column names as
* case-insensitive, which can cause confusion when querying with camel case.
*/
String name();

boolean tag() default false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ public Builder(String tableName) {

/**
* Add tag schema.
* <p>
* It is strongly recommended to use snake case naming convention and avoid
* using camel case. This is because GreptimeDB treats column names as
* case-insensitive, which can cause confusion when querying with camel case.
*
* @param name the name of this tag
* @param dataType the data type of this tag
Expand All @@ -88,6 +92,10 @@ public Builder addTag(String name, DataType dataType) {

/**
* Add timestamp schema.
* <p>
* It is strongly recommended to use snake case naming convention and avoid
* using camel case. This is because GreptimeDB treats column names as
* case-insensitive, which can cause confusion when querying with camel case.
*
* @param name the name of this timestamp
* @param dataType the data type of this timestamp
Expand All @@ -101,6 +109,10 @@ public Builder addTimestamp(String name, DataType dataType) {

/**
* Add field schema.
* <p>
* It is strongly recommended to use snake case naming convention and avoid
* using camel case. This is because GreptimeDB treats column names as
* case-insensitive, which can cause confusion when querying with camel case.
*
* @param name the name of this field
* @param dataType the data type of this field
Expand All @@ -112,6 +124,10 @@ public Builder addField(String name, DataType dataType) {

/**
* Add column schema.
* <p>
* It is strongly recommended to use snake case naming convention and avoid
* using camel case. This is because GreptimeDB treats column names as
* case-insensitive, which can cause confusion when querying with camel case.
*
* @param name the name of this column
* @param semanticType the semantic type of this column (`Tag`, `Field` or `Timestamp`)
Expand All @@ -124,6 +140,10 @@ public Builder addColumn(String name, SemanticType semanticType, DataType dataTy

/**
* Add column schema.
* <p>
* It is strongly recommended to use snake case naming convention and avoid
* using camel case. This is because GreptimeDB treats column names as
* case-insensitive, which can cause confusion when querying with camel case.
*
* @param name the name of this column
* @param semanticType the semantic type of this column (`Tag`, `Field` or `Timestamp`)
Expand All @@ -144,7 +164,7 @@ public Builder addColumn(String name, //
"Invalid timestamp data type: %s, only support `DataType.TimestampXXX`", dataType);
}

// trim leading and trailing spaces
// Trim leading and trailing spaces
name = name.trim();

this.columnNames.add(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import io.greptime.limit.LimitedPolicy;
import io.greptime.models.AuthInfo;
import io.greptime.rpc.RpcOptions;
import io.greptime.rpc.TlsOptions;
import org.junit.Assert;
import org.junit.Test;
import java.util.List;
Expand All @@ -44,10 +45,12 @@ public void testAllOptions() {
long routeTableRefreshPeriodSeconds = 99;
AuthInfo authInfo = new AuthInfo("user", "password");
Router<Void, Endpoint> router = createTestRouter();
TlsOptions tlsOptions = new TlsOptions();

GreptimeOptions opts = GreptimeOptions.newBuilder(endpoints, database) //
.asyncPool(asyncPool) //
.rpcOptions(rpcOptions) //
.tlsOptions(tlsOptions) //
.writeMaxRetries(writeMaxRetries) //
.maxInFlightWritePoints(maxInFlightWritePoints) //
.writeLimitedPolicy(limitedPolicy) //
Expand All @@ -60,6 +63,7 @@ public void testAllOptions() {
Assert.assertEquals(database, opts.getDatabase());
Assert.assertArrayEquals(endpoints, opts.getEndpoints().stream().map(Endpoint::toString).toArray());
Assert.assertEquals(rpcOptions, opts.getRpcOptions());
Assert.assertEquals(tlsOptions, opts.getRpcOptions().getTlsOptions());

RouterOptions routerOptions = opts.getRouterOptions();
Assert.assertNotNull(routerOptions);
Expand Down
1 change: 0 additions & 1 deletion ingester-rpc/src/main/java/io/greptime/rpc/RpcOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package io.greptime.rpc;

import io.greptime.common.Copiable;
import java.util.Optional;
import java.util.concurrent.TimeUnit;

/**
Expand Down
Loading