forked from apache/arrow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenums.R
72 lines (64 loc) · 2.28 KB
/
enums.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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.
#' @export
`print.arrow-enum` <- function(x, ...){
NextMethod()
}
enum <- function(class, ..., .list = list(...)){
structure(
.list,
class = c(class, "arrow-enum")
)
}
#' @rdname DataType
#' @export
TimeUnit <- enum("arrow::TimeUnit::type",
SECOND = 0L, MILLI = 1L, MICRO = 2L, NANO = 3L
)
#' @rdname DataType
#' @export
DateUnit <- enum("arrow::DateUnit", DAY = 0L, MILLI = 1L)
#' @rdname DataType
#' @export
Type <- enum("arrow::Type::type",
"NA" = 0L, BOOL = 1L, UINT8 = 2L, INT8 = 3L, UINT16 = 4L, INT16 = 5L,
UINT32 = 6L, INT32 = 7L, UINT64 = 8L, INT64 = 9L,
HALF_FLOAT = 10L, FLOAT = 11L, DOUBLE = 12L, STRING = 13L,
BINARY = 14L, FIXED_SIZE_BINARY = 15L, DATE32 = 16L, DATE64 = 17L, TIMESTAMP = 18L,
TIME32 = 19L, TIME64 = 20L, INTERVAL = 21L, DECIMAL = 22L, LIST = 23L, STRUCT = 24L,
UNION = 25L, DICTIONARY = 26L, MAP = 27L
)
#' @rdname DataType
#' @export
StatusCode <- enum("arrow::StatusCode",
OK = 0L, OutOfMemory = 1L, KeyError = 2L, TypeError = 3L,
Invalid = 4L, IOError = 5L, CapacityError = 6L,
UnknownError = 9L, NotImplemented = 10L, SerializationError = 11L,
PythonError = 12L, RError = 13L,
PlasmaObjectExists = 20L, PlasmaObjectNonexistent = 21L,
PlasmaStoreFull = 22L, PlasmaObjectAlreadySealed = 23L
)
#' @rdname DataType
#' @export
FileMode <- enum("arrow::io::FileMode",
READ = 0L, WRITE = 1L, READWRITE = 2L
)
#' @rdname DataType
#' @export
MessageType <- enum("arrow::ipc::Message::Type",
NONE = 0L, SCHEMA = 1L, DICTIONARY_BATCH = 2L, RECORD_BATCH = 3L, TENSOR = 4L
)