Skip to content

Commit 95a29cb

Browse files
chore: add javadoc for getTimestampNano function
1 parent 7d35ff0 commit 95a29cb

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/main/java/com/influxdb/v3/client/internal/NanosecondConverter.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,19 @@ public static BigInteger convert(final Instant instant, final WritePrecision pre
119119
return FROM_NANOS.get(precision).apply(nanos);
120120
}
121121

122-
public static BigInteger getTimestampNano(@Nonnull final Object value, @Nonnull final Field schema) {
122+
/**
123+
* Convert Long or LocalDateTime to timestamp nanosecond
124+
*
125+
* @param value the time in Long or LocalDateTime
126+
* @param field the arrow field metadata
127+
* @return the time in nanosecond
128+
*/
129+
public static BigInteger getTimestampNano(@Nonnull final Object value, @Nonnull final Field field) {
123130
BigInteger result = null;
124131

125132
if (value instanceof Long) {
126-
if (schema.getFieldType().getType() instanceof ArrowType.Timestamp) {
127-
ArrowType.Timestamp type = (ArrowType.Timestamp) schema.getFieldType().getType();
133+
if (field.getFieldType().getType() instanceof ArrowType.Timestamp) {
134+
ArrowType.Timestamp type = (ArrowType.Timestamp) field.getFieldType().getType();
128135
TimeUnit timeUnit;
129136
switch (type.getUnit()) {
130137
case SECOND:
@@ -136,8 +143,8 @@ public static BigInteger getTimestampNano(@Nonnull final Object value, @Nonnull
136143
case MICROSECOND:
137144
timeUnit = TimeUnit.MICROSECONDS;
138145
break;
139-
default:
140146
case NANOSECOND:
147+
default:
141148
timeUnit = TimeUnit.NANOSECONDS;
142149
break;
143150
}

0 commit comments

Comments
 (0)