Skip to content

Commit dbaaf99

Browse files
refactor: change warning message
1 parent 547c87e commit dbaaf99

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public static BigInteger convert(final Instant instant, final WritePrecision pre
126126
* @param field the arrow field metadata
127127
* @return the time in nanosecond
128128
*/
129+
@Nullable
129130
public static BigInteger getTimestampNano(@Nonnull final Object value, @Nonnull final Field field) {
130131
BigInteger result = null;
131132

@@ -162,7 +163,8 @@ public static BigInteger getTimestampNano(@Nonnull final Object value, @Nonnull
162163
return result;
163164
}
164165

165-
private static BigInteger convertInstantToNano(final Instant instant) {
166+
@Nullable
167+
private static BigInteger convertInstantToNano(@Nonnull final Instant instant) {
166168
var writePrecision = WritePrecision.NS;
167169
BigInteger convertedTime = NanosecondConverter.convert(instant, writePrecision);
168170
return NanosecondConverter.convertToNanos(convertedTime, writePrecision);

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ PointValues toPointValues(final int rowNumber,
111111
*
112112
* @param field the Field object from Arrow
113113
* @param value the value to cast
114-
* @return the casted value
114+
* @return the value with the correct type
115115
*/
116116
public Object getMappedValue(@Nonnull final Field field, @Nullable final Object value) {
117117
if (value == null) {
@@ -141,28 +141,28 @@ public Object getMappedValue(@Nonnull final Field field, @Nullable final Object
141141
if (value instanceof Number) {
142142
return TypeCasting.toLongValue(value);
143143
} else {
144-
LOG.warning(String.format("Value of %s is not an Integer", fieldName));
144+
LOG.warning(String.format("Value %s is not an Long", value));
145145
return value;
146146
}
147147
case "iox::column_type::field::float":
148148
if (value instanceof Number) {
149149
return TypeCasting.toDoubleValue(value);
150150
} else {
151-
LOG.warning(String.format("Value of %s is not a Double", fieldName));
151+
LOG.warning(String.format("Value %s is not a Double", value));
152152
return value;
153153
}
154154
case "iox::column_type::field::string":
155155
if (value instanceof Text || value instanceof String) {
156156
return TypeCasting.toStringValue(value);
157157
} else {
158-
LOG.warning(String.format("Value of %s is not a String", fieldName));
158+
LOG.warning(String.format("Value %s is not a String", value));
159159
return value;
160160
}
161161
case "iox::column_type::field::boolean":
162162
if (value instanceof Boolean) {
163-
return (Boolean) value;
163+
return value;
164164
} else {
165-
LOG.warning(String.format("Value of %s is not a Boolean", fieldName));
165+
LOG.warning(String.format("Value %s is not a Boolean", value));
166166
return value;
167167
}
168168
default:
@@ -180,18 +180,19 @@ public Object getMappedValue(@Nonnull final Field field, @Nullable final Object
180180
*
181181
* @param vector The data return from InfluxDB.
182182
* @param rowNumber The row number of data
183-
* @return An array of Objects represent for a row of data
183+
* @return An array of Objects represents a row of data
184184
*/
185-
public Object[] getArrayObjectFromVectorSchemaRoot(final VectorSchemaRoot vector, final int rowNumber) {
186-
List<Object> row = new ArrayList<>();
187-
for (FieldVector fieldVector : vector.getFieldVectors()) {
188-
var value = getMappedValue(
185+
public Object[] getArrayObjectFromVectorSchemaRoot(@Nonnull final VectorSchemaRoot vector, final int rowNumber) {
186+
int columnSize = vector.getFieldVectors().size();
187+
var row = new Object[columnSize];
188+
for (int i = 0; i < columnSize; i++) {
189+
FieldVector fieldVector = vector.getVector(i);
190+
row[i] = getMappedValue(
189191
fieldVector.getField(),
190192
fieldVector.getObject(rowNumber)
191193
);
192-
row.add(value);
193194
}
194195

195-
return row.toArray();
196+
return row;
196197
}
197198
}

0 commit comments

Comments
 (0)