Github user qiuchenjian commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2990#discussion_r241935024
--- Diff:
integration/spark-common/src/main/scala/org/apache/spark/sql/catalyst/CarbonDDLSqlParser.scala
---
@@ -1464,31 +1464,46 @@ abstract class CarbonDDLSqlParser extends
AbstractCarbonSparkSQLParser {
* @param values
* @return
*/
- def parseDataType(dataType: String, values: Option[List[(Int, Int)]]):
DataTypeInfo = {
+ def parseDataType(
+ dataType: String,
+ values: Option[List[(Int, Int)]],
+ isColumnRename: Boolean): DataTypeInfo = {
+ def validateAndGetDecimalDatatype: DataTypeInfo = {
+ var precision: Int = 0
+ var scale: Int = 0
+ if (values.isDefined) {
+ precision = values.get(0)._1
+ scale = values.get(0)._2
+ } else {
+ throw new MalformedCarbonCommandException("Decimal format provided
is invalid")
+ }
+ // precision should be > 0 and <= 38 and scale should be >= 0 and <=
38
+ if (precision < 1 || precision > 38) {
--- End diff --
Magic number 38 should be defined in constant,
---