Skip to content

Commit c5a963d

Browse files
authored
chore: add some comment about naming convention (#37)
1 parent cb8fa23 commit c5a963d

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

ingester-protocol/src/main/java/io/greptime/models/Column.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
@Target(ElementType.FIELD)
3030
public @interface Column {
3131

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

3441
boolean tag() default false;

ingester-protocol/src/main/java/io/greptime/models/TableSchema.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public Builder(String tableName) {
7777

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

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

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

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

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

147-
// trim leading and trailing spaces
167+
// Trim leading and trailing spaces
148168
name = name.trim();
149169

150170
this.columnNames.add(name);

ingester-protocol/src/test/java/io/greptime/options/GreptimeOptionsTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import io.greptime.limit.LimitedPolicy;
2121
import io.greptime.models.AuthInfo;
2222
import io.greptime.rpc.RpcOptions;
23+
import io.greptime.rpc.TlsOptions;
2324
import org.junit.Assert;
2425
import org.junit.Test;
2526
import java.util.List;
@@ -44,10 +45,12 @@ public void testAllOptions() {
4445
long routeTableRefreshPeriodSeconds = 99;
4546
AuthInfo authInfo = new AuthInfo("user", "password");
4647
Router<Void, Endpoint> router = createTestRouter();
48+
TlsOptions tlsOptions = new TlsOptions();
4749

4850
GreptimeOptions opts = GreptimeOptions.newBuilder(endpoints, database) //
4951
.asyncPool(asyncPool) //
5052
.rpcOptions(rpcOptions) //
53+
.tlsOptions(tlsOptions) //
5154
.writeMaxRetries(writeMaxRetries) //
5255
.maxInFlightWritePoints(maxInFlightWritePoints) //
5356
.writeLimitedPolicy(limitedPolicy) //
@@ -60,6 +63,7 @@ public void testAllOptions() {
6063
Assert.assertEquals(database, opts.getDatabase());
6164
Assert.assertArrayEquals(endpoints, opts.getEndpoints().stream().map(Endpoint::toString).toArray());
6265
Assert.assertEquals(rpcOptions, opts.getRpcOptions());
66+
Assert.assertEquals(tlsOptions, opts.getRpcOptions().getTlsOptions());
6367

6468
RouterOptions routerOptions = opts.getRouterOptions();
6569
Assert.assertNotNull(routerOptions);

ingester-rpc/src/main/java/io/greptime/rpc/RpcOptions.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package io.greptime.rpc;
1717

1818
import io.greptime.common.Copiable;
19-
import java.util.Optional;
2019
import java.util.concurrent.TimeUnit;
2120

2221
/**

0 commit comments

Comments
 (0)