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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/*
* 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.
*/
<@pp.dropOutputFile />
<@pp.changeOutputFile name="/org/apache/drill/exec/vector/complex/impl/AbstractFieldReader.java" />
<#include "/@includes/license.ftl" />
package org.apache.drill.exec.vector.complex.impl;
<#include "/@includes/vv_imports.ftl" />
/*
* This class is generated using freemarker and the ${.template_name} template.
*/
@SuppressWarnings("unused")
abstract class AbstractFieldReader extends AbstractBaseReader implements FieldReader {
AbstractFieldReader() {
}
/**
* Returns true if the current value of the reader is not null
* @return
*/
public boolean isSet() {
return true;
}
<#list ["Object", "BigDecimal", "Integer", "Long", "Boolean",
"Character", "DateTime", "Period", "Double", "Float",
"Text", "String", "Byte", "Short", "byte[]"] as friendlyType>
<#assign safeType=friendlyType />
<#if safeType=="byte[]"><#assign safeType="ByteArray" /></#if>
public ${friendlyType} read${safeType}(int arrayIndex) {
fail("read${safeType}(int arrayIndex)");
return null;
}
public ${friendlyType} read${safeType}() {
fail("read${safeType}()");
return null;
}
</#list>
public void copyAsValue(MapWriter writer) {
fail("CopyAsValue MapWriter");
}
public void copyAsField(String name, MapWriter writer) {
fail("CopyAsField MapWriter");
}
public void copyAsField(String name, ListWriter writer) {
fail("CopyAsFieldList");
}
<#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first />
<#assign boxedType = (minor.boxedType!type.boxedType) />
public void read(${name}Holder holder) {
fail("${name}");
}
public void read(Nullable${name}Holder holder) {
fail("${name}");
}
public void read(int arrayIndex, ${name}Holder holder) {
fail("Repeated${name}");
}
public void read(int arrayIndex, Nullable${name}Holder holder) {
fail("Repeated${name}");
}
public void copyAsValue(${name}Writer writer) {
fail("CopyAsValue${name}");
}
<#if minor.class == "VarDecimal">
public void copyAsField(String name, ${name}Writer writer, int scale, int precision) {
<#else>
public void copyAsField(String name, ${name}Writer writer) {
</#if>
fail("CopyAsField${name}");
}
</#list></#list>
public FieldReader reader(String name) {
fail("reader(String name)");
return null;
}
public FieldReader reader() {
fail("reader()");
return null;
}
public int size() {
fail("size()");
return -1;
}
private void fail(String name) {
throw new IllegalArgumentException(String.format("You tried to read a [%s] type when you are using a field reader of type [%s].", name, this.getClass().getSimpleName()));
}
}
|