AMashenkov commented on a change in pull request #243:
URL: https://github.com/apache/ignite-3/pull/243#discussion_r679931183
##########
File path: modules/api/src/main/java/org/apache/ignite/schema/ColumnType.java
##########
@@ -105,15 +105,55 @@ public static VarLenColumnType blobOf(int length) {
return new VarLenColumnType(ColumnTypeSpec.BLOB, length);
}
+ /**
+ * Number type factory method.
+ *
+ * @param precision Precision of value.
+ * @return Number type.
+ */
+ public static NumberColumnType numberOf(int precision) {
+ if (precision <= 0)
+ throw new IllegalArgumentException("Precision [" + precision + "]
must be positive integer value.");
+
+ return new NumberColumnType(ColumnTypeSpec.NUMBER, precision);
+ }
+
+ /**
+ * Number type factory method.
+ *
+ * @return Number type.
+ */
+ public static NumberColumnType numberOf() {
+ return new NumberColumnType(ColumnTypeSpec.NUMBER,
NumberColumnType.UNDEFINED);
+ }
+
/**
* Decimal type factory method.
*
* @param precision Precision.
* @param scale Scale.
- * @return Numeric type.
+ * @return Decimal type.
+ */
+ public static DecimalColumnType decimalOf(int precision, int scale) {
+ if (precision <= 0)
+ throw new IllegalArgumentException("Precision [" + precision + "]
must be positive integer value.");
+ if (scale < 0)
+ throw new IllegalArgumentException("Scale [" + scale + "] must be
non-negative integer value.");
Review comment:
Just non-negative or strictly positive ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]