lidavidm commented on a change in pull request #12739: URL: https://github.com/apache/arrow/pull/12739#discussion_r837791842
########## File path: docs/source/java/modules.rst ########## @@ -0,0 +1,413 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. default-domain:: java +.. highlight:: java + +.. _java_modules: + +======= +Modules +======= + +.. contents:: + +This is the variety of arrow java documentation: + +* `Specification and protocols`_: This contains agnostic specification that is implemented in this case by arrow java modules. +* `Supported environment`_ (like this): This contains answers for what-is-that arrow java module. +* `Cookbook`_: This contains answers about how-to-use arrow java modules with practices examples. +* `Development`_: This contains detailed information about what you need to consider to start with arrow java development. + +Arrow java modules is created using specification such as columnar format, off-heap +memory, serialization and interprocess communication (IPC). Some of the java modules +was created with their own native implementations and others through bindings. + +.. list-table:: Arrow Java Implementations and Bindings + :widths: 25 75 + :header-rows: 1 + + * - Module + - Root Decision + * - Arrow Memory + - Native implementation. + * - Arrow Vector + - Native implementation. + * - Arrow Flight Grpc + - Native implementation. + * - Arrow Flight Sql + - Native implementation. + * - Arrow Algorithm + - Native implementation. + * - Arrow Compression + - Native implementation. + * - Arrow C Data Interface + - Native implementation. + * - Arrow Dataset + - Bindings + * - Arrow ORC + - Bindings + * - Arrow Gandiva + - Bindings + +Arrow java is divided in these modules to offer in-memory columnar data structures: + +.. list-table:: Arrow Java Modules + :widths: 25 75 + :header-rows: 1 + + * - Module + - Description + * - arrow-format + - Generated Java files from the IPC Flatbuffer definitions. + * - arrow-memory-core + - Core off-heap memory management libraries for Arrow ValueVectors. + * - arrow-memory-unsafe + - Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + * - arrow-memory-netty + - Netty allocator and utils for allocating memory in Arrow. + * - arrow-vector + - An off-heap reference implementation for Arrow columnar data format. + * - arrow-tools + - Java applications for working with Arrow ValueVectors. + * - arrow-jdbc + - (`Experimental`) A library for converting JDBC data to Arrow data. Review comment: We don't need backticks around 'experimental', and we can consolidate these two tables (if you decide to keep them as tables) ########## File path: docs/source/java/modules.rst ########## @@ -0,0 +1,413 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. default-domain:: java +.. highlight:: java + +.. _java_modules: + +======= +Modules +======= + +.. contents:: + +This is the variety of arrow java documentation: + +* `Specification and protocols`_: This contains agnostic specification that is implemented in this case by arrow java modules. +* `Supported environment`_ (like this): This contains answers for what-is-that arrow java module. +* `Cookbook`_: This contains answers about how-to-use arrow java modules with practices examples. Review comment: IMO, we don't need most of these links (they're part of the sidebar already). But we can link to the cookbook in the actual getting started page. ########## File path: docs/source/java/modules.rst ########## @@ -0,0 +1,413 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. default-domain:: java +.. highlight:: java + +.. _java_modules: + +======= +Modules +======= + +.. contents:: + +This is the variety of arrow java documentation: + +* `Specification and protocols`_: This contains agnostic specification that is implemented in this case by arrow java modules. +* `Supported environment`_ (like this): This contains answers for what-is-that arrow java module. +* `Cookbook`_: This contains answers about how-to-use arrow java modules with practices examples. +* `Development`_: This contains detailed information about what you need to consider to start with arrow java development. + +Arrow java modules is created using specification such as columnar format, off-heap Review comment: nit, but please be sure to capitalize Java. ########## File path: docs/source/java/modules.rst ########## @@ -0,0 +1,413 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. default-domain:: java +.. highlight:: java + +.. _java_modules: + +======= +Modules +======= + +.. contents:: + +This is the variety of arrow java documentation: + +* `Specification and protocols`_: This contains agnostic specification that is implemented in this case by arrow java modules. +* `Supported environment`_ (like this): This contains answers for what-is-that arrow java module. +* `Cookbook`_: This contains answers about how-to-use arrow java modules with practices examples. +* `Development`_: This contains detailed information about what you need to consider to start with arrow java development. + +Arrow java modules is created using specification such as columnar format, off-heap +memory, serialization and interprocess communication (IPC). Some of the java modules +was created with their own native implementations and others through bindings. + +.. list-table:: Arrow Java Implementations and Bindings + :widths: 25 75 + :header-rows: 1 + + * - Module + - Root Decision + * - Arrow Memory + - Native implementation. + * - Arrow Vector + - Native implementation. + * - Arrow Flight Grpc + - Native implementation. + * - Arrow Flight Sql + - Native implementation. + * - Arrow Algorithm + - Native implementation. + * - Arrow Compression + - Native implementation. + * - Arrow C Data Interface + - Native implementation. + * - Arrow Dataset + - Bindings + * - Arrow ORC + - Bindings + * - Arrow Gandiva + - Bindings + +Arrow java is divided in these modules to offer in-memory columnar data structures: + +.. list-table:: Arrow Java Modules + :widths: 25 75 + :header-rows: 1 + + * - Module + - Description + * - arrow-format + - Generated Java files from the IPC Flatbuffer definitions. + * - arrow-memory-core + - Core off-heap memory management libraries for Arrow ValueVectors. + * - arrow-memory-unsafe + - Allocator and utils for allocating memory in Arrow based on sun.misc.Unsafe. + * - arrow-memory-netty + - Netty allocator and utils for allocating memory in Arrow. + * - arrow-vector + - An off-heap reference implementation for Arrow columnar data format. + * - arrow-tools + - Java applications for working with Arrow ValueVectors. + * - arrow-jdbc + - (`Experimental`) A library for converting JDBC data to Arrow data. + * - arrow-plasma + - (`Experimental`) Java client for the Plasma object store. + * - flight-core + - (`Experimental`) An RPC mechanism for transferring ValueVectors. + * - flight-grpc + - (`Experimental`) Contains utility class to expose Flight gRPC service and client + * - flight-sql + - (`Experimental`) Contains utility classes to expose Flight SQL semantics for clients and servers over Arrow Flight. + * - flight-integration-tests + - Integration tests for Flight RPC. + * - arrow-performance + - JMH Performance benchmarks for other Arrow libraries. + * - arrow-algorithm + - (`Experimental`) A collection of algorithms for working with ValueVectors. + * - arrow-avro + - (`Experimental`) A library for converting Avro data to Arrow data. + * - arrow-compression + - (`Experimental`) A library for working with the compression/decompression of Arrow data. + * - arrow-c-data + - Java implementation of C Data Interface + * - arrow-orc + - (`Experimental`) A JNI wrapper for the C++ ORC reader implementation. + * - arrow-gandiva + - Java wrappers around the native Gandiva SQL expression compiler. + * - arrow-dataset + - Java implementation of Arrow Dataset API/Framework + +For more detail about how to install this modules please review +:doc:`Installing Java Modules <install>`. + +.. note:: + + Arrow java modules offer support to work data: (1) in-memory, + (2) at rest and (3) on-the-wire. Review comment: I'm not sure this is useful as a note. This can be a brief sentence in either the modules overview or the getting started guide. ########## File path: docs/source/java/quickstartguide.rst ########## @@ -0,0 +1,482 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. default-domain:: java +.. highlight:: java + +.. _java_quickstartguide: + +================= +Quick Start Guide +================= + +.. contents:: + +Arrow java manage data in Vector Schema Root (somewhat analogous to tables and record +batches in the other Arrow implementations). Before to create a Vector Schema Root let's +define another topics neededs for that purpose. + +Create A Value Vector +********************* + +It's called `array` in the columnar format specification. Represent a one-dimensional +sequence of homogeneous values. + +**Int Vector**: Create an value vector of int32s like this [1, null, 2] + +.. code-block:: Java + + import org.apache.arrow.memory.BufferAllocator; + import org.apache.arrow.memory.RootAllocator; + import org.apache.arrow.vector.IntVector; + + try(BufferAllocator rootAllocator = new RootAllocator(); + IntVector intVector = new IntVector("fixed-size-primitive-layout", rootAllocator)){ + intVector.allocateNew(3); + intVector.set(0,1); + intVector.setNull(1); + intVector.set(2,2); + intVector.setValueCount(3); + System.out.println("Vector created in memory: " + intVector); + } + +**Varchar Vector**: Create an value vector of string like this [one, two, three] + +.. code-block:: Java + + import org.apache.arrow.memory.BufferAllocator; + import org.apache.arrow.memory.RootAllocator; + import org.apache.arrow.vector.VarCharVector; + + try(BufferAllocator rootAllocator = new RootAllocator(); + VarCharVector varCharVector = new VarCharVector("variable-size-primitive-layout", rootAllocator)){ + varCharVector.allocateNew(3); + varCharVector.set(0, "one".getBytes()); + varCharVector.set(1, "two".getBytes()); + varCharVector.set(2, "three".getBytes()); + varCharVector.setValueCount(3); + System.out.println("Vector created in memory: " + varCharVector); + } + +Create A Field +************** + +Fields are used to denote the particular columns of tabular data. + +**Field**: Create a column "document" of string type with metadata. + +.. code-block:: Java + + import org.apache.arrow.vector.types.pojo.ArrowType; + import org.apache.arrow.vector.types.pojo.Field; + import org.apache.arrow.vector.types.pojo.FieldType; + + Map<String, String> metadata = new HashMap<>(); + metadata.put("A", "Id card"); + metadata.put("B", "Passport"); + metadata.put("C", "Visa"); + Field document = new Field("document", new FieldType(true, new ArrowType.Utf8(), /*dictionary*/ null, metadata), /*children*/ null); + +Create A Schema +*************** + +Schema holds a sequence of fields together with some optional metadata. + +**Schema**: Create a schema describing datasets with two columns: +a int32 column "A" and a utf8-encoded string column "B" + +.. code-block:: Java + + import org.apache.arrow.vector.types.pojo.ArrowType; + import org.apache.arrow.vector.types.pojo.Field; + import org.apache.arrow.vector.types.pojo.FieldType; + import org.apache.arrow.vector.types.pojo.Schema; + import static java.util.Arrays.asList; + + Map<String, String> metadata = new HashMap<>(); + metadata.put("K1", "V1"); + metadata.put("K2", "V2"); + Field a = new Field("A", FieldType.nullable(new ArrowType.Int(32, true)), null); + Field b = new Field("B", FieldType.nullable(new ArrowType.Utf8()), null); + Schema schema = new Schema(asList(a, b), metadata); + +Create A Vector Schema Root +*************************** + +VectorSchemaRoot is somewhat analogous to tables and record batches in the other +Arrow implementations. + +**VectorSchemaRoot**: Create a dataset with metadata that contains integer age and +string names of data. + +.. code-block:: Java + + import org.apache.arrow.memory.BufferAllocator; + import org.apache.arrow.memory.RootAllocator; + import org.apache.arrow.vector.IntVector; + import org.apache.arrow.vector.VarCharVector; + import org.apache.arrow.vector.VectorSchemaRoot; + import org.apache.arrow.vector.types.pojo.ArrowType; + import org.apache.arrow.vector.types.pojo.Field; + import org.apache.arrow.vector.types.pojo.FieldType; + import org.apache.arrow.vector.types.pojo.Schema; + + import java.nio.charset.StandardCharsets; + import java.util.HashMap; + import java.util.Map; + import static java.util.Arrays.asList; + + Map<String, String> metadataField = new HashMap<>(); + metadataField.put("K1-Field", "K1F1"); + metadataField.put("K2-Field", "K2F2"); + Field a = new Field("Column-A-Age", FieldType.nullable(new ArrowType.Int(32, true)), null); + Field b = new Field("Column-B-Name", new FieldType(true, new ArrowType.Utf8(), /*dictionary*/ null, metadataField), null); + Map<String, String> metadataSchema = new HashMap<>(); + metadataSchema.put("K1-Schema", "K1S1"); + metadataSchema.put("K2-Schema", "K2S2"); + Schema schema = new Schema(asList(a, b), metadataSchema); + System.out.println("Field A: " + a); + System.out.println("Field B: " + b + ", Metadata: " + b.getMetadata()); + System.out.println("Schema: " + schema); + try(BufferAllocator rootAllocator = new RootAllocator(); + VectorSchemaRoot vectorSchemaRoot = VectorSchemaRoot.create(schema, rootAllocator)){ + vectorSchemaRoot.setRowCount(3); + try(IntVector intVectorA = (IntVector) vectorSchemaRoot.getVector("Column-A-Age"); + VarCharVector varCharVectorB = (VarCharVector) vectorSchemaRoot.getVector("Column-B-Name")) { + intVectorA.allocateNew(3); + intVectorA.set(0, 10); + intVectorA.set(1, 20); + intVectorA.set(2, 30); + + varCharVectorB.allocateNew(3); + varCharVectorB.set(0, "Dave".getBytes(StandardCharsets.UTF_8)); + varCharVectorB.set(1, "Peter".getBytes(StandardCharsets.UTF_8)); + varCharVectorB.set(2, "Mary".getBytes(StandardCharsets.UTF_8)); + + System.out.println("Vector Schema Root: \n" + vectorSchemaRoot.contentToTSVString()); + } + } + +Create a IPC File or Random Access Format +***************************************** + +The Arrow Interprocess Communication (IPC) format defines two types of binary +formats for serializing Arrow data: the streaming format and the file format +(or random access format). Such files can be directly memory-mapped when read. + +**Write File or Random Access Format**: Write to a file a dataset with metadata +that contains integer age and string names of data. Review comment: I think we can be briefer here and just say that Arrow data can be written to and read from disk, and both of these can be done in a streaming and/or random-access fashion depending on application requirements. ########## File path: docs/source/java/quickstartguide.rst ########## @@ -0,0 +1,482 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. default-domain:: java +.. highlight:: java + +.. _java_quickstartguide: + +================= +Quick Start Guide +================= + +.. contents:: + +Arrow java manage data in Vector Schema Root (somewhat analogous to tables and record +batches in the other Arrow implementations). Before to create a Vector Schema Root let's +define another topics neededs for that purpose. + +Create A Value Vector +********************* + +It's called `array` in the columnar format specification. Represent a one-dimensional Review comment: reST uses double backticks. But usually for this we should use quotes. `Also known as "arrays" in the columnar format.` ########## File path: docs/source/java/quickstartguide.rst ########## @@ -0,0 +1,482 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. default-domain:: java +.. highlight:: java + +.. _java_quickstartguide: + +================= +Quick Start Guide +================= + +.. contents:: + +Arrow java manage data in Vector Schema Root (somewhat analogous to tables and record +batches in the other Arrow implementations). Before to create a Vector Schema Root let's Review comment: We should probably just consistently use "VectorSchemaRoot" ########## File path: docs/source/java/quickstartguide.rst ########## @@ -0,0 +1,482 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. default-domain:: java +.. highlight:: java + +.. _java_quickstartguide: Review comment: note it's not too useful to have this anchor, 1) we don't use it and 2) for linking to a file, instead of a subheading, just use `:doc:` ########## File path: docs/source/java/quickstartguide.rst ########## @@ -0,0 +1,482 @@ +.. Licensed to the Apache Software Foundation (ASF) under one +.. or more contributor license agreements. See the NOTICE file +.. distributed with this work for additional information +.. regarding copyright ownership. The ASF licenses this file +.. to you under the Apache License, Version 2.0 (the +.. "License"); you may not use this file except in compliance +.. with the License. You may obtain a copy of the License at + +.. http://www.apache.org/licenses/LICENSE-2.0 + +.. Unless required by applicable law or agreed to in writing, +.. software distributed under the License is distributed on an +.. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +.. KIND, either express or implied. See the License for the +.. specific language governing permissions and limitations +.. under the License. + +.. default-domain:: java +.. highlight:: java + +.. _java_quickstartguide: + +================= +Quick Start Guide +================= + +.. contents:: + +Arrow java manage data in Vector Schema Root (somewhat analogous to tables and record +batches in the other Arrow implementations). Before to create a Vector Schema Root let's Review comment: And we can introduce things more naturally, something like: Arrow provides several building blocks; ValueVectors are sequences of typed values; data types, fields, and schemas describe the types of values, and the types of columns in tabular data; VectorSchemaRoot represents tabular data. Arrow also provides readers and writers for loading data from and persisting data to storage. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org