@@ -103,7 +103,7 @@ public static DataFusionDataType getRandomWithoutNull() {
103
103
}
104
104
105
105
public boolean isNumeric () {
106
- return ( this == BIGINT ) || ( this == DOUBLE ) ;
106
+ return this == BIGINT || this == DOUBLE ;
107
107
}
108
108
109
109
// How to parse type in DataFusion's catalog to `DataFusionDataType`
@@ -112,16 +112,16 @@ public boolean isNumeric() {
112
112
// select table_name, column_name, data_type from information_schema.columns;
113
113
public static DataFusionDataType parseFromDataFusionCatalog (String typeString ) {
114
114
switch (typeString ) {
115
- case "Int64" :
116
- return DataFusionDataType .BIGINT ;
117
- case "Float64" :
118
- return DataFusionDataType .DOUBLE ;
119
- case "Boolean" :
120
- return DataFusionDataType .BOOLEAN ;
121
- case "Utf8" :
122
- return DataFusionDataType .STRING ;
123
- default :
124
- dfAssert (false , "Unreachable. All branches should be eovered" );
115
+ case "Int64" :
116
+ return DataFusionDataType .BIGINT ;
117
+ case "Float64" :
118
+ return DataFusionDataType .DOUBLE ;
119
+ case "Boolean" :
120
+ return DataFusionDataType .BOOLEAN ;
121
+ case "Utf8" :
122
+ return DataFusionDataType .STRING ;
123
+ default :
124
+ dfAssert (false , "Unreachable. All branches should be eovered" );
125
125
}
126
126
127
127
dfAssert (false , "Unreachable. All branches should be eovered" );
@@ -134,31 +134,31 @@ public Node<DataFusionExpression> getRandomConstant(DataFusionGlobalState state)
134
134
return DataFusionConstant .createNullConstant ();
135
135
}
136
136
switch (this ) {
137
- case BIGINT :
138
- long randInt = Randomly .getBoolean () ? state .getRandomly ().getInteger ()
139
- : state .getRandomly ().getInteger (-5 , 5 );
140
- return DataFusionConstant .createIntConstant (randInt );
141
- case BOOLEAN :
142
- return new DataFusionConstant .DataFusionBooleanConstant (Randomly .getBoolean ());
143
- case DOUBLE :
144
- if (Randomly .getBoolean ()) {
137
+ case BIGINT :
138
+ long randInt = Randomly .getBoolean () ? state .getRandomly ().getInteger ()
139
+ : state .getRandomly ().getInteger (-5 , 5 );
140
+ return DataFusionConstant .createIntConstant (randInt );
141
+ case BOOLEAN :
142
+ return new DataFusionConstant .DataFusionBooleanConstant (Randomly .getBoolean ());
143
+ case DOUBLE :
145
144
if (Randomly .getBoolean ()) {
146
- Double randomDouble = state .getRandomly ().getDouble (); // [0.0, 1.0);
147
- Double scaledDouble = (randomDouble - 0.5 ) * 2 * Double .MAX_VALUE ;
148
- return new DataFusionConstant .DataFusionDoubleConstant (scaledDouble );
145
+ if (Randomly .getBoolean ()) {
146
+ Double randomDouble = state .getRandomly ().getDouble (); // [0.0, 1.0);
147
+ Double scaledDouble = (randomDouble - 0.5 ) * 2 * Double .MAX_VALUE ;
148
+ return new DataFusionConstant .DataFusionDoubleConstant (scaledDouble );
149
+ }
150
+ String doubleStr = Randomly .fromOptions ("'NaN'::Double" , "'+Inf'::Double" , "'-Inf'::Double" , "-0.0" ,
151
+ "+0.0" );
152
+ return new DataFusionConstant .DataFusionDoubleConstant (doubleStr );
149
153
}
150
- String doubleStr = Randomly .fromOptions ("'NaN'::Double" , "'+Inf'::Double" , "'-Inf'::Double" , "-0.0" ,
151
- "+0.0" );
152
- return new DataFusionConstant .DataFusionDoubleConstant (doubleStr );
153
- }
154
154
155
- return new DataFusionConstant .DataFusionDoubleConstant (state .getRandomly ().getDouble ());
156
- case NULL :
157
- return DataFusionConstant .createNullConstant ();
158
- case STRING :
159
- return new DataFusionConstant .DataFusionStringConstant (state .getRandomly ().getString ());
160
- default :
161
- dfAssert (false , "Unreachable. All branches should be eovered" );
155
+ return new DataFusionConstant .DataFusionDoubleConstant (state .getRandomly ().getDouble ());
156
+ case NULL :
157
+ return DataFusionConstant .createNullConstant ();
158
+ case STRING :
159
+ return new DataFusionConstant .DataFusionStringConstant (state .getRandomly ().getString ());
160
+ default :
161
+ dfAssert (false , "Unreachable. All branches should be eovered" );
162
162
}
163
163
164
164
dfAssert (false , "Unreachable. All branches should be eovered" );
0 commit comments