]> git.proxmox.com Git - ceph.git/blame - ceph/src/arrow/js/src/enum.ts
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / js / src / enum.ts
CommitLineData
1d09f67e
TL
1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements. See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership. The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18export {
19 DateUnit,
20 TimeUnit,
21 Precision,
22 UnionMode,
23 IntervalUnit,
24 MetadataVersion,
25} from './fb/Schema';
26
27export { MessageHeader } from './fb/Message';
28
29/**
30 * Main data type enumeration.
31 *
32 * Data types in this library are all *logical*. They can be expressed as
33 * either a primitive physical type (bytes or bits of some fixed size), a
34 * nested type consisting of other data types, or another data type (e.g. a
35 * timestamp encoded as an int64).
36 *
37 * **Note**: Only enum values 0-17 (NONE through Map) are written to an Arrow
38 * IPC payload.
39 *
40 * The rest of the values are specified here so TypeScript can narrow the type
41 * signatures further beyond the base Arrow Types. The Arrow DataTypes include
42 * metadata like `bitWidth` that impact the type signatures of the values we
43 * accept and return.
44 *
45 * For example, the `Int8Vector` reads 1-byte numbers from an `Int8Array`, an
46 * `Int32Vector` reads a 4-byte number from an `Int32Array`, and an `Int64Vector`
47 * reads a pair of 4-byte lo, hi 32-bit integers as a zero-copy slice from the
48 * underlying `Int32Array`.
49 *
50 * Library consumers benefit by knowing the narrowest type, since we can ensure
51 * the types across all public methods are propagated, and never bail to `any`.
52 * These values are _never_ used at runtime, and they will _never_ be written
53 * to the flatbuffers metadata of serialized Arrow IPC payloads.
54 */
55export enum Type {
56 /** The default placeholder type */
57 NONE = 0,
58 /** A NULL type having no physical storage */
59 Null = 1,
60 /** Signed or unsigned 8, 16, 32, or 64-bit little-endian integer */
61 Int = 2,
62 /** 2, 4, or 8-byte floating point value */
63 Float = 3,
64 /** Variable-length bytes (no guarantee of UTF8-ness) */
65 Binary = 4,
66 /** UTF8 variable-length string as List<Char> */
67 Utf8 = 5,
68 /** Boolean as 1 bit, LSB bit-packed ordering */
69 Bool = 6,
70 /** Precision-and-scale-based decimal type. Storage type depends on the parameters. */
71 Decimal = 7,
72 /** int32_t days or int64_t milliseconds since the UNIX epoch */
73 Date = 8,
74 /** Time as signed 32 or 64-bit integer, representing either seconds, milliseconds, microseconds, or nanoseconds since midnight since midnight */
75 Time = 9,
76 /** Exact timestamp encoded with int64 since UNIX epoch (Default unit millisecond) */
77 Timestamp = 10,
78 /** YEAR_MONTH or DAY_TIME interval in SQL style */
79 Interval = 11,
80 /** A list of some logical data type */
81 List = 12,
82 /** Struct of logical types */
83 Struct = 13,
84 /** Union of logical types */
85 Union = 14,
86 /** Fixed-size binary. Each value occupies the same number of bytes */
87 FixedSizeBinary = 15,
88 /** Fixed-size list. Each value occupies the same number of bytes */
89 FixedSizeList = 16,
90 /** Map of named logical types */
91 Map = 17,
92
93 /** Dictionary aka Category type */
94 Dictionary = -1,
95 Int8 = -2,
96 Int16 = -3,
97 Int32 = -4,
98 Int64 = -5,
99 Uint8 = -6,
100 Uint16 = -7,
101 Uint32 = -8,
102 Uint64 = -9,
103 Float16 = -10,
104 Float32 = -11,
105 Float64 = -12,
106 DateDay = -13,
107 DateMillisecond = -14,
108 TimestampSecond = -15,
109 TimestampMillisecond = -16,
110 TimestampMicrosecond = -17,
111 TimestampNanosecond = -18,
112 TimeSecond = -19,
113 TimeMillisecond = -20,
114 TimeMicrosecond = -21,
115 TimeNanosecond = -22,
116 DenseUnion = -23,
117 SparseUnion = -24,
118 IntervalDayTime = -25,
119 IntervalYearMonth = -26,
120}
121
122export enum BufferType {
123 /**
124 * used in List type, Dense Union and variable length primitive types (String, Binary)
125 */
126 OFFSET = 0,
127
128 /**
129 * actual data, either wixed width primitive types in slots or variable width delimited by an OFFSET vector
130 */
131 DATA = 1,
132
133 /**
134 * Bit vector indicating if each value is null
135 */
136 VALIDITY = 2,
137
138 /**
139 * Type vector used in Union type
140 */
141 TYPE = 3
142 }