Skip to content

Conversation

@davies
Copy link
Contributor

@davies davies commented Aug 25, 2015

In BigDecimal or java.math.BigDecimal, the precision could be smaller than scale, for example, BigDecimal("0.001") has precision = 1 and scale = 3. But DecimalType require that the precision should be larger than scale, so we should use the maximum of precision and scale when inferring the schema from decimal literal.

@SparkQA
Copy link

SparkQA commented Aug 25, 2015

Test build #41550 has finished for PR 8428 at commit 6f53bb8.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yhuai
Copy link
Contributor

yhuai commented Aug 25, 2015

LGTM. Merging to master and branch 1.5.

@yhuai
Copy link
Contributor

yhuai commented Aug 25, 2015

btw, it will be good to add a comment to explain why we do a max.

asfgit pushed a commit that referenced this pull request Aug 25, 2015
In BigDecimal or java.math.BigDecimal, the precision could be smaller than scale, for example, BigDecimal("0.001") has precision = 1 and scale = 3. But DecimalType require that the precision should be larger than scale, so we should use the maximum of precision and scale when inferring the schema from decimal literal.

Author: Davies Liu <[email protected]>

Closes #8428 from davies/smaller_decimal.

(cherry picked from commit ec89bd8)
Signed-off-by: Yin Huai <[email protected]>
@asfgit asfgit closed this in ec89bd8 Aug 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants