dtenedor commented on pull request #35690: URL: https://github.com/apache/spark/pull/35690#issuecomment-1058390966
> > Creating NULL default value for NOT NULL column > > Type mismatch between default value literal and column type. > > Upcasting or not in case of type mismatch > > IMO: > > * Not Null column can't have Null default > * Type mismatch between default value literal and column type: we can simply forbid this. Note that we have many numeric types(Byte/Short/Int/Long/Decimal/Float/Double). If both default value literal type and column type are Numeric, it is not considered a mismatch. > * Upcasting or not in case of type mismatch: casting can happen if both of the literal type and column type are Numeric > > @dtenedor WDYT? Good questions, I replied above earlier. We can perform a type coercion from the provided type to the required type, or return an error if the types are not coercible in this way. We can use existing type coercion rules in the analyzer for this part for consistency with the rest of Spark. For example, coercing an integer to floating-point should work, but coercing a floating-point to boolean should return an error to the user. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
