]> git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/matlab/test/util/createVariablesAndMetadataStructs.m
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / matlab / test / util / createVariablesAndMetadataStructs.m
1 function [variables, metadata] = createVariablesAndMetadataStructs()
2 % CREATEVARIABLESANDMETADATASTRUCTS Helper function for creating
3 % Feather MEX variables and metadata structs.
4
5 % Licensed to the Apache Software Foundation (ASF) under one or more
6 % contributor license agreements. See the NOTICE file distributed with
7 % this work for additional information regarding copyright ownership.
8 % The ASF licenses this file to you under the Apache License, Version
9 % 2.0 (the "License"); you may not use this file except in compliance
10 % with the License. You may obtain a copy of the License at
11 %
12 % http://www.apache.org/licenses/LICENSE-2.0
13 %
14 % Unless required by applicable law or agreed to in writing, software
15 % distributed under the License is distributed on an "AS IS" BASIS,
16 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 % implied. See the License for the specific language governing
18 % permissions and limitations under the License.
19
20 import mlarrow.util.*;
21
22 type = 'uint8';
23 data = uint8([1; 2; 3]);
24 valid = logical([0; 1; 0]);
25 name = 'uint8';
26 uint8Variable = createVariableStruct(type, data, valid, name);
27
28 type = 'uint16';
29 data = uint16([1; 2; 3]);
30 valid = logical([0; 1; 0]);
31 name = 'uint16';
32 uint16Variable = createVariableStruct(type, data, valid, name);
33
34 type = 'uint32';
35 data = uint32([1; 2; 3]);
36 valid = logical([0; 1; 0]);
37 name = 'uint32';
38 uint32Variable = createVariableStruct(type, data, valid, name);
39
40 type = 'uint64';
41 data = uint64([1; 2; 3]);
42 valid = logical([0; 1; 0]);
43 name = 'uint64';
44 uint64Variable = createVariableStruct(type, data, valid, name);
45
46 type = 'int8';
47 data = int8([1; 2; 3]);
48 valid = logical([0; 1; 0]);
49 name = 'int8';
50 int8Variable = createVariableStruct(type, data, valid, name);
51
52 type = 'int16';
53 data = int16([1; 2; 3]);
54 valid = logical([0; 1; 0]);
55 name = 'int16';
56 int16Variable = createVariableStruct(type, data, valid, name);
57
58 type = 'int32';
59 data = int32([1; 2; 3]);
60 valid = logical([0; 1; 0]);
61 name = 'int32';
62 int32Variable = createVariableStruct(type, data, valid, name);
63
64 type = 'int64';
65 data = int64([1; 2; 3]);
66 valid = logical([0; 1; 0]);
67 name = 'int64';
68 int64Variable = createVariableStruct(type, data, valid, name);
69
70 type = 'single';
71 data = single([1; 2; 3]);
72 valid = logical([0; 1; 0]);
73 name = 'single';
74 singleVariable = createVariableStruct(type, data, valid, name);
75
76 type = 'double';
77 data = double([1; 2; 3]);
78 valid = logical([0; 1; 0]);
79 name = 'double';
80 doubleVariable = createVariableStruct(type, data, valid, name);
81
82 variables = [uint8Variable, ...
83 uint16Variable, ...
84 uint32Variable, ...
85 uint64Variable, ...
86 int8Variable, ...
87 int16Variable, ...
88 int32Variable, ...
89 int64Variable, ...
90 singleVariable, ...
91 doubleVariable];
92
93 numRows = 3;
94 numVariables = length(variables);
95
96 metadata = createMetadataStruct(numRows, numVariables);
97 end