[jira] [Comment Edited] (SPARK-28368) Row.getAs() return different values in scala and java

2019-07-15 Thread Kideok Kim (JIRA)


[ 
https://issues.apache.org/jira/browse/SPARK-28368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16885001#comment-16885001
 ] 

Kideok Kim edited comment on SPARK-28368 at 7/15/19 9:34 AM:
-

Got it. I thought maybe we can add more comments on that api for java client. 
But, on second thoughts, getAs() cannot consider all possible clients (or 
languages)

Thank you for your feedback again :)


was (Author: kideok):
Got it. I thought maybe we can add more comments on that api for java client. 
But, on second thoughts, getAs() cannot consider all possible clients.

Thank you for your feedback again :)

> Row.getAs() return different values in scala and java
> -
>
> Key: SPARK-28368
> URL: https://issues.apache.org/jira/browse/SPARK-28368
> Project: Spark
>  Issue Type: Bug
>  Components: Java API
>Affects Versions: 2.4.3
>Reporter: Kideok Kim
>Priority: Major
>
> *description*
>  * About 
> [org.apache.spark.sql.Row.getAs()|https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-],
>  It doesn't return zero value in java even if I used primitive type null 
> value. (scala return zero value.) Here is an example with spark ver 2.4.3.
> {code:java}
> @Test
> public void testIntegerTypeNull() {
> StructType schema = 
> createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
> Object[] values = new Object[1];
> values[0] = null;
> Row row = new GenericRowWithSchema(values, schema);
> Integer result = row.getAs("test");
> System.out.println(result); // result = null
> }{code}
>  * This problem is shown by not only Integer type, but also all primitive 
> types of java like double, long and so on. I really appreciate if you confirm 
> whether it is a normal or not.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (SPARK-28368) Row.getAs() return different values in scala and java

2019-07-15 Thread Kideok Kim (JIRA)


[ 
https://issues.apache.org/jira/browse/SPARK-28368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16885001#comment-16885001
 ] 

Kideok Kim commented on SPARK-28368:


Got it. I thought maybe we can add more comments on that api for java client. 
But, on second thoughts, getAs() cannot consider all possible clients.

Thank you for your feedback again :)

> Row.getAs() return different values in scala and java
> -
>
> Key: SPARK-28368
> URL: https://issues.apache.org/jira/browse/SPARK-28368
> Project: Spark
>  Issue Type: Bug
>  Components: Java API
>Affects Versions: 2.4.3
>Reporter: Kideok Kim
>Priority: Major
>
> *description*
>  * About 
> [org.apache.spark.sql.Row.getAs()|https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-],
>  It doesn't return zero value in java even if I used primitive type null 
> value. (scala return zero value.) Here is an example with spark ver 2.4.3.
> {code:java}
> @Test
> public void testIntegerTypeNull() {
> StructType schema = 
> createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
> Object[] values = new Object[1];
> values[0] = null;
> Row row = new GenericRowWithSchema(values, schema);
> Integer result = row.getAs("test");
> System.out.println(result); // result = null
> }{code}
>  * This problem is shown by not only Integer type, but also all primitive 
> types of java like double, long and so on. I really appreciate if you confirm 
> whether it is a normal or not.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Comment Edited] (SPARK-28368) Row.getAs() return different values in scala and java

2019-07-15 Thread Kideok Kim (JIRA)


[ 
https://issues.apache.org/jira/browse/SPARK-28368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16884971#comment-16884971
 ] 

Kideok Kim edited comment on SPARK-28368 at 7/15/19 9:23 AM:
-

Thank you for your comment.

I'm using boxed Integer because It is only way to get numeric primitives from 
Row. We cannot use like this _Row.getAs()_.  

So, your comment is that, we always can get null values from null numeric 
primitive types in java even if the getAs() api describes like this and this is 
looks not an issue?
{code:java}
/**
 * Returns the value of a given fieldName.
 * For primitive types if value is null it returns 'zero value' specific for 
primitive
 * ie. 0 for Int - use isNullAt to ensure that value is not null
 *
 * @throws UnsupportedOperationException when schema is not defined.
 * @throws IllegalArgumentException when fieldName do not exist.
 * @throws ClassCastException when data type does not match.
 */
def getAs[T](fieldName: String): T = getAs[T](fieldIndex(fieldName))
{code}
 

 


was (Author: kideok):
Thank you for your comment.

I'm using boxed Integer because It is only way to get numeric primitives from 
Row. We cannot use like this _Row.getAs()_.

> Row.getAs() return different values in scala and java
> -
>
> Key: SPARK-28368
> URL: https://issues.apache.org/jira/browse/SPARK-28368
> Project: Spark
>  Issue Type: Bug
>  Components: Java API
>Affects Versions: 2.4.3
>Reporter: Kideok Kim
>Priority: Major
>
> *description*
>  * About 
> [org.apache.spark.sql.Row.getAs()|https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-],
>  It doesn't return zero value in java even if I used primitive type null 
> value. (scala return zero value.) Here is an example with spark ver 2.4.3.
> {code:java}
> @Test
> public void testIntegerTypeNull() {
> StructType schema = 
> createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
> Object[] values = new Object[1];
> values[0] = null;
> Row row = new GenericRowWithSchema(values, schema);
> Integer result = row.getAs("test");
> System.out.println(result); // result = null
> }{code}
>  * This problem is shown by not only Integer type, but also all primitive 
> types of java like double, long and so on. I really appreciate if you confirm 
> whether it is a normal or not.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (SPARK-28368) Row.getAs() return different values in scala and java

2019-07-15 Thread Kideok Kim (JIRA)


[ 
https://issues.apache.org/jira/browse/SPARK-28368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16884971#comment-16884971
 ] 

Kideok Kim commented on SPARK-28368:


Thank you for your comment.

I'm using boxed Integer because It is only way to get numeric primitives from 
Row. We cannot use like this _Row.getAs()_.

> Row.getAs() return different values in scala and java
> -
>
> Key: SPARK-28368
> URL: https://issues.apache.org/jira/browse/SPARK-28368
> Project: Spark
>  Issue Type: Bug
>  Components: Java API
>Affects Versions: 2.4.3
>Reporter: Kideok Kim
>Priority: Major
>
> *description*
>  * About 
> [org.apache.spark.sql.Row.getAs()|https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-],
>  It doesn't return zero value in java even if I used primitive type null 
> value. (scala return zero value.) Here is an example with spark ver 2.4.3.
> {code:java}
> @Test
> public void testIntegerTypeNull() {
> StructType schema = 
> createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
> Object[] values = new Object[1];
> values[0] = null;
> Row row = new GenericRowWithSchema(values, schema);
> Integer result = row.getAs("test");
> System.out.println(result); // result = null
> }{code}
>  * This problem is shown by not only Integer type, but also all primitive 
> types of java like double, long and so on. I really appreciate if you confirm 
> whether it is a normal or not.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Updated] (SPARK-28368) Row.getAs() return different values in scala and java

2019-07-12 Thread Kideok Kim (JIRA)


 [ 
https://issues.apache.org/jira/browse/SPARK-28368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kideok Kim updated SPARK-28368:
---
Description: 
*description*
 * About 
[org.apache.spark.sql.Row.getAs()|[https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-]],
 It doesn't return zero value in java even if I used primitive type null value. 
(scala return zero value.) Here is an example with spark ver 2.4.3.
{code:java}
@Test
public void testIntegerTypeNull() {
StructType schema = 
createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
Object[] values = new Object[1];
values[0] = null;
Row row = new GenericRowWithSchema(values, schema);
Integer result = row.getAs("test");
System.out.println(result); // result = null
}{code}

 * This problem is shown by not only Integer type, but also all primitive types 
of java like double, long and so on. I really appreciate if you confirm whether 
it is a normal or not.

  was:
*description*
 * About 
[org.apache.spark.sql.Row.getAs()|[https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-]],
 It doesn't return zero value in java even if I used primitive type null value. 
(scala return zero value.) Here is an example with spark ver 2.4.3.
{code:java}
@Test
public void testIntegerTypeNull() {
StructType schema = 
createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
Object[] values = new Object[1];
values[0] = null;
Row row = new GenericRowWithSchema(values, schema);
Integer result = row.getAs("test");
System.out.println(result); // result = null
}{code}

 * This problem is shown by not only Integer type, but also all primitive types 
of java like double, long and so on.
 * I really appreciate if you confirm whether it is a normal or not.


> Row.getAs() return different values in scala and java
> -
>
> Key: SPARK-28368
> URL: https://issues.apache.org/jira/browse/SPARK-28368
> Project: Spark
>  Issue Type: Bug
>  Components: Java API
>Affects Versions: 2.4.3
>Reporter: Kideok Kim
>Priority: Major
>
> *description*
>  * About 
> [org.apache.spark.sql.Row.getAs()|[https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-]],
>  It doesn't return zero value in java even if I used primitive type null 
> value. (scala return zero value.) Here is an example with spark ver 2.4.3.
> {code:java}
> @Test
> public void testIntegerTypeNull() {
> StructType schema = 
> createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
> Object[] values = new Object[1];
> values[0] = null;
> Row row = new GenericRowWithSchema(values, schema);
> Integer result = row.getAs("test");
> System.out.println(result); // result = null
> }{code}
>  * This problem is shown by not only Integer type, but also all primitive 
> types of java like double, long and so on. I really appreciate if you confirm 
> whether it is a normal or not.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Updated] (SPARK-28368) Row.getAs() return different values in scala and java

2019-07-12 Thread Kideok Kim (JIRA)


 [ 
https://issues.apache.org/jira/browse/SPARK-28368?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kideok Kim updated SPARK-28368:
---
Description: 
*description*
 * About 
[org.apache.spark.sql.Row.getAs()|[https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-]],
 It doesn't return zero value in java even if I used primitive type null value. 
(scala return zero value.) Here is an example with spark ver 2.4.3.
{code:java}
@Test
public void testIntegerTypeNull() {
StructType schema = 
createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
Object[] values = new Object[1];
values[0] = null;
Row row = new GenericRowWithSchema(values, schema);
Integer result = row.getAs("test");
System.out.println(result); // result = null
}{code}

 * This problem is shown by not only Integer type, but also all primitive types 
of java like double, long and so on.
 * I really appreciate if you confirm whether it is a normal or not.

  was:
*description*
 * About 
[org.apache.spark.sql.Row.getAs()|[https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-]],
 It doesn't return zero value in java even if I used primitive type null value. 
(scala return zero value.) Here is an example with spark ver 2.4.3.
{code:java}
@Test
public void testIntegerTypeNull() {
StructType schema = 
createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
Object[] values = new Object[1];
values[0] = null;
Row row = new GenericRowWithSchema(values, schema);
Integer result = row.getAs("test");
System.out.println(result); // result = null
}{code}

 * I really appreciate if you confirm whether it is a normal or not.


> Row.getAs() return different values in scala and java
> -
>
> Key: SPARK-28368
> URL: https://issues.apache.org/jira/browse/SPARK-28368
> Project: Spark
>  Issue Type: Bug
>  Components: Java API
>Affects Versions: 2.4.3
>Reporter: Kideok Kim
>Priority: Major
>
> *description*
>  * About 
> [org.apache.spark.sql.Row.getAs()|[https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-]],
>  It doesn't return zero value in java even if I used primitive type null 
> value. (scala return zero value.) Here is an example with spark ver 2.4.3.
> {code:java}
> @Test
> public void testIntegerTypeNull() {
> StructType schema = 
> createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
> Object[] values = new Object[1];
> values[0] = null;
> Row row = new GenericRowWithSchema(values, schema);
> Integer result = row.getAs("test");
> System.out.println(result); // result = null
> }{code}
>  * This problem is shown by not only Integer type, but also all primitive 
> types of java like double, long and so on.
>  * I really appreciate if you confirm whether it is a normal or not.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Created] (SPARK-28368) Row.getAs() return different values in scala and java

2019-07-12 Thread Kideok Kim (JIRA)
Kideok Kim created SPARK-28368:
--

 Summary: Row.getAs() return different values in scala and java
 Key: SPARK-28368
 URL: https://issues.apache.org/jira/browse/SPARK-28368
 Project: Spark
  Issue Type: Bug
  Components: Java API
Affects Versions: 2.4.3
Reporter: Kideok Kim


*description*
 * About 
[org.apache.spark.sql.Row.getAs()|[https://spark.apache.org/docs/2.4.3/api/java/org/apache/spark/sql/Row.html#getAs-java.lang.String-]],
 It doesn't return zero value in java even if I used primitive type null value. 
(scala return zero value.) Here is an example with spark ver 2.4.3.
{code:java}
@Test
public void testIntegerTypeNull() {
StructType schema = 
createStructType(Arrays.asList(createStructField("test", IntegerType, true)));
Object[] values = new Object[1];
values[0] = null;
Row row = new GenericRowWithSchema(values, schema);
Integer result = row.getAs("test");
System.out.println(result); // result = null
}{code}

 * I really appreciate if you confirm whether it is a normal or not.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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