@@ -36,21 +36,21 @@ public EventHandler(List<EventSchema> eventSchemas, List<String> eventTimeKeys,
36
36
37
37
// check schema fieldNames
38
38
Set <String > set = new HashSet <>();
39
- for (String attrKey : event .getFieldNames ()) {
40
- if (Utils .isEmpty (attrKey ))
41
- throw new IllegalArgumentException ("attrKey must be non-null and non-empty." );
39
+ for (String fieldName : event .getFieldNames ()) {
40
+ if (Utils .isEmpty (fieldName ))
41
+ throw new IllegalArgumentException ("fieldName must be non-null and non-empty." );
42
42
43
- // check if has duplicate key in attrKeys
44
- if (!set .add (attrKey ))
45
- throw new IllegalArgumentException ("EventSchema cannot has duplicated attrKey in attrKeys ." );
43
+ // check if has duplicate key in fieldName
44
+ if (!set .add (fieldName ))
45
+ throw new IllegalArgumentException ("EventSchema cannot has duplicated fieldName in fieldNames ." );
46
46
}
47
47
48
48
// check schema fieldForms
49
- for (Entity .DATA_FORM attrForm : event .getFieldForms ()) {
50
- if (Objects .isNull (attrForm ))
51
- throw new IllegalArgumentException ("attrForm must be non-null." );
52
- if (attrForm != Entity .DATA_FORM .DF_SCALAR && attrForm != Entity .DATA_FORM .DF_VECTOR )
53
- throw new IllegalArgumentException ("attrForm only can be DF_SCALAR or DF_VECTOR." );
49
+ for (Entity .DATA_FORM fieldForm : event .getFieldForms ()) {
50
+ if (Objects .isNull (fieldForm ))
51
+ throw new IllegalArgumentException ("fieldForm must be non-null." );
52
+ if (fieldForm != Entity .DATA_FORM .DF_SCALAR && fieldForm != Entity .DATA_FORM .DF_VECTOR )
53
+ throw new IllegalArgumentException ("fieldForm only can be DF_SCALAR or DF_VECTOR." );
54
54
}
55
55
56
56
int length = event .getFieldNames ().size ();
@@ -67,14 +67,14 @@ public EventHandler(List<EventSchema> eventSchemas, List<String> eventTimeKeys,
67
67
// check if fieldExtraParams valid
68
68
if (Objects .nonNull (event .getFieldExtraParams ()) && !event .getFieldExtraParams ().isEmpty ()) {
69
69
for (int i = 0 ; i < event .getFieldTypes ().size (); i ++) {
70
- Entity .DATA_TYPE attrType = event .getFieldTypes ().get (i );
70
+ Entity .DATA_TYPE fieldType = event .getFieldTypes ().get (i );
71
71
Integer scale = event .getFieldExtraParams ().get (i );
72
- if (attrType == Entity .DATA_TYPE .DT_DECIMAL32 && (scale < 0 || scale > 9 ))
73
- throw new IllegalArgumentException (attrType + " scale " + scale + " is out of bounds, it must be in [0,9]." );
74
- else if (attrType == Entity .DATA_TYPE .DT_DECIMAL64 && (scale < 0 || scale > 18 ))
75
- throw new IllegalArgumentException (attrType + " scale " + scale + " is out of bounds, it must be in [0,18]." );
76
- else if (attrType == Entity .DATA_TYPE .DT_DECIMAL128 && (scale < 0 || scale > 38 ))
77
- throw new IllegalArgumentException (attrType + " scale " + scale + " is out of bounds, it must be in [0,38]." );
72
+ if (fieldType == Entity .DATA_TYPE .DT_DECIMAL32 && (scale < 0 || scale > 9 ))
73
+ throw new IllegalArgumentException (fieldType + " scale " + scale + " is out of bounds, it must be in [0,9]." );
74
+ else if (fieldType == Entity .DATA_TYPE .DT_DECIMAL64 && (scale < 0 || scale > 18 ))
75
+ throw new IllegalArgumentException (fieldType + " scale " + scale + " is out of bounds, it must be in [0,18]." );
76
+ else if (fieldType == Entity .DATA_TYPE .DT_DECIMAL128 && (scale < 0 || scale > 38 ))
77
+ throw new IllegalArgumentException (fieldType + " scale " + scale + " is out of bounds, it must be in [0,38]." );
78
78
}
79
79
}
80
80
}
@@ -169,23 +169,23 @@ public boolean serializeEvent(String eventType, List<Entity> attributes, List<En
169
169
return false ;
170
170
}
171
171
172
- // check schema attrExtraParams with decimal attribute.
172
+ // check schema fieldExtraParams with decimal attribute.
173
173
EventInfo eventInfo = this .eventInfos .get (eventType );
174
174
EventSchemaEx eventSchema = eventInfo .getEventSchema ();
175
175
EventSchema schema = eventSchema .getSchema ();
176
- List <Integer > attrExtraParams = schema .getFieldExtraParams ();
177
- if (!attrExtraParams .isEmpty ()) {
176
+ List <Integer > fieldExtraParams = schema .getFieldExtraParams ();
177
+ if (!fieldExtraParams .isEmpty ()) {
178
178
Entity attribute = attributes .get (i );
179
179
if (attribute .isScalar ()) {
180
- if ((attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL32 && ((BasicDecimal32 ) attribute ).getScale () != attrExtraParams .get (i ))
181
- || (attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL64 && ((BasicDecimal64 ) attribute ).getScale () != attrExtraParams .get (i ))
182
- || (attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL128 && ((BasicDecimal128 ) attribute ).getScale () != attrExtraParams .get (i )))
183
- throw new IllegalArgumentException ("The decimal attribute' scale doesn't match to schema attrExtraParams scale." );
180
+ if ((attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL32 && ((BasicDecimal32 ) attribute ).getScale () != fieldExtraParams .get (i ))
181
+ || (attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL64 && ((BasicDecimal64 ) attribute ).getScale () != fieldExtraParams .get (i ))
182
+ || (attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL128 && ((BasicDecimal128 ) attribute ).getScale () != fieldExtraParams .get (i )))
183
+ throw new IllegalArgumentException ("The decimal attribute' scale doesn't match to schema fieldExtraParams scale." );
184
184
} else if (attribute .isVector ()) {
185
- if ((attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL32 && ((BasicDecimal32Vector ) attribute ).getScale () != attrExtraParams .get (i ))
186
- || (attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL64 && ((BasicDecimal64Vector ) attribute ).getScale () != attrExtraParams .get (i ))
187
- || (attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL128 && ((BasicDecimal128Vector ) attribute ).getScale () != attrExtraParams .get (i )))
188
- throw new IllegalArgumentException ("The decimal attribute' scale doesn't match to schema attrExtraParams scale." );
185
+ if ((attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL32 && ((BasicDecimal32Vector ) attribute ).getScale () != fieldExtraParams .get (i ))
186
+ || (attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL64 && ((BasicDecimal64Vector ) attribute ).getScale () != fieldExtraParams .get (i ))
187
+ || (attribute .getDataType () == Entity .DATA_TYPE .DT_DECIMAL128 && ((BasicDecimal128Vector ) attribute ).getScale () != fieldExtraParams .get (i )))
188
+ throw new IllegalArgumentException ("The decimal attribute' scale doesn't match to schema fieldExtraParams scale." );
189
189
}
190
190
}
191
191
}
@@ -336,7 +336,7 @@ private boolean checkSchema(List<EventSchema> eventSchemas, List<String> expandT
336
336
Entity .DATA_FORM form = schema .getFieldForms ().get (j );
337
337
338
338
if (Objects .isNull (type )) {
339
- errMsg .append ("attrType must be non-null." );
339
+ errMsg .append ("fieldType must be non-null." );
340
340
return false ;
341
341
}
342
342
0 commit comments