-
Notifications
You must be signed in to change notification settings - Fork 28k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-11827] [SQL] Adding java.math.BigInteger support in Java type inference for POJOs and Java collections #10125
Conversation
@kevinyu98 please write a meaningful title and description. |
Hello Sean: I am sorry, I forgot to update the title and description. I have made the changes, please let me know if anything needs to be changed. Thanks. |
Test build #47689 has finished for PR 10125 at commit
|
@@ -326,6 +326,7 @@ object CatalystTypeConverters { | |||
val decimal = scalaValue match { | |||
case d: BigDecimal => Decimal(d) | |||
case d: JavaBigDecimal => Decimal(d) | |||
case d: BigInteger => Decimal(d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we support both java and scala big integer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Wenchen: Sure, I will add that.
get latest code from upstream
adding trim characters support
get latest code for pr12646
merge latest code
merge upstream/master
Ping @kevinyu98 -- update the PR or close it? |
@srowen: sorry for the long delay. I will work on it now. |
1f77804
to
ae0be70
Compare
|
||
case class ReflectData3( | ||
scalaBigInt: scala.math.BigInt | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you move this to a single line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just removed that code.
@srowen @davies @cloud-fan I updated the code, can you help review? Sorry for the delay. Thanks. |
Test build #58587 has finished for PR 10125 at commit
|
I just run the ./dev/mima locally, it works, |
retest it please. |
Test build #58754 has finished for PR 10125 at commit
|
@cloud-fan can you help take a look? I have made changes based on your comments. Thanks. |
@@ -326,6 +327,7 @@ object CatalystTypeConverters { | |||
val decimal = scalaValue match { | |||
case d: BigDecimal => Decimal(d) | |||
case d: JavaBigDecimal => Decimal(d) | |||
case d: JavaBigInteger => Decimal(d) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you hold on until #13008? Then we can revert this change as CatalystTypeConverter
is not used when creating DataFrame.
sure, I will do that. |
#13008 is merged, can you revert the |
@cloud-fan I tried, and it still fail. It didn't go through the createDataFrame you added in SparkSession. the beanToRows will create internal rows and it is from SQLContext. Should we add RowEncoder into the beansToRows call or leave the code as it is ? Thanks. here is the trace scala.MatchError: 1234567 (of class java.math.BigInteger) |
@@ -109,6 +109,7 @@ object DecimalType extends AbstractDataType { | |||
val MAX_SCALE = 38 | |||
val SYSTEM_DEFAULT: DecimalType = DecimalType(MAX_PRECISION, 18) | |||
val USER_DEFAULT: DecimalType = DecimalType(10, 0) | |||
val BIGINT_DEFAULT: DecimalType = DecimalType(MAX_PRECISION, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a private[sql] val BigIntDecimal = DecimalType(38, 0)
to the next section, instead of doing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I will do that.
retest it please. |
Row first = df.select("a", "b", "c", "d").first(); | ||
Assert.assertEquals(new StructField("e", DataTypes.createDecimalType(38,0), true, Metadata.empty()), | ||
schema.apply("e")); | ||
Row first = df.select("a", "b", "c", "d","e").first(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a space before "e"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will add
mostly LGTM, pending jenkins. |
I will push the latest one after jenkins finish. Thanks very much ! |
Test build #58869 has finished for PR 10125 at commit
|
Test build #58872 has finished for PR 10125 at commit
|
…nference for POJOs and Java collections Hello : Can you help check this PR? I am adding support for the java.math.BigInteger for java bean code path. I saw internally spark is converting the BigInteger to BigDecimal in ColumnType.scala and CatalystRowConverter.scala. I use the similar way and convert the BigInteger to the BigDecimal. . Author: Kevin Yu <qyu@us.ibm.com> Closes #10125 from kevinyu98/working_on_spark-11827. (cherry picked from commit 17591d9) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
thanks, merging to master and 2.0! |
This seems to have broken build for Java 7:
|
Looks like bigintval.longValue() should have been used. |
See #13233 |
When would the addendum be checked in ? For people using Java 7, it is inconvenient because they have to modify Decimal.scala otherwise the compilation would fail. |
Hello : Can you help check this PR? I am adding support for the java.math.BigInteger for java bean code path. I saw internally spark is converting the BigInteger to BigDecimal in ColumnType.scala and CatalystRowConverter.scala. I use the similar way and convert the BigInteger to the BigDecimal. .