Skip to content

Commit

Permalink
GH-38930: [Java] Fix spelling (#38931)
Browse files Browse the repository at this point in the history
### Rationale for this change

### What changes are included in this PR?

Spelling fixes to java/

### Are these changes tested?

### Are there any user-facing changes?

* Closes: #38930

Authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
  • Loading branch information
jsoref committed Dec 14, 2023
1 parent 3236c12 commit cf1b265
Show file tree
Hide file tree
Showing 53 changed files with 112 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public class AvroToArrow {
*/
static VectorSchemaRoot avroToArrow(Schema schema, Decoder decoder, AvroToArrowConfig config)
throws IOException {
Preconditions.checkNotNull(schema, "Avro schema object can not be null");
Preconditions.checkNotNull(decoder, "Avro decoder object can not be null");
Preconditions.checkNotNull(config, "config can not be null");
Preconditions.checkNotNull(schema, "Avro schema object cannot be null");
Preconditions.checkNotNull(decoder, "Avro decoder object cannot be null");
Preconditions.checkNotNull(config, "config cannot be null");

return AvroToArrowUtils.avroToArrowVectors(schema, decoder, config);
}
Expand All @@ -58,9 +58,9 @@ public static AvroToArrowVectorIterator avroToArrowIterator(
Decoder decoder,
AvroToArrowConfig config) throws IOException {

Preconditions.checkNotNull(schema, "Avro schema object can not be null");
Preconditions.checkNotNull(decoder, "Avro decoder object can not be null");
Preconditions.checkNotNull(config, "config can not be null");
Preconditions.checkNotNull(schema, "Avro schema object cannot be null");
Preconditions.checkNotNull(decoder, "Avro decoder object cannot be null");
Preconditions.checkNotNull(config, "config cannot be null");

return AvroToArrowVectorIterator.create(decoder, schema, config);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class ArrowVectorIterator implements Iterator<VectorSchemaRoot>, AutoClos

private final int targetBatchSize;

// This is used to track whether the ResultSet has been fully read, and is needed spcifically for cases where there
// This is used to track whether the ResultSet has been fully read, and is needed specifically for cases where there
// is a ResultSet having zero rows (empty):
private boolean readComplete = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public JdbcFieldInfo(ResultSetMetaData rsmd, int column) throws SQLException {

/**
* Builds a <code>JdbcFieldInfo</code> from the corresponding row from a {@link java.sql.DatabaseMetaData#getColumns}
* ResulSet.
* ResultSet.
*
* @param rs The {@link java.sql.ResultSet} to get the field information from.
* @throws SQLException If the column information cannot be retrieved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static ArrowVectorIterator sqlToArrowVectorIterator(
ResultSet resultSet,
BufferAllocator allocator)
throws SQLException, IOException {
Preconditions.checkNotNull(allocator, "Memory Allocator object can not be null");
Preconditions.checkNotNull(allocator, "Memory Allocator object cannot be null");

JdbcToArrowConfig config =
new JdbcToArrowConfig(allocator, JdbcToArrowUtils.getUtcCalendar());
Expand All @@ -96,7 +96,7 @@ public static ArrowVectorIterator sqlToArrowVectorIterator(
ResultSet resultSet,
JdbcToArrowConfig config)
throws SQLException, IOException {
Preconditions.checkNotNull(resultSet, "JDBC ResultSet object can not be null");
Preconditions.checkNotNull(resultSet, "JDBC ResultSet object cannot be null");
Preconditions.checkNotNull(config, "The configuration cannot be null");
return ArrowVectorIterator.create(resultSet, config);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public final class JdbcToArrowConfig {
* @param reuseVectorSchemaRoot Whether to reuse the vector schema root for each data load.
* @param arraySubTypesByColumnIndex The type of the JDBC array at the column index (1-based).
* @param arraySubTypesByColumnName The type of the JDBC array at the column name.
* @param targetBatchSize The target batch size to be used in preallcation of the resulting vectors.
* @param targetBatchSize The target batch size to be used in preallocation of the resulting vectors.
* @param jdbcToArrowTypeConverter The function that maps JDBC field type information to arrow type. If set to null,
* the default mapping will be used, which is defined as:
* <ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public static Object[][] prepareTestData(String[] testFiles, @SuppressWarnings("
*/
public VectorSchemaRoot sqlToArrow(Connection connection, String query, BufferAllocator allocator)
throws SQLException, IOException {
Preconditions.checkNotNull(allocator, "Memory allocator object can not be null");
Preconditions.checkNotNull(allocator, "Memory allocator object cannot be null");

JdbcToArrowConfig config = new JdbcToArrowConfigBuilder(allocator, JdbcToArrowUtils.getUtcCalendar())
.setArraySubTypeByColumnNameMap(ARRAY_SUB_TYPE_BY_COLUMN_NAME_MAP)
Expand Down Expand Up @@ -212,8 +212,8 @@ public VectorSchemaRoot sqlToArrow(
BufferAllocator allocator,
Calendar calendar) throws SQLException, IOException {

Preconditions.checkNotNull(allocator, "Memory allocator object can not be null");
Preconditions.checkNotNull(calendar, "Calendar object can not be null");
Preconditions.checkNotNull(allocator, "Memory allocator object cannot be null");
Preconditions.checkNotNull(calendar, "Calendar object cannot be null");

JdbcToArrowConfig config = new JdbcToArrowConfigBuilder(allocator, calendar)
.setArraySubTypeByColumnNameMap(ARRAY_SUB_TYPE_BY_COLUMN_NAME_MAP)
Expand All @@ -237,8 +237,8 @@ public VectorSchemaRoot sqlToArrow(
*/
public static VectorSchemaRoot sqlToArrow(Connection connection, String query, JdbcToArrowConfig config)
throws SQLException, IOException {
Preconditions.checkNotNull(connection, "JDBC connection object can not be null");
Preconditions.checkArgument(query != null && query.length() > 0, "SQL query can not be null or empty");
Preconditions.checkNotNull(connection, "JDBC connection object cannot be null");
Preconditions.checkArgument(query != null && query.length() > 0, "SQL query cannot be null or empty");

try (Statement stmt = connection.createStatement()) {
return sqlToArrow(stmt.executeQuery(query), config);
Expand All @@ -256,7 +256,7 @@ public static VectorSchemaRoot sqlToArrow(Connection connection, String query, J
* @throws SQLException on error
*/
public static VectorSchemaRoot sqlToArrow(ResultSet resultSet) throws SQLException, IOException {
Preconditions.checkNotNull(resultSet, "JDBC ResultSet object can not be null");
Preconditions.checkNotNull(resultSet, "JDBC ResultSet object cannot be null");

return sqlToArrow(resultSet, JdbcToArrowUtils.getUtcCalendar());
}
Expand All @@ -273,7 +273,7 @@ public static VectorSchemaRoot sqlToArrow(ResultSet resultSet) throws SQLExcepti
*/
public static VectorSchemaRoot sqlToArrow(ResultSet resultSet, BufferAllocator allocator)
throws SQLException, IOException {
Preconditions.checkNotNull(allocator, "Memory Allocator object can not be null");
Preconditions.checkNotNull(allocator, "Memory Allocator object cannot be null");

JdbcToArrowConfig config = new JdbcToArrowConfigBuilder(allocator, JdbcToArrowUtils.getUtcCalendar())
.setArraySubTypeByColumnNameMap(ARRAY_SUB_TYPE_BY_COLUMN_NAME_MAP)
Expand All @@ -292,7 +292,7 @@ public static VectorSchemaRoot sqlToArrow(ResultSet resultSet, BufferAllocator a
* @throws SQLException on error
*/
public static VectorSchemaRoot sqlToArrow(ResultSet resultSet, Calendar calendar) throws SQLException, IOException {
Preconditions.checkNotNull(resultSet, "JDBC ResultSet object can not be null");
Preconditions.checkNotNull(resultSet, "JDBC ResultSet object cannot be null");

JdbcToArrowConfig config = new JdbcToArrowConfigBuilder(new RootAllocator(Integer.MAX_VALUE), calendar)
.setArraySubTypeByColumnNameMap(ARRAY_SUB_TYPE_BY_COLUMN_NAME_MAP)
Expand All @@ -316,7 +316,7 @@ public static VectorSchemaRoot sqlToArrow(
BufferAllocator allocator,
Calendar calendar)
throws SQLException, IOException {
Preconditions.checkNotNull(allocator, "Memory Allocator object can not be null");
Preconditions.checkNotNull(allocator, "Memory Allocator object cannot be null");

JdbcToArrowConfig config = new JdbcToArrowConfigBuilder(allocator, calendar)
.setArraySubTypeByColumnNameMap(ARRAY_SUB_TYPE_BY_COLUMN_NAME_MAP)
Expand All @@ -336,7 +336,7 @@ public static VectorSchemaRoot sqlToArrow(
*/
public static VectorSchemaRoot sqlToArrow(ResultSet resultSet, JdbcToArrowConfig config)
throws SQLException, IOException {
Preconditions.checkNotNull(resultSet, "JDBC ResultSet object can not be null");
Preconditions.checkNotNull(resultSet, "JDBC ResultSet object cannot be null");
Preconditions.checkNotNull(config, "The configuration cannot be null");

VectorSchemaRoot root = VectorSchemaRoot.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void testInconsistentPrecisionAndScale() throws Exception {
assertThrows(RuntimeException.class, iter::next,
"This is expected to fail due to inconsistent BigDecimal scales, while strict matching is enabled.");
}
// Reuse same ResultSet, with RoundingMode.UNNECESSARY set to coerce BigDecmial scale as needed:
// Reuse same ResultSet, with RoundingMode.UNNECESSARY set to coerce BigDecimal scale as needed:
config = new JdbcToArrowConfigBuilder(
allocator, JdbcToArrowUtils.getUtcCalendar(), /* include metadata */ false)
.setReuseVectorSchemaRoot(reuseVectorSchemaRoot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void setUp() throws Exception {

/**
* Test h2 database query with alias for column name and column label.
* To vetify reading field alias from an H2 database works as expected.
* To verify reading field alias from an H2 database works as expected.
* If this test fails, something is either wrong with the setup,
* or the H2 SQL behavior changed.
*/
Expand Down
2 changes: 1 addition & 1 deletion java/c/src/main/java/org/apache/arrow/c/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public static void exportVectorSchemaRoot(BufferAllocator allocator, VectorSchem

/**
* Export a reader as an ArrowArrayStream using the C Stream Interface.
* @param allocator Buffer allocator for allocating C data inteface fields
* @param allocator Buffer allocator for allocating C data interface fields
* @param reader Reader to export
* @param out C struct to export the stream
*/
Expand Down
4 changes: 2 additions & 2 deletions java/c/src/main/java/org/apache/arrow/c/NativeUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static void closeBuffer(ArrowBuf buf) {
* Get the address of a buffer or {@value #NULL} if the input buffer is null.
*
* @param buf Buffer to get the address of
* @return Memory addresss or {@value #NULL}
* @return Memory address or {@value #NULL}
*/
public static long addressOrNull(ArrowBuf buf) {
if (buf == null) {
Expand All @@ -129,7 +129,7 @@ public static long addressOrNull(ArrowBuf buf) {
* struct is null.
*
* @param struct C Data Interface struct to get the address of
* @return Memory addresss or {@value #NULL}
* @return Memory address or {@value #NULL}
*/
public static long addressOrNull(BaseStruct struct) {
if (struct == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public StructVector load(BufferAllocator allocator, ArrowRecordBatch recordBatch

private void loadBuffers(FieldVector vector, Field field, Iterator<ArrowBuf> buffers, Iterator<ArrowFieldNode> nodes,
CompressionCodec codec) {
checkArgument(nodes.hasNext(), "no more field nodes for for field %s and vector %s", field, vector);
checkArgument(nodes.hasNext(), "no more field nodes for field %s and vector %s", field, vector);
ArrowFieldNode fieldNode = nodes.next();
int bufferLayoutCount = TypeLayout.getTypeBufferCount(field.getType());
List<ArrowBuf> ownBuffers = new ArrayList<>(bufferLayoutCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void testRoundtripMultipleBatches() throws IOException {
ArrowSchema consumerArrowSchema = ArrowSchema.allocateNew(allocator)) {
// Load first batch
reader.loadNextBatch();
// Producer fills consumer schema stucture
// Producer fills consumer schema structure
Data.exportSchema(allocator, reader.getVectorSchemaRoot().getSchema(), reader, consumerArrowSchema);
// Consumer loads it as an empty vector schema root
try (CDataDictionaryProvider consumerDictionaryProvider = new CDataDictionaryProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ void withRoot(CompressionUtil.CodecType codec, BiConsumer<CompressionCodec.Facto
try (final VectorSchemaRoot root = VectorSchemaRoot.create(schema, allocator)) {
final IntVector ints = (IntVector) root.getVector(0);
final VarCharVector strings = (VarCharVector) root.getVector(1);
// Doesn't get compresed
// Doesn't get compressed
ints.setSafe(0, 0x4a3e);
ints.setSafe(1, 0x8aba);
ints.setSafe(2, 0x4362);
Expand Down
6 changes: 3 additions & 3 deletions java/dataset/src/main/cpp/jni_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ std::string Describe(JNIEnv* env, jthrowable t) {
}

bool IsErrorInstanceOf(JNIEnv* env, jthrowable t, std::string class_name) {
jclass jclass = env->FindClass(class_name.c_str());
DCHECK_NE(jclass, nullptr) << "Could not find Java class " << class_name;
return env->IsInstanceOf(t, jclass);
jclass java_class = env->FindClass(class_name.c_str());
DCHECK_NE(java_class, nullptr) << "Could not find Java class " << class_name;
return env->IsInstanceOf(t, java_class);
}

arrow::StatusCode MapJavaError(JNIEnv* env, jthrowable t) {
Expand Down
4 changes: 2 additions & 2 deletions java/dataset/src/main/cpp/jni_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ std::unordered_map<std::string, std::shared_ptr<arrow::Table>> LoadNamedTables(J
std::unordered_map<std::string, std::shared_ptr<arrow::Table>> map_table_to_record_batch_reader;
int length = env->GetArrayLength(str_array);
if (length % 2 != 0) {
JniThrow("Can not map odd number of array elements to key/value pairs");
JniThrow("Cannot map odd number of array elements to key/value pairs");
}
std::shared_ptr<arrow::Table> output_table;
for (int pos = 0; pos < length; pos++) {
Expand Down Expand Up @@ -399,7 +399,7 @@ JNIEXPORT jlong JNICALL Java_org_apache_arrow_dataset_jni_NativeMemoryPool_bytes
JNI_METHOD_START
arrow::MemoryPool* pool = reinterpret_cast<arrow::MemoryPool*>(memory_pool_id);
if (pool == nullptr) {
JniThrow("Memory pool instance not found. It may not exist nor has been closed");
JniThrow("Memory pool instance not found. It may not exist or have been closed");
}
return pool->bytes_allocated();
JNI_METHOD_END(-1L)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public native long createScanner(long datasetId, String[] columns, ByteBuffer su
public native void releaseBuffer(long bufferId);

/**
* Ensure the S3 APIs are shutdown, but only if not already done. If the S3 APIs are unintialized,
* Ensure the S3 APIs are shutdown, but only if not already done. If the S3 APIs are uninitialized,
* then this is a noop.
*/
public native void ensureS3Finalized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* Class that contains Native methods to call Acero C++ Substrait API. It internally depends on C++ function
* arrow::engine::ExecuteSerializedPlan. Currently supported input parameters supported are:
* <pre>
* - arrow::Buffer: Susbtrait Plan (JSON or Binary format).
* - arrow::Buffer: Substrait Plan (JSON or Binary format).
* - arrow::engine::ConversionOptions: Mapping for arrow::engine::NamedTableProvider.
* </pre>
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ default void start(VectorSchemaRoot root, DictionaryProvider dictionaries) {
void completed();

/**
* Toggle whether to ues the zero-copy write optimization.
* Toggle whether to use the zero-copy write optimization.
*
* <p>By default or when disabled, Arrow may copy data into a buffer for the underlying implementation to
* send. When enabled, Arrow will instead try to directly enqueue the Arrow buffer for sending. Not all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static void doClientHandshake(FlightServiceStub stub) {
throw wrappedException;
}
} catch (StatusRuntimeException sre) {
logger.error("Failed with SREe", sre);
logger.error("Failed with SRE", sre);
throw StatusUtils.fromGrpcRuntimeException(sre);
} catch (Throwable ex) {
logger.error("Failed with unknown", ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1048,8 +1048,8 @@ private int setGetColumnsVectorSchemaRootFromFields(final VectorSchemaRoot curre
SqlTypes.getSqlTypeNameFromArrowType(fieldType).getBytes(CHARSET);
typeNameVector.setSafe(insertIndex, typeName);

// We're not setting COLUMN_SIZE for ROWID SQL Types, as there's no such Arrow type.
// We're not setting COLUMN_SIZE nor DECIMAL_DIGITS for Float/Double as their precision and scale are variable.
// We aren't setting COLUMN_SIZE for ROWID SQL Types, as there's no such Arrow type.
// We aren't setting COLUMN_SIZE nor DECIMAL_DIGITS for Float/Double as their precision and scale are variable.
if (fieldType instanceof ArrowType.Decimal) {
numPrecRadixVector.setSafe(insertIndex, BASE10_RADIX);
} else if (fieldType instanceof ArrowType.Int) {
Expand Down Expand Up @@ -1101,7 +1101,7 @@ private static byte[] booleanToYesOrNo(boolean autoIncrement) {
}

static Integer getDecimalDigits(final ArrowType fieldType) {
// We're not setting DECIMAL_DIGITS for Float/Double as their precision and scale are variable.
// We aren't setting DECIMAL_DIGITS for Float/Double as their precision and scale are variable.
if (fieldType instanceof ArrowType.Decimal) {
final ArrowType.Decimal thisDecimal = (ArrowType.Decimal) fieldType;
return thisDecimal.getScale();
Expand Down Expand Up @@ -1141,8 +1141,8 @@ static Integer getDecimalDigits(final ArrowType fieldType) {
}

static Integer getColumnSize(final ArrowType fieldType) {
// We're not setting COLUMN_SIZE for ROWID SQL Types, as there's no such Arrow type.
// We're not setting COLUMN_SIZE nor DECIMAL_DIGITS for Float/Double as their precision and scale are variable.
// We aren't setting COLUMN_SIZE for ROWID SQL Types, as there's no such Arrow type.
// We aren't setting COLUMN_SIZE nor DECIMAL_DIGITS for Float/Double as their precision and scale are variable.
if (fieldType instanceof ArrowType.Decimal) {
final ArrowType.Decimal thisDecimal = (ArrowType.Decimal) fieldType;
return thisDecimal.getPrecision();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ public static final class Builder {
@VisibleForTesting
boolean retainAuth = true;

// These two middlewares are for internal use within build() and should not be exposed by builder APIs.
// Note that these middlewares may not necessarily be registered.
// These two middleware are for internal use within build() and should not be exposed by builder APIs.
// Note that these middleware may not necessarily be registered.
@VisibleForTesting
ClientIncomingAuthHeaderMiddleware.Factory authFactory
= new ClientIncomingAuthHeaderMiddleware.Factory(new ClientBearerHeaderHandler());
Expand Down Expand Up @@ -742,7 +742,7 @@ public Builder withCallOptions(final Collection<CallOption> options) {
* @throws SQLException on error.
*/
public ArrowFlightSqlClientHandler build() throws SQLException {
// Copy middlewares so that the build method doesn't change the state of the builder fields itself.
// Copy middleware so that the build method doesn't change the state of the builder fields itself.
Set<FlightClientMiddleware.Factory> buildTimeMiddlewareFactories = new HashSet<>(this.middlewareFactories);
FlightClient client = null;
boolean isUsingUserPasswordAuth = username != null && token == null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void bind(List<TypedValue> typedValues, int index) {
}

/**
* Bind a TypedValue to the given index on the FieldVctor.
* Bind a TypedValue to the given index on the FieldVector.
*
* @param vector FieldVector to bind to.
* @param typedValue TypedValue to bind to the vector.
Expand Down
Loading

0 comments on commit cf1b265

Please sign in to comment.