You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by ueshin <gi...@git.apache.org> on 2017/07/28 03:48:31 UTC

[GitHub] spark pull request #18754: [WIP][SPARK-21552][SQL] Add DecimalType support t...

GitHub user ueshin opened a pull request:

    https://github.com/apache/spark/pull/18754

    [WIP][SPARK-21552][SQL] Add DecimalType support to ArrowWriter.

    ## What changes were proposed in this pull request?
    
    Decimal type is not yet supported in `ArrowWriter`.
    This is adding the decimal type support.
    
    ## How was this patch tested?
    
    Added a test to `ArrowConvertersSuite`.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ueshin/apache-spark issues/SPARK-21552

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18754.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18754
    
----
commit 9e60762d830c320967742d80cb17c55631f6b11a
Author: Takuya UESHIN <ue...@databricks.com>
Date:   2017-07-26T04:34:31Z

    Add DecimalType support to ArrowWriter.

----


---
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


[GitHub] spark issue #18754: [WIP][SPARK-21552][SQL] Add DecimalType support to Arrow...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    **[Test build #85293 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85293/testReport)** for PR 18754 at commit [`e29f833`](https://github.com/apache/spark/commit/e29f8330e455e6bf66d2c69f2875a70ae2c71cdb).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    Just took a quick look and looks fine to me too.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    **[Test build #85365 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85365/testReport)** for PR 18754 at commit [`025f298`](https://github.com/apache/spark/commit/025f2987c54fb3c9c7de36c525a8caaa72d1f3ee).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    **[Test build #85365 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85365/testReport)** for PR 18754 at commit [`025f298`](https://github.com/apache/spark/commit/025f2987c54fb3c9c7de36c525a8caaa72d1f3ee).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18754: [WIP][SPARK-21552][SQL] Add DecimalType support t...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18754#discussion_r139777828
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowWriter.scala ---
    @@ -224,6 +226,25 @@ private[arrow] class DoubleWriter(val valueVector: NullableFloat8Vector) extends
       }
     }
     
    +private[arrow] class DecimalWriter(
    +    val valueVector: NullableDecimalVector,
    +    precision: Int,
    +    scale: Int) extends ArrowFieldWriter {
    +
    +  override def valueMutator: NullableDecimalVector#Mutator = valueVector.getMutator()
    +
    +  override def setNull(): Unit = {
    +    valueMutator.setNull(count)
    +  }
    +
    +  override def setValue(input: SpecializedGetters, ordinal: Int): Unit = {
    +    valueMutator.setIndexDefined(count)
    +    val decimal = input.getDecimal(ordinal, precision, scale)
    +    decimal.changePrecision(precision, scale)
    +    DecimalUtility.writeBigDecimalToArrowBuf(decimal.toJavaBigDecimal, valueVector.getBuffer, count)
    --- End diff --
    
    I got the same error, let me dig into it a little


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [WIP][SPARK-21552][SQL] Add DecimalType support to Arrow...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85293/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18754: [WIP][SPARK-21552][SQL] Add DecimalType support t...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18754#discussion_r139762422
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowWriter.scala ---
    @@ -224,6 +226,25 @@ private[arrow] class DoubleWriter(val valueVector: NullableFloat8Vector) extends
       }
     }
     
    +private[arrow] class DecimalWriter(
    +    val valueVector: NullableDecimalVector,
    +    precision: Int,
    +    scale: Int) extends ArrowFieldWriter {
    +
    +  override def valueMutator: NullableDecimalVector#Mutator = valueVector.getMutator()
    +
    +  override def setNull(): Unit = {
    +    valueMutator.setNull(count)
    +  }
    +
    +  override def setValue(input: SpecializedGetters, ordinal: Int): Unit = {
    +    valueMutator.setIndexDefined(count)
    +    val decimal = input.getDecimal(ordinal, precision, scale)
    +    decimal.changePrecision(precision, scale)
    +    DecimalUtility.writeBigDecimalToArrowBuf(decimal.toJavaBigDecimal, valueVector.getBuffer, count)
    --- End diff --
    
    I haven't tried running those tests for 0.7 yet, let me see if I can reproduce


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    retest this please


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    Merged to master.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85371/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18754: [WIP][SPARK-21552][SQL] Add DecimalType support t...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18754#discussion_r158422348
  
    --- Diff: python/pyspark/sql/types.py ---
    @@ -1617,7 +1617,7 @@ def to_arrow_type(dt):
         elif type(dt) == DoubleType:
             arrow_type = pa.float64()
         elif type(dt) == DecimalType:
    -        arrow_type = pa.decimal(dt.precision, dt.scale)
    +        arrow_type = pa.decimal128(dt.precision, dt.scale)
    --- End diff --
    
    @wesm @BryanCutler Is this a right way to define decimal type for Arrow?
    I also wonder if there is a limit for precision and scale?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [WIP][SPARK-21552][SQL] Add DecimalType support to Arrow...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    **[Test build #85293 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85293/testReport)** for PR 18754 at commit [`e29f833`](https://github.com/apache/spark/commit/e29f8330e455e6bf66d2c69f2875a70ae2c71cdb).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18754: [WIP][SPARK-21552][SQL] Add DecimalType support t...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18754#discussion_r139872489
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowWriter.scala ---
    @@ -224,6 +226,25 @@ private[arrow] class DoubleWriter(val valueVector: NullableFloat8Vector) extends
       }
     }
     
    +private[arrow] class DecimalWriter(
    +    val valueVector: NullableDecimalVector,
    +    precision: Int,
    +    scale: Int) extends ArrowFieldWriter {
    +
    +  override def valueMutator: NullableDecimalVector#Mutator = valueVector.getMutator()
    +
    +  override def setNull(): Unit = {
    +    valueMutator.setNull(count)
    +  }
    +
    +  override def setValue(input: SpecializedGetters, ordinal: Int): Unit = {
    +    valueMutator.setIndexDefined(count)
    +    val decimal = input.getDecimal(ordinal, precision, scale)
    +    decimal.changePrecision(precision, scale)
    +    DecimalUtility.writeBigDecimalToArrowBuf(decimal.toJavaBigDecimal, valueVector.getBuffer, count)
    --- End diff --
    
    I've confirmed it fixes the failure. Thanks!


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18754: [SPARK-21552][SQL] Add DecimalType support to Arr...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/18754


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [WIP][SPARK-21552][SQL] Add DecimalType support to Arrow...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    Merged build finished. Test FAILed.


---
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


[GitHub] spark issue #18754: [WIP][SPARK-21552][SQL] Add DecimalType support to Arrow...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    **[Test build #80014 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80014/testReport)** for PR 18754 at commit [`9e60762`](https://github.com/apache/spark/commit/9e60762d830c320967742d80cb17c55631f6b11a).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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


[GitHub] spark pull request #18754: [WIP][SPARK-21552][SQL] Add DecimalType support t...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18754#discussion_r139612110
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowWriter.scala ---
    @@ -224,6 +226,25 @@ private[arrow] class DoubleWriter(val valueVector: NullableFloat8Vector) extends
       }
     }
     
    +private[arrow] class DecimalWriter(
    +    val valueVector: NullableDecimalVector,
    +    precision: Int,
    +    scale: Int) extends ArrowFieldWriter {
    +
    +  override def valueMutator: NullableDecimalVector#Mutator = valueVector.getMutator()
    +
    +  override def setNull(): Unit = {
    +    valueMutator.setNull(count)
    +  }
    +
    +  override def setValue(input: SpecializedGetters, ordinal: Int): Unit = {
    +    valueMutator.setIndexDefined(count)
    +    val decimal = input.getDecimal(ordinal, precision, scale)
    +    decimal.changePrecision(precision, scale)
    +    DecimalUtility.writeBigDecimalToArrowBuf(decimal.toJavaBigDecimal, valueVector.getBuffer, count)
    --- End diff --
    
    @BryanCutler Thanks, I'll update it to use `setSafe` after upgrading Arrow to 0.7.
    
    Btw, when I tested upgrading to 0.7 locally, `ArrowConvertersSuite.string type conversion` came to fail. Do you have any ideas of that?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18754: [WIP][SPARK-21552][SQL] Add DecimalType support t...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18754#discussion_r139562172
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowWriter.scala ---
    @@ -224,6 +226,25 @@ private[arrow] class DoubleWriter(val valueVector: NullableFloat8Vector) extends
       }
     }
     
    +private[arrow] class DecimalWriter(
    +    val valueVector: NullableDecimalVector,
    +    precision: Int,
    +    scale: Int) extends ArrowFieldWriter {
    +
    +  override def valueMutator: NullableDecimalVector#Mutator = valueVector.getMutator()
    +
    +  override def setNull(): Unit = {
    +    valueMutator.setNull(count)
    +  }
    +
    +  override def setValue(input: SpecializedGetters, ordinal: Int): Unit = {
    +    valueMutator.setIndexDefined(count)
    +    val decimal = input.getDecimal(ordinal, precision, scale)
    +    decimal.changePrecision(precision, scale)
    +    DecimalUtility.writeBigDecimalToArrowBuf(decimal.toJavaBigDecimal, valueVector.getBuffer, count)
    --- End diff --
    
    This will be easier in Arrow 0.7. There is now APIs for directly setting values with `setSafe` for BigDecimal.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18754: [SPARK-21552][SQL] Add DecimalType support to Arr...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18754#discussion_r158567491
  
    --- Diff: python/pyspark/sql/types.py ---
    @@ -1617,7 +1617,7 @@ def to_arrow_type(dt):
         elif type(dt) == DoubleType:
             arrow_type = pa.float64()
         elif type(dt) == DecimalType:
    -        arrow_type = pa.decimal(dt.precision, dt.scale)
    +        arrow_type = pa.decimal128(dt.precision, dt.scale)
    --- End diff --
    
    yes, that's the right way - it is now fixed at 128 bits internally.  I believe the Arrow Java limit is the same as Spark 38/38, not sure if pyarrow is the same but I think so.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [WIP][SPARK-21552][SQL] Add DecimalType support to Arrow...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/80014/
    Test FAILed.


---
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


[GitHub] spark issue #18754: [WIP][SPARK-21552][SQL] Add DecimalType support to Arrow...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    **[Test build #85371 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85371/testReport)** for PR 18754 at commit [`025f298`](https://github.com/apache/spark/commit/025f2987c54fb3c9c7de36c525a8caaa72d1f3ee).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18754: [SPARK-21552][SQL] Add DecimalType support to Arr...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18754#discussion_r158566190
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowWriter.scala ---
    @@ -214,6 +216,22 @@ private[arrow] class DoubleWriter(val valueVector: Float8Vector) extends ArrowFi
       }
     }
     
    +private[arrow] class DecimalWriter(
    +    val valueVector: DecimalVector,
    +    precision: Int,
    +    scale: Int) extends ArrowFieldWriter {
    +
    +  override def setNull(): Unit = {
    +    valueVector.setNull(count)
    +  }
    +
    +  override def setValue(input: SpecializedGetters, ordinal: Int): Unit = {
    +    val decimal = input.getDecimal(ordinal, precision, scale)
    +    decimal.changePrecision(precision, scale)
    --- End diff --
    
    Is it necessary to call `changePrecision` even though `getDecimal` already takes the precision/scale as input - is it not guaranteed to return a decimal with that scale?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/85365/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [SPARK-21552][SQL] Add DecimalType support to ArrowWrite...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    **[Test build #85371 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/85371/testReport)** for PR 18754 at commit [`025f298`](https://github.com/apache/spark/commit/025f2987c54fb3c9c7de36c525a8caaa72d1f3ee).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18754: [WIP][SPARK-21552][SQL] Add DecimalType support t...

Posted by BryanCutler <gi...@git.apache.org>.
Github user BryanCutler commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18754#discussion_r139835312
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowWriter.scala ---
    @@ -224,6 +226,25 @@ private[arrow] class DoubleWriter(val valueVector: NullableFloat8Vector) extends
       }
     }
     
    +private[arrow] class DecimalWriter(
    +    val valueVector: NullableDecimalVector,
    +    precision: Int,
    +    scale: Int) extends ArrowFieldWriter {
    +
    +  override def valueMutator: NullableDecimalVector#Mutator = valueVector.getMutator()
    +
    +  override def setNull(): Unit = {
    +    valueMutator.setNull(count)
    +  }
    +
    +  override def setValue(input: SpecializedGetters, ordinal: Int): Unit = {
    +    valueMutator.setIndexDefined(count)
    +    val decimal = input.getDecimal(ordinal, precision, scale)
    +    decimal.changePrecision(precision, scale)
    +    DecimalUtility.writeBigDecimalToArrowBuf(decimal.toJavaBigDecimal, valueVector.getBuffer, count)
    --- End diff --
    
    It was an issue with StringWriter, I put the fix in #19284 please take a look, thanks!


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #18754: [SPARK-21552][SQL] Add DecimalType support to Arr...

Posted by ueshin <gi...@git.apache.org>.
Github user ueshin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18754#discussion_r158620106
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowWriter.scala ---
    @@ -214,6 +216,22 @@ private[arrow] class DoubleWriter(val valueVector: Float8Vector) extends ArrowFi
       }
     }
     
    +private[arrow] class DecimalWriter(
    +    val valueVector: DecimalVector,
    +    precision: Int,
    +    scale: Int) extends ArrowFieldWriter {
    +
    +  override def setNull(): Unit = {
    +    valueVector.setNull(count)
    +  }
    +
    +  override def setValue(input: SpecializedGetters, ordinal: Int): Unit = {
    +    val decimal = input.getDecimal(ordinal, precision, scale)
    +    decimal.changePrecision(precision, scale)
    --- End diff --
    
    Unfortunately, it depends on the implementation of `getDecimal` for now.
    Btw, I guess we need to check the return value of `changePrecision()` and set `null` if the value is `false`, which means overflow.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #18754: [WIP][SPARK-21552][SQL] Add DecimalType support to Arrow...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18754
  
    **[Test build #80014 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/80014/testReport)** for PR 18754 at commit [`9e60762`](https://github.com/apache/spark/commit/9e60762d830c320967742d80cb17c55631f6b11a).


---
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