aboutsummaryrefslogtreecommitdiff
path: root/exec/java-exec/src/main/codegen/data/Casts.tdd
blob: e43572a87813b7d8cf744c4ad6780250000f625c (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
# 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: "VarDecimal", major: "DecimalToVarDecimal"},
    {from: "Decimal18", to: "VarDecimal", major: "DecimalToVarDecimal"},
    {from: "Decimal28Sparse", to: "VarDecimal", major: "DecimalToVarDecimal"},
    {from: "Decimal38Sparse", to: "VarDecimal", major: "DecimalToVarDecimal"},
    {from: "VarDecimal", to: "VarDecimal", major: "DecimalToVarDecimal"},

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

    {from: "Int", to: "VarDecimal", major: "IntDecimal"},

    {from: "BigInt", to: "VarDecimal", major: "BigIntDecimal"},

    {from: "VarDecimal", to: "Int", major: "DecimalComplexInt", javatype: "int"},

    {from: "VarDecimal", to: "BigInt", major: "DecimalComplexBigInt", javatype: "long"},

    {from: "VarDecimal", to: "Float4", major: "DecimalComplexFloat", javatype: "float"},

    {from: "Float4", to: "VarDecimal", major: "FloatDecimalComplex"},

    {from: "Float8", to: "VarDecimal", major: "DoubleDecimalComplex"},

    {from: "VarDecimal", to: "Float8", major: "DecimalComplexDouble", javatype: "double"},

    {from: "VarChar", to: "VarDecimal", major: "VarCharDecimalComplex"},

    {from: "VarDecimal", to: "VarChar", major: "DecimalComplexVarChar"},

    {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: "NullableVarDecimal", major: "EmptyStringVarCharDecimalComplex"},

    {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: "NullableVarDecimal", major: "EmptyStringVarCharDecimalComplex"},

    {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: "NullableVarDecimal", major: "EmptyStringVarCharDecimalComplex"},

    {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: "NullableVarDecimal", major: "EmptyStringVarCharDecimalComplex"},
  ]
}