Skip to content

Commit badf2fb

Browse files
committed
revert renaming of valuetypes
1 parent 010bdfb commit badf2fb

File tree

109 files changed

+370
-373
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+370
-373
lines changed

src/main/java/org/apache/sysds/common/Types.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public boolean isUnknown() {
7676
*/
7777
public enum ValueType {
7878
UINT4, UINT8, // Used for parsing in UINT values from numpy.
79-
FP32, FP64, INT32, INT64, BITSET, BOOLEAN, STRING, UNKNOWN,
79+
FP32, FP64, INT32, INT64, BOOLEAN, STRING, UNKNOWN,
8080
CHARACTER;
8181

8282
public boolean isNumeric() {
@@ -86,7 +86,7 @@ public boolean isUnknown() {
8686
return this == UNKNOWN;
8787
}
8888
public boolean isPseudoNumeric() {
89-
return isNumeric() || this == BITSET || this == CHARACTER;
89+
return isNumeric() || this == BOOLEAN || this == CHARACTER;
9090
}
9191
public String toExternalString() {
9292
switch(this) {
@@ -96,7 +96,6 @@ public String toExternalString() {
9696
case UINT8:
9797
case INT32:
9898
case INT64: return "INT";
99-
case BITSET: return "BITSET";
10099
case BOOLEAN: return "BOOLEAN";
101100
default: return toString();
102101
}
@@ -114,7 +113,6 @@ public static ValueType fromExternalString(String value) {
114113
case "INT32": return INT32;
115114
case "INT64":
116115
case "INT": return INT64;
117-
case "BITSET": return BITSET;
118116
case "BOOLEAN": return BOOLEAN;
119117
case "STRING": return STRING;
120118
case "CHARACTER": return CHARACTER;
@@ -197,7 +195,7 @@ else if(b == UNKNOWN)
197195
default:
198196
return a;
199197
}
200-
case BITSET:
198+
case BOOLEAN:
201199
return b; // always higher type in b;
202200
case UNKNOWN:
203201
default:

src/main/java/org/apache/sysds/hops/DataOp.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ protected double computeOutputMemEstimate( long dim1, long dim2, long nnz )
396396
ret = OptimizerUtils.INT_SIZE; break;
397397
case FP64:
398398
ret = OptimizerUtils.DOUBLE_SIZE; break;
399-
case BITSET:
399+
case BOOLEAN:
400400
ret = OptimizerUtils.BOOLEAN_SIZE; break;
401401
case STRING:
402402
// by default, it estimates the size of string[100]

src/main/java/org/apache/sysds/hops/LiteralOp.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public LiteralOp(String value) {
5858
}
5959

6060
public LiteralOp(boolean value) {
61-
super(String.valueOf(value), DataType.SCALAR, ValueType.BITSET);
61+
super(String.valueOf(value), DataType.SCALAR, ValueType.BOOLEAN);
6262
value_boolean = value;
6363
}
6464

@@ -96,8 +96,8 @@ public Lop constructLops()
9696
case FP64:
9797
l = Data.createLiteralLop(ValueType.FP64, Double.toString(value_double));
9898
break;
99-
case BITSET:
100-
l = Data.createLiteralLop(ValueType.BITSET, Boolean.toString(value_boolean));
99+
case BOOLEAN:
100+
l = Data.createLiteralLop(ValueType.BOOLEAN, Boolean.toString(value_boolean));
101101
break;
102102
case STRING:
103103
l = Data.createLiteralLop(ValueType.STRING, value_string);
@@ -131,7 +131,7 @@ public String getOpString() {
131131
case FP64:
132132
val = Double.toString(value_double);
133133
break;
134-
case BITSET:
134+
case BOOLEAN:
135135
val = Boolean.toString(value_boolean);
136136
break;
137137
case STRING:
@@ -156,7 +156,7 @@ protected double computeOutputMemEstimate( long dim1, long dim2, long nnz )
156156
ret = OptimizerUtils.INT_SIZE; break;
157157
case FP64:
158158
ret = OptimizerUtils.DOUBLE_SIZE; break;
159-
case BITSET:
159+
case BOOLEAN:
160160
ret = OptimizerUtils.BOOLEAN_SIZE; break;
161161
case STRING:
162162
ret = this.value_string.length() * OptimizerUtils.CHAR_SIZE; break;
@@ -205,7 +205,7 @@ public long getLongValue() {
205205
return UtilFunctions.toLong(value_double);
206206
case STRING:
207207
return Long.parseLong(value_string);
208-
case BITSET:
208+
case BOOLEAN:
209209
return value_boolean ? 1 : 0;
210210
default:
211211
return -1;
@@ -220,7 +220,7 @@ public double getDoubleValue() {
220220
return value_double;
221221
case STRING:
222222
return Double.parseDouble(value_string);
223-
case BITSET:
223+
case BOOLEAN:
224224
return value_boolean ? 1 : 0;
225225
default:
226226
throw new HopsException("Can not coerce an object of type " + getValueType() + " into Double.");
@@ -235,7 +235,7 @@ public boolean getBooleanValue() {
235235
return (value_double != 0);
236236
case STRING:
237237
return Boolean.parseBoolean(value_string);
238-
case BITSET:
238+
case BOOLEAN:
239239
return value_boolean;
240240
default:
241241
throw new HopsException("Can not coerce an object of type " + getValueType() + " into Boolean.");
@@ -244,7 +244,7 @@ public boolean getBooleanValue() {
244244

245245
public String getStringValue() {
246246
switch( getValueType() ) {
247-
case BITSET:
247+
case BOOLEAN:
248248
return String.valueOf(value_boolean);
249249
case UINT4:
250250
case UINT8:

src/main/java/org/apache/sysds/hops/rewrite/HopRewriteUtils.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static boolean getBooleanValue( LiteralOp op ) {
105105
switch( op.getValueType() ) {
106106
case FP64: return op.getDoubleValue() != 0;
107107
case INT64: return op.getLongValue() != 0;
108-
case BITSET: return op.getBooleanValue();
108+
case BOOLEAN: return op.getBooleanValue();
109109
default: throw new HopsException("Invalid boolean value: "+op.getValueType());
110110
}
111111
}
@@ -115,7 +115,7 @@ public static boolean getBooleanValueSafe( LiteralOp op ) {
115115
switch( op.getValueType() ) {
116116
case FP64: return op.getDoubleValue() != 0;
117117
case INT64: return op.getLongValue() != 0;
118-
case BITSET: return op.getBooleanValue();
118+
case BOOLEAN: return op.getBooleanValue();
119119
default: throw new HopsException("Invalid boolean value: "+op.getValueType());
120120
}
121121
}
@@ -131,7 +131,7 @@ public static double getDoubleValue( LiteralOp op ) {
131131
case STRING:
132132
case FP64: return op.getDoubleValue();
133133
case INT64: return op.getLongValue();
134-
case BITSET: return op.getBooleanValue() ? 1 : 0;
134+
case BOOLEAN: return op.getBooleanValue() ? 1 : 0;
135135
default: throw new HopsException("Invalid double value: "+op.getValueType());
136136
}
137137
}
@@ -140,7 +140,7 @@ public static double getDoubleValueSafe( LiteralOp op ) {
140140
switch( op.getValueType() ) {
141141
case FP64: return op.getDoubleValue();
142142
case INT64: return op.getLongValue();
143-
case BITSET: return op.getBooleanValue() ? 1 : 0;
143+
case BOOLEAN: return op.getBooleanValue() ? 1 : 0;
144144
default: return Double.MAX_VALUE;
145145
}
146146
}
@@ -160,7 +160,7 @@ public static long getIntValue( LiteralOp op ) {
160160
case FP64: return UtilFunctions.toLong(op.getDoubleValue());
161161
case STRING:
162162
case INT64: return op.getLongValue();
163-
case BITSET: return op.getBooleanValue() ? 1 : 0;
163+
case BOOLEAN: return op.getBooleanValue() ? 1 : 0;
164164
default: throw new HopsException("Invalid int value: "+op.getValueType());
165165
}
166166
}
@@ -173,7 +173,7 @@ public static long getIntValueSafe( LiteralOp op ) {
173173
switch( op.getValueType() ) {
174174
case FP64: return UtilFunctions.toLong(op.getDoubleValue());
175175
case INT64: return op.getLongValue();
176-
case BITSET: return op.getBooleanValue() ? 1 : 0;
176+
case BOOLEAN: return op.getBooleanValue() ? 1 : 0;
177177
default: return Long.MAX_VALUE;
178178
}
179179
}
@@ -196,7 +196,7 @@ public static boolean isLiteralOfValue(Hop hop, String val) {
196196
public static boolean isLiteralOfValue( Hop hop, boolean val ) {
197197
try {
198198
return (hop instanceof LiteralOp
199-
&& (hop.getValueType()==ValueType.BITSET)
199+
&& (hop.getValueType()==ValueType.BOOLEAN)
200200
&& ((LiteralOp)hop).getBooleanValue()==val);
201201
}
202202
catch(HopsException ex) {
@@ -655,7 +655,7 @@ public static BinaryOp createBinary(Hop input1, Hop input2, OpOp2 op, boolean ou
655655
mainInput.getValueType(), op, input1, input2);
656656
//cleanup value type for relational operations
657657
if( bop.isPPredOperation() && bop.getDataType().isScalar() )
658-
bop.setValueType(ValueType.BITSET);
658+
bop.setValueType(ValueType.BOOLEAN);
659659
bop.setOuterVectorOperation(outer);
660660
bop.setBlocksize(mainInput.getBlocksize());
661661
copyLineNumbers(mainInput, bop);

src/main/java/org/apache/sysds/parser/BooleanIdentifier.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private void setInfo(boolean val) {
5050
_val = val;
5151
setDimensions(0, 0);
5252
computeDataType();
53-
setValueType(ValueType.BITSET);
53+
setValueType(ValueType.BOOLEAN);
5454
}
5555

5656
@Override

src/main/java/org/apache/sysds/parser/BuiltinFunctionExpression.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<Stri
616616
case INT32:
617617
case UINT8:
618618
case UINT4:
619-
case BITSET:
619+
case BOOLEAN:
620620
output.setValueType(ValueType.INT64);
621621
break;
622622
case UNKNOWN:
@@ -779,7 +779,7 @@ else if( getAllExpr().length == 2 ) { //binary
779779
//output.setDataType(id.getDataType()); //TODO whenever we support multiple matrix value types, currently noop.
780780
output.setDimensions(0, 0);
781781
output.setBlocksize(0);
782-
output.setValueType(ValueType.BITSET);
782+
output.setValueType(ValueType.BOOLEAN);
783783
break;
784784

785785
case IFELSE:
@@ -966,7 +966,7 @@ else if( getOpCode() == Builtins.RBIND ) {
966966
output.setDataType(DataType.SCALAR);
967967
output.setDimensions(0, 0);
968968
output.setBlocksize(0);
969-
output.setValueType(ValueType.BITSET);
969+
output.setValueType(ValueType.BOOLEAN);
970970
break;
971971

972972
// Contingency tables
@@ -1270,20 +1270,20 @@ else if( getOpCode() == Builtins.RBIND ) {
12701270
checkNumParameters(4);
12711271
if (in[3].getOutput().getValueType() != ValueType.INT64)
12721272
throw new LanguageException("Fourth argument, seed, to sample() must be an integer value.");
1273-
if (in[2].getOutput().getValueType() != ValueType.BITSET)
1273+
if (in[2].getOutput().getValueType() != ValueType.BOOLEAN)
12741274
throw new LanguageException("Third argument to sample() must either denote replacement policy (boolean) or seed (integer).");
12751275
}
12761276
else if(in.length == 3)
12771277
{
12781278
checkNumParameters(3);
1279-
if (in[2].getOutput().getValueType() != ValueType.BITSET
1279+
if (in[2].getOutput().getValueType() != ValueType.BOOLEAN
12801280
&& in[2].getOutput().getValueType() != ValueType.INT64 )
12811281
throw new LanguageException("Third argument to sample() must either denote replacement policy (boolean) or seed (integer).");
12821282
}
12831283

12841284
if ( check && in.length >= 3
12851285
&& isConstant(in[2])
1286-
&& in[2].getOutput().getValueType() == ValueType.BITSET
1286+
&& in[2].getOutput().getValueType() == ValueType.BOOLEAN
12871287
&& !((BooleanIdentifier)in[2]).getValue() )
12881288
throw new LanguageException("Sample (size=" + ((ConstIdentifier)in[0]).getLongValue()
12891289
+ ") larger than population (size=" + ((ConstIdentifier)in[1]).getLongValue()
@@ -2030,7 +2030,7 @@ public static Builtins getValueTypeCastOperator( ValueType vt ) {
20302030
return Builtins.CAST_AS_DOUBLE;
20312031
case INT64:
20322032
return Builtins.CAST_AS_INT;
2033-
case BITSET:
2033+
case BOOLEAN:
20342034
return Builtins.CAST_AS_BOOLEAN;
20352035
default:
20362036
throw new LanguageException("No cast for value type "+vt);

src/main/java/org/apache/sysds/parser/DMLTranslator.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ else if (passedSB instanceof IfStatementBlock) {
14391439

14401440
DataIdentifier target = new DataIdentifier(Expression.getTempName());
14411441
target.setDataType(DataType.SCALAR);
1442-
target.setValueType(ValueType.BITSET);
1442+
target.setValueType(ValueType.BOOLEAN);
14431443
target.setParseInfo(passedSB);
14441444
Hop predicateHops = null;
14451445
Expression predicate = cp.getPredicate();
@@ -1806,12 +1806,12 @@ private Hop processRelationalExpression(RelationalExpression source, DataIdentif
18061806
}
18071807
else if(left.getDataType() == DataType.FRAME || right.getDataType() == DataType.FRAME) {
18081808
target.setDataType(DataType.FRAME);
1809-
target.setValueType(ValueType.BITSET);
1809+
target.setValueType(ValueType.BOOLEAN);
18101810
}
18111811
else {
18121812
// Added to support scalar relational comparison
18131813
target.setDataType(DataType.SCALAR);
1814-
target.setValueType(ValueType.BITSET);
1814+
target.setValueType(ValueType.BOOLEAN);
18151815
}
18161816
}
18171817

@@ -1859,7 +1859,7 @@ private Hop processBooleanExpression(BooleanExpression source, DataIdentifier ta
18591859
if (target == null)
18601860
target = createTarget(source);
18611861
if( target.getDataType().isScalar() )
1862-
target.setValueType(ValueType.BITSET);
1862+
target.setValueType(ValueType.BOOLEAN);
18631863

18641864
if (source.getRight() == null) {
18651865
Hop currUop = new UnaryOp(target.getName(), target.getDataType(), target.getValueType(), OpOp1.NOT, left);
@@ -2561,7 +2561,7 @@ else if ( sop.equalsIgnoreCase("!=") )
25612561
currBuiltinOp = new UnaryOp(target.getName(), target.getDataType(), ValueType.INT64, OpOp1.CAST_AS_INT, expr);
25622562
break;
25632563
case CAST_AS_BOOLEAN:
2564-
currBuiltinOp = new UnaryOp(target.getName(), target.getDataType(), ValueType.BITSET, OpOp1.CAST_AS_BOOLEAN, expr);
2564+
currBuiltinOp = new UnaryOp(target.getName(), target.getDataType(), ValueType.BOOLEAN, OpOp1.CAST_AS_BOOLEAN, expr);
25652565
break;
25662566
case LOCAL:
25672567
currBuiltinOp = new UnaryOp(target.getName(), target.getDataType(), ValueType.FP64, OpOp1.LOCAL, expr);
@@ -2708,7 +2708,7 @@ else if ( sop.equalsIgnoreCase("!=") )
27082708
else if ( in.length == 3 )
27092709
{
27102710
// check if the third argument is "replace" or "seed"
2711-
if ( expr3.getValueType() == ValueType.BITSET)
2711+
if ( expr3.getValueType() == ValueType.BOOLEAN)
27122712
{
27132713
tmpparams.put(DataExpression.RAND_PDF, expr3);
27142714
tmpparams.put(DataExpression.RAND_SEED, new LiteralOp(DataGenOp.UNSPECIFIED_SEED) );

src/main/java/org/apache/sysds/parser/DataExpression.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,8 +1129,8 @@ else if( getVarParam(READNNZPARAM) != null ) {
11291129
//handle all csv default parameters
11301130
handleCSVDefaultParam(DELIM_DELIMITER, ValueType.STRING, conditional);
11311131
handleCSVDefaultParam(DELIM_FILL_VALUE, ValueType.FP64, conditional);
1132-
handleCSVDefaultParam(DELIM_HAS_HEADER_ROW, ValueType.BITSET, conditional);
1133-
handleCSVDefaultParam(DELIM_FILL, ValueType.BITSET, conditional);
1132+
handleCSVDefaultParam(DELIM_HAS_HEADER_ROW, ValueType.BOOLEAN, conditional);
1133+
handleCSVDefaultParam(DELIM_FILL, ValueType.BOOLEAN, conditional);
11341134
handleCSVDefaultParam(DELIM_NA_STRINGS, ValueType.STRING, conditional);
11351135
}
11361136

@@ -1283,7 +1283,7 @@ else if (valueTypeString.equalsIgnoreCase(Statement.STRING_VALUE_TYPE))
12831283
else if (valueTypeString.equalsIgnoreCase(Statement.INT_VALUE_TYPE))
12841284
getOutput().setValueType(ValueType.INT64);
12851285
else if (valueTypeString.equalsIgnoreCase(Statement.BOOLEAN_VALUE_TYPE))
1286-
getOutput().setValueType(ValueType.BITSET);
1286+
getOutput().setValueType(ValueType.BOOLEAN);
12871287
else if (valueTypeString.equalsIgnoreCase(ValueType.UNKNOWN.name()))
12881288
getOutput().setValueType(ValueType.UNKNOWN);
12891289
else {
@@ -2168,7 +2168,7 @@ private void handleCSVDefaultParam(String param, ValueType vt, boolean condition
21682168
if (getVarParam(param) == null) {
21692169
Expression defExpr = null;
21702170
switch(vt) {
2171-
case BITSET:
2171+
case BOOLEAN:
21722172
defExpr = new BooleanIdentifier((boolean)csvDefaults.get(param), this);
21732173
break;
21742174
case FP64:
@@ -2198,7 +2198,7 @@ private boolean checkFormatType(FileFormat... fmts) {
21982198
private boolean checkValueType(Expression expr, ValueType vt) {
21992199
return (vt == ValueType.STRING && expr instanceof StringIdentifier)
22002200
|| (vt == ValueType.FP64 && (expr instanceof DoubleIdentifier || expr instanceof IntIdentifier))
2201-
|| (vt == ValueType.BITSET && expr instanceof BooleanIdentifier);
2201+
|| (vt == ValueType.BOOLEAN && expr instanceof BooleanIdentifier);
22022202
}
22032203

22042204
private void validateParams(boolean conditional, Set<String> validParamNames, String legalMessage) {

src/main/java/org/apache/sysds/parser/ForStatementBlock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ private static Expression replaceConstantVar(Expression expr, HashMap<String, Co
386386
case INT64:
387387
ret = new IntIdentifier((IntIdentifier) constValue, expr);
388388
break;
389-
case BITSET:
389+
case BOOLEAN:
390390
ret = new IntIdentifier(
391391
new BooleanObject(((BooleanIdentifier) constValue).getValue()).getLongValue(), expr);
392392
break;

src/main/java/org/apache/sysds/parser/Identifier.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public void computeDataType() {
202202

203203
public void setBooleanProperties(){
204204
_dataType = DataType.SCALAR;
205-
_valueType = ValueType.BITSET;
205+
_valueType = ValueType.BOOLEAN;
206206
_dim1 = 0;
207207
_dim2 = 0;
208208
_blocksize = 0;
@@ -222,7 +222,7 @@ public void setIntProperties(){
222222

223223

224224
public boolean isScalarBoolean(){
225-
return (_valueType == ValueType.BITSET) && (_dataType == DataType.SCALAR);
225+
return (_valueType == ValueType.BOOLEAN) && (_dataType == DataType.SCALAR);
226226
}
227227

228228
public boolean dimsKnown(){

0 commit comments

Comments
 (0)