[GitHub] spark pull request #18553: [SPARK-21327][SQL][PYSPARK] ArrayConstructor shou...

2017-07-06 Thread asfgit
Github user asfgit closed the pull request at:

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


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #18553: [SPARK-21327][SQL][PYSPARK] ArrayConstructor shou...

2017-07-06 Thread HyukjinKwon
Github user HyukjinKwon commented on a diff in the pull request:

https://github.com/apache/spark/pull/18553#discussion_r125886125
  
--- Diff: python/pyspark/sql/tests.py ---
@@ -2342,6 +2342,12 @@ def test_to_pandas(self):
 self.assertEquals(types[2], np.bool)
 self.assertEquals(types[3], np.float32)
 
+def test_create_dataframe_from_array_of_long(self):
+import array
+data = [Row(l=array.array('l', [-9223372036854775808, 0, 
9223372036854775807]))]
--- End diff --

little nit ... we could avoid `l` for the same reason with 
[scala-style-guide#variable-naming-convention](https://github.com/databricks/scala-style-guide#variable-naming-convention).


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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



[GitHub] spark pull request #18553: [SPARK-21327][SQL][PYSPARK] ArrayConstructor shou...

2017-07-06 Thread ueshin
GitHub user ueshin opened a pull request:

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

[SPARK-21327][SQL][PYSPARK] ArrayConstructor should handle an array of 
typecode 'l' as long rather than int in Python 2.

## What changes were proposed in this pull request?

Currently `ArrayConstructor` handles an array of typecode `'l'` as `int` 
when converting Python object in Python 2 into Java object, so if the value is 
larger than `Integer.MAX_VALUE` or smaller than `Integer.MIN_VALUE` then the 
overflow occurs.

```python
import array
data = [Row(l=array.array('l', [-9223372036854775808, 0, 
9223372036854775807]))]
df = spark.createDataFrame(data)
df.show(truncate=False)
```

```
+--+
|l |
+--+
|[0, 0, -1]|
+--+
```

This should be:

```
+--+
|l |
+--+
|[-9223372036854775808, 0, 9223372036854775807]|
+--+
```

## How was this patch tested?

Added a test and existing tests.


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

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

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

https://github.com/apache/spark/pull/18553.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 #18553


commit c729effe944075db3a563a522316ef85250cf322
Author: Takuya UESHIN 
Date:   2017-07-06T08:38:14Z

Modify ArrayConstructor to handle an array of typecode 'l' as long rather 
than int.




---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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