You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by HyukjinKwon <gi...@git.apache.org> on 2016/09/11 23:29:17 UTC
[GitHub] spark pull request #14947: [WIP][SPARK-17388][SQL] Support for inferring typ...
Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/14947#discussion_r78304894
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala ---
@@ -307,20 +308,34 @@ object PartitioningUtils {
/**
* Converts a string to a [[Literal]] with automatic type inference. Currently only supports
- * [[IntegerType]], [[LongType]], [[DoubleType]], [[DecimalType.SYSTEM_DEFAULT]], and
- * [[StringType]].
+ * [[IntegerType]], [[LongType]], [[DoubleType]], [[DecimalType.SYSTEM_DEFAULT]], [[DateType]]
+ * [[TimestampType]], and [[StringType]].
*/
private[datasources] def inferPartitionColumnValue(
raw: String,
defaultPartitionName: String,
typeInference: Boolean): Literal = {
+ val decimalTry = Try {
+ // `BigDecimal` conversion can fail when the `field` is not a form of number.
+ val bigDecimal = new JBigDecimal(raw)
+ // It reduces the cases for decimals by disallowing values having scale (eg. `1.1`).
+ require(bigDecimal.scale <= 0)
+ // `DecimalType` conversion can fail when
+ // 1. The precision is bigger than 38.
+ // 2. scale is bigger than precision.
--- End diff --
Ah, I think I should check this requirement. I will update the description soon too.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org