aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/main/codegen/data/Casts.tdd
blob: 63fa0e4cbbcfada5cae300d74c63f82da9f3dd31 (plain)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# 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.

{
  types: [
    {from: "Int", to: "BigInt", major: "Fixed"},
    {from: "Float4", to: "Float8", major: "Fixed" }, 
    {from: "Int", to: "Float4", major: "Fixed" },
    {from: "BigInt", to: "Float4", major: "Fixed" },
    {from: "Int", to: "Float8", major: "Fixed" },
    {from: "BigInt", to: "Float8", major: "Fixed" },
    {to: "Int", from: "BigInt", explicit: "int", major: "Fixed"},
    {to: "Float4", from: "Float8" , explicit: "float", major: "Fixed"}, 
    {to: "Int", from: "Float4" , explicit: "int", native: "float", major: "Fixed"},
    {to: "BigInt", from: "Float4" , explicit: "long", native: "float", major: "Fixed"},
    {to: "Int", from: "Float8" , explicit: "int", native: "double", major: "Fixed"},
    {to: "BigInt", from: "Float8" , explicit: "long", native: "double", major: "Fixed"},
    {from: "TinyInt", to: "Bit", major: "Fixed"},
    {from: "Bit", to: "TinyInt", explicit: "byte", major: "Fixed"},
    
    {from: "VarChar", to: "BigInt", major: "SrcVarlen", javaType: "Long", primeType: "long"},
    {from: "VarChar", to: "Int", major: "SrcVarlen", javaType:"Integer", primeType:"int"},
    {from: "VarBinary", to: "BigInt", major: "SrcVarlen", javaType: "Long", primeType : "long"},
    {from: "VarBinary", to: "Int", major: "SrcVarlen", javaType:"Integer", primeType : "int"},   
    {from: "VarChar", to: "Float4", major: "SrcVarlen", javaType:"Float", parse:"Float"},
    {from: "VarChar", to: "Float8", major: "SrcVarlen", javaType:"Double", parse:"Double"},
    {from: "VarBinary", to: "Float4", major: "SrcVarlen", javaType:"Float", parse:"Float"},
    {from: "VarBinary", to: "Float8", major: "SrcVarlen", javaType:"Double", parse:"Double"}, 

    {from: "BigInt", to: "VarChar", major: "TargetVarlen", javaType: "Long", bufferLength:"20"},
    {from: "Int", to: "VarChar", major: "TargetVarlen", javaType: "Integer", bufferLength:"11"},
    {from: "Float4", to: "VarChar", major: "TargetVarlen", javaType: "Float", bufferLength:"100"},
    {from: "Float8", to: "VarChar", major: "TargetVarlen", javaType: "Double", bufferLength:"100"},
    {from: "BigInt", to: "VarBinary", major: "TargetVarlen", javaType: "Long", bufferLength:"20"},
    {from: "Int", to: "VarBinary", major: "TargetVarlen", javaType: "Integer", bufferLength:"11"},
    {from: "Float4", to: "VarBinary", major: "TargetVarlen", javaType: "Float", bufferLength:"100"},
    {from: "Float8", to: "VarBinary", major: "TargetVarlen", javaType: "Double", bufferLength:"100"},     
    
    {from: "VarBinary", to: "VarChar", major: "SrcVarlenTargetVarlen"},
    {from: "VarChar", to: "VarChar", major: "SrcVarlenTargetVarlen"},
    {from: "VarChar", to: "VarBinary", major: "SrcVarlenTargetVarlen"},
    {from: "VarBinary", to: "VarBinary", major: "SrcVarlenTargetVarlen"},

    {from: "Date", to: "TimeStamp", major: "Date"},
    {from: "TimeStamp", to: "Date", major: "Date", alias: "to_date"},

    {from: "VarChar", to: "Date", major: "VarCharDate", alias: "datetype"},
    {from: "VarChar", to: "TimeStamp", major: "VarCharDate", alias: "timestamptype"},
    {from: "VarChar", to: "Time", major: "VarCharDate", alias: "timetype"},

    {from: "VarBinary", to: "Date", major: "VarBinaryDate", alias: "datetype"},
    {from: "VarBinary", to: "TimeStamp", major: "VarBinaryDate", alias: "timestamptype"},
    {from: "VarBinary", to: "Time", major: "VarBinaryDate", alias: "timetype"},

    {from: "Date", to: "VarChar", major: "DateVarChar", bufferLength: "10"}
    {from: "TimeStamp", to: "VarChar", major: "DateVarChar", bufferLength: "23"},
    {from: "Time", to: "VarChar", major: "DateVarChar", bufferLength: "12"},

    {from: "VarChar", to: "Interval", major: "VarCharInterval"},
    {from: "VarChar", to: "IntervalDay", major: "VarCharInterval"},
    {from: "VarChar", to: "IntervalYear", major: "VarCharInterval"},

    {from: "Interval", to: "VarChar", major: "IntervalVarChar", bufferLength: "65"},
    {from: "IntervalYear", to: "VarChar", major: "IntervalYearVarChar", bufferLength: "35"},
    {from: "IntervalDay", to: "VarChar", major: "IntervalDayVarChar", bufferLength: "43"},

    {from: "IntervalYear", to: "Interval", major: "IntervalSimpleToComplex", months: "in.value", days: "0", millis: "0"},
    {from: "IntervalDay", to: "Interval", major: "IntervalSimpleToComplex", months: "0", days: "in.days", millis: "in.milliseconds"},
    {from: "Interval", to: "IntervalYear", major: "IntervalComplexToSimple"},
    {from: "Interval", to: "IntervalDay", major: "IntervalComplexToSimple"}

    {from: "Decimal9", to: "Decimal18", major: "DecimalSimpleDecimalSimple", javatype: "long"},

    {from: "Decimal9", to: "Decimal28Dense", major: "DecimalSimpleDecimalDense", arraySize: "3"},
    {from: "Decimal9", to: "Decimal38Dense", major: "DecimalSimpleDecimalDense", arraySize: "4"},
    {from: "Decimal18", to: "Decimal28Dense", major: "DecimalSimpleDecimalDense", arraySize: "3"},
    {from: "Decimal18", to: "Decimal38Dense", major: "DecimalSimpleDecimalDense", arraySize: "4"},

    {from: "Decimal9", to: "Decimal28Sparse", major: "DecimalSimpleDecimalSparse", arraySize: "5"},
    {from: "Decimal9", to: "Decimal38Sparse", major: "DecimalSimpleDecimalSparse", arraySize: "6"},
    {from: "Decimal18", to: "Decimal28Sparse", major: "DecimalSimpleDecimalSparse", arraySize: "5"},
    {from: "Decimal18", to: "Decimal38Sparse", major: "DecimalSimpleDecimalSparse", arraySize: "6"},

    {from: "Decimal28Dense", to: "Decimal28Sparse", major: "DecimalDenseDecimalSparse", arraySize: "5"},
    {from: "Decimal28Dense", to: "Decimal38Sparse", major: "DecimalDenseDecimalSparse",arraySize: "6"},
    {from: "Decimal38Dense", to: "Decimal38Sparse", major: "DecimalDenseDecimalSparse", arraySize: "6"},

    {from: "Decimal28Sparse", to: "Decimal28Dense", major: "DecimalSparseDecimalDense",  arraySize: "3"},
    {from: "Decimal28Sparse", to: "Decimal38Dense", major: "DecimalSparseDecimalDense", arraySize: "4"},
    {from: "Decimal38Sparse", to: "Decimal38Dense", major: "DecimalSparseDecimalDense", arraySize: "4"},

    {from: "Decimal28Sparse", to: "VarDecimal", major: "DecimalSparseVarDecimal", arraySize: "6"},
    {from: "Decimal38Sparse", to: "VarDecimal", major: "DecimalSparseVarDecimal", arraySize: "6"},

    {from: "Decimal28Dense", to: "Decimal38Dense", major: "DecimalSimilar", arraySize: "4"},
    {from: "Decimal28Sparse", to: "Decimal38Sparse", major: "DecimalSimilar", arraySize: "6"},

    {from: "Int", to: "Decimal9", major: "IntDecimal", javatype: "int"},
    {from: "Int", to: "Decimal18", major: "IntDecimal", javatype: "long"},
    {from: "Int", to: "Decimal28Sparse", major: "IntDecimal", arraySize: "5"},
    {from: "Int", to: "Decimal38Sparse", major: "IntDecimal", arraySize: "6"},
    {from: "Int", to: "VarDecimal", major: "IntDecimal", arraySize: "6"},

    {from: "BigInt", to: "Decimal9", major: "BigIntDecimal", javatype: "int"},
    {from: "BigInt", to: "Decimal18", major: "BigIntDecimal", javatype: "long"},
    {from: "BigInt", to: "Decimal28Sparse", major: "BigIntDecimal", arraySize: "5"},
    {from: "BigInt", to: "Decimal38Sparse", major: "BigIntDecimal", arraySize: "6"},
    {from: "BigInt", to: "VarDecimal", major: "BigIntDecimal", arraySize: "6"},

    {from: "Decimal9", to: "Int", major: "DecimalSimpleInt", javatype: "int"},
    {from: "Decimal18", to: "Int", major: "DecimalSimpleInt", javatype: "int"},
    {from: "Decimal28Sparse", to: "Int", major: "DecimalComplexInt", javatype: "int"},
    {from: "Decimal38Sparse", to: "Int", major: "DecimalComplexInt", javatype: "int"},
    {from: "VarDecimal", to: "Int", major: "DecimalComplexInt", javatype: "int"},

    {from: "Decimal9", to: "BigInt", major: "DecimalSimpleBigInt", javatype: "long"},
    {from: "Decimal18", to: "BigInt", major: "DecimalSimpleBigInt", javatype: "long"},
    {from: "Decimal28Sparse", to: "BigInt", major: "DecimalComplexBigInt", javatype: "long"},
    {from: "Decimal38Sparse", to: "BigInt", major: "DecimalComplexBigInt", javatype: "long"},
    {from: "VarDecimal", to: "BigInt", major: "DecimalComplexBigInt", javatype: "long"},

    {from: "Decimal9", to: "Float4", major: "DecimalSimpleFloat", javatype: "float"},
    {from: "Decimal18", to: "Float4", major: "DecimalSimpleFloat", javatype: "float"},
    {from: "Decimal28Sparse", to: "Float4", major: "DecimalComplexFloat", javatype: "float"},
    {from: "Decimal28Dense", to: "Float4", major: "DecimalComplexFloat", javatype: "float"},
    {from: "Decimal38Sparse", to: "Float4", major: "DecimalComplexFloat", javatype: "float"},
    {from: "Decimal38Dense", to: "Float4", major: "DecimalComplexFloat", javatype: "float"},
    {from: "VarDecimal", to: "Float4", major: "DecimalComplexFloat", javatype: "float"},

    {from: "Float4", to: "Decimal9", major: "FloatDecimalSimple", javatype: "int"},
    {from: "Float4", to: "Decimal18", major: "FloatDecimalSimple", javatype: "long"},
    {from: "Float4", to: "Decimal28Sparse", major: "FloatDecimalComplex", arraySize: "5"},
    {from: "Float4", to: "Decimal38Sparse", major: "FloatDecimalComplex", arraySize: "6"},
    {from: "Float4", to: "VarDecimal", major: "FloatDecimalComplex", arraySize: "6"},

    {from: "Float8", to: "Decimal9", major: "DoubleDecimalSimple", javatype: "int"},
    {from: "Float8", to: "Decimal18", major: "DoubleDecimalSimple", javatype: "long"},
    {from: "Float8", to: "Decimal28Sparse", major: "DoubleDecimalComplex", arraySize: "5"},
    {from: "Float8", to: "Decimal38Sparse", major: "DoubleDecimalComplex", arraySize: "6"}
    {from: "Float8", to: "VarDecimal", major: "DoubleDecimalComplex", arraySize: "6"}

    {from: "Decimal9", to: "Float8", major: "DecimalSimpleDouble", javatype: "double"},
    {from: "Decimal18", to: "Float8", major: "DecimalSimpleDouble", javatype: "double"},
    {from: "Decimal28Sparse", to: "Float8", major: "DecimalComplexDouble", javatype: "double"},
    {from: "Decimal28Dense", to: "Float8", major: "DecimalComplexDouble", javatype: "double"},
    {from: "Decimal38Sparse", to: "Float8", major: "DecimalComplexDouble", javatype: "double"},
    {from: "Decimal38Dense", to: "Float8", major: "DecimalComplexDouble", javatype: "double"},
    {from: "VarDecimal", to: "Float8", major: "DecimalComplexDouble", javatype: "double"},

    {from: "VarChar", to: "Decimal9", major: "VarCharDecimalSimple", javatype: "int"},
    {from: "VarChar", to: "Decimal18", major: "VarCharDecimalSimple", javatype: "long"},
    {from: "VarChar", to: "Decimal28Sparse", major: "VarCharDecimalComplex", arraySize: "5"},
    {from: "VarChar", to: "Decimal38Sparse", major: "VarCharDecimalComplex", arraySize: "6"},
    {from: "VarChar", to: "VarDecimal", major: "VarCharDecimalComplex", arraySize: "6"},

    {from: "Decimal9", to: "VarChar", major: "DecimalSimpleVarChar", bufferSize: "11", javatype: "int"},
    {from: "Decimal18", to: "VarChar", major: "DecimalSimpleVarChar", bufferSize: "20", javatype: "long"},
    {from: "Decimal28Sparse", to: "VarChar", major: "DecimalComplexVarChar", bufferSize: "30", arraySize: "5"},
    {from: "Decimal38Sparse", to: "VarChar", major: "DecimalComplexVarChar", bufferSize: "40", arraySize: "6"},
    {from: "VarDecimal", to: "VarChar", major: "DecimalComplexVarChar", bufferSize: "40", arraySize: "6"},

    {from: "Decimal18", to: "Decimal9", major: "DownwardDecimalSimpleDecimalSimple", javatype: "int"},

    {from: "Decimal28Sparse", to: "Decimal18", major: "DownwardDecimalSimpleDecimalComplex", javatype: "long"},
    {from: "Decimal28Sparse", to: "Decimal9", major: "DownwardDecimalSimpleDecimalComplex", javatype: "int"},

    {from: "Decimal38Sparse", to: "Decimal28Sparse", major: "DownwardDecimalComplexDecimalComplex", arraySize: "5"},
    {from: "Decimal38Sparse", to: "Decimal18", major: "DownwardDecimalComplexDecimalSimple", javatype: "long"},
    {from: "Decimal38Sparse", to: "Decimal9", major: "DownwardDecimalComplexDecimalSimple", javatype: "int"},

    {from: "VarChar", to: "NullableInt", major: "EmptyString", javaType:"Integer", primeType:"int"},
    {from: "VarChar", to: "NullableBigInt", major: "EmptyString", javaType: "Long", primeType: "long"},
    {from: "VarChar", to: "NullableFloat4", major: "EmptyString", javaType:"Float", parse:"Float"},
    {from: "VarChar", to: "NullableFloat8", major: "EmptyString", javaType:"Double", parse:"Double"},

    {from: "VarChar", to: "NullableDecimal9", major: "EmptyStringVarCharDecimalSimple", javatype: "int"},
    {from: "VarChar", to: "NullableDecimal18", major: "EmptyStringVarCharDecimalSimple", javatype: "long"},
    {from: "VarChar", to: "NullableDecimal28Sparse", major: "EmptyStringVarCharDecimalComplex", arraySize: "5"},
    {from: "VarChar", to: "NullableDecimal38Sparse", major: "EmptyStringVarCharDecimalComplex", arraySize: "6"},
    {from: "VarChar", to: "NullableVarDecimal", major: "EmptyStringVarCharDecimalComplex", arraySize: "6"},

    {from: "NullableVarChar", to: "NullableInt", major: "EmptyString", javaType:"Integer", primeType:"int"},
    {from: "NullableVarChar", to: "NullableBigInt", major: "EmptyString", javaType: "Long", primeType: "long"},
    {from: "NullableVarChar", to: "NullableFloat4", major: "EmptyString", javaType:"Float", parse:"Float"},
    {from: "NullableVarChar", to: "NullableFloat8", major: "EmptyString", javaType:"Double", parse:"Double"},

    {from: "NullableVarChar", to: "NullableDecimal9", major: "EmptyStringVarCharDecimalSimple", javatype: "int"},
    {from: "NullableVarChar", to: "NullableDecimal18", major: "EmptyStringVarCharDecimalSimple", javatype: "long"},
    {from: "NullableVarChar", to: "NullableDecimal28Sparse", major: "EmptyStringVarCharDecimalComplex", arraySize: "5"},
    {from: "NullableVarChar", to: "NullableDecimal38Sparse", major: "EmptyStringVarCharDecimalComplex", arraySize: "6"},
    {from: "NullableVarChar", to: "NullableVarDecimal", major: "EmptyStringVarCharDecimalComplex", arraySize: "6"},

    {from: "NullableVar16Char", to: "NullableInt", major: "EmptyString", javaType:"Integer", primeType:"int"},
    {from: "NullableVar16Char", to: "NullableBigInt", major: "EmptyString", javaType: "Long", primeType: "long"},
    {from: "NullableVar16Char", to: "NullableFloat4", major: "EmptyString", javaType:"Float", parse:"Float"},
    {from: "NullableVar16Char", to: "NullableFloat8", major: "EmptyString", javaType:"Double", parse:"Double"},

    {from: "NullableVar16Char", to: "NullableDecimal9", major: "EmptyStringVarCharDecimalSimple", javatype: "int"},
    {from: "NullableVar16Char", to: "NullableDecimal18", major: "EmptyStringVarCharDecimalSimple", javatype: "long"},
    {from: "NullableVar16Char", to: "NullableDecimal28Sparse", major: "EmptyStringVarCharDecimalComplex", arraySize: "5"},
    {from: "NullableVar16Char", to: "NullableDecimal38Sparse", major: "EmptyStringVarCharDecimalComplex", arraySize: "6"},
    {from: "NullableVar16Char", to: "NullableVarDecimal", major: "EmptyStringVarCharDecimalComplex", arraySize: "6"},

    {from: "NullableVarBinary", to: "NullableInt", major: "EmptyString", javaType:"Integer", primeType:"int"},
    {from: "NullableVarBinary", to: "NullableBigInt", major: "EmptyString", javaType: "Long", primeType: "long"},
    {from: "NullableVarBinary", to: "NullableFloat4", major: "EmptyString", javaType:"Float", parse:"Float"},
    {from: "NullableVarBinary", to: "NullableFloat8", major: "EmptyString", javaType:"Double", parse:"Double"},

    {from: "NullableVarBinary", to: "NullableDecimal9", major: "EmptyStringVarCharDecimalSimple", javatype: "int"},
    {from: "NullableVarBinary", to: "NullableDecimal18", major: "EmptyStringVarCharDecimalSimple", javatype: "long"},
    {from: "NullableVarBinary", to: "NullableDecimal28Sparse", major: "EmptyStringVarCharDecimalComplex", arraySize: "5"},
    {from: "NullableVarBinary", to: "NullableDecimal38Sparse", major: "EmptyStringVarCharDecimalComplex", arraySize: "6"},
    {from: "NullableVarBinary", to: "NullableVarDecimal", major: "EmptyStringVarCharDecimalComplex", arraySize: "6"},
  ]
}