Skip to content

Apache DataFusion SQL Query Engine

ARROW-7622: [Format] Mark Tensor and SparseTensor fields required

Antoine Pitroue2d86766236e
diff --git a/format/SparseTensor.fbs b/format/SparseTensor.fbs
index 1120f3458a..1de67eed19 100644
--- a/format/SparseTensor.fbs
+++ b/format/SparseTensor.fbs
@@ -55,13 +55,14 @@ namespace org.apache.arrow.flatbuf;
/// Note that the indices are sorted in lexicographical order.
table SparseTensorIndexCOO {
/// The type of values in indicesBuffer
- indicesType: Int;
+ indicesType: Int (required);
/// Non-negative byte offsets to advance one value cell along each dimension
+ /// If omitted, default to row-major order (C-like).
indicesStrides: [long];
/// The location and size of the indices matrix's data
- indicesBuffer: Buffer;
+ indicesBuffer: Buffer (required);
}
enum SparseMatrixCompressedAxis: short { Row, Column }
@@ -72,7 +73,7 @@ table SparseMatrixIndexCSX {
compressedAxis: SparseMatrixCompressedAxis;
/// The type of values in indptrBuffer
- indptrType: Int;
+ indptrType: Int (required);
/// indptrBuffer stores the location and size of indptr array that
/// represents the range of the rows.
@@ -96,10 +97,10 @@ table SparseMatrixIndexCSX {
/// And the indptr of X is:
///
/// indptr(X) = [0, 2, 3, 5, 5, 8, 10].
- indptrBuffer: Buffer;
+ indptrBuffer: Buffer (required);
/// The type of values in indicesBuffer
- indicesType: Int;
+ indicesType: Int (required);
/// indicesBuffer stores the location and size of the array that
/// contains the column indices of the corresponding non-zero values.
@@ -110,7 +111,7 @@ table SparseMatrixIndexCSX {
/// indices(X) = [1, 2, 2, 1, 3, 0, 2, 3, 1].
///
/// Note that the indices are sorted in lexicographical order for each row.
- indicesBuffer: Buffer;
+ indicesBuffer: Buffer (required);
}
union SparseTensorIndex {
@@ -122,19 +123,19 @@ table SparseTensor {
/// The type of data contained in a value cell.
/// Currently only fixed-width value types are supported,
/// no strings or nested types.
- type: Type;
+ type: Type (required);
/// The dimensions of the tensor, optionally named.
- shape: [TensorDim];
+ shape: [TensorDim] (required);
/// The number of non-zero values in a sparse tensor.
non_zero_length: long;
/// Sparse tensor index
- sparseIndex: SparseTensorIndex;
+ sparseIndex: SparseTensorIndex (required);
/// The location and size of the tensor's data
- data: Buffer;
+ data: Buffer (required);
}
root_type SparseTensor;
diff --git a/format/Tensor.fbs b/format/Tensor.fbs
index 01a20c3b1f..409297ccf8 100644
--- a/format/Tensor.fbs
+++ b/format/Tensor.fbs
@@ -38,16 +38,17 @@ table TensorDim {
table Tensor {
/// The type of data contained in a value cell. Currently only fixed-width
/// value types are supported, no strings or nested types
- type: Type;
+ type: Type (required);
/// The dimensions of the tensor, optionally named
- shape: [TensorDim];
+ shape: [TensorDim] (required);
/// Non-negative byte offsets to advance one value cell along each dimension
+ /// If omitted, default to row-major order (C-like).
strides: [long];
/// The location and size of the tensor's data
- data: Buffer;
+ data: Buffer (required);
}
root_type Tensor;