[jira] [Commented] (SPARK-21640) Method mode with String parameters within DataFrameWriter is error prone

2017-11-06 Thread Apache Spark (JIRA)

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

Apache Spark commented on SPARK-21640:
--

User 'HyukjinKwon' has created a pull request for this issue:
https://github.com/apache/spark/pull/19673

> Method mode with String parameters within DataFrameWriter is error prone
> 
>
> Key: SPARK-21640
> URL: https://issues.apache.org/jira/browse/SPARK-21640
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 2.2.0
>Reporter: Alberto
>Assignee: Alberto
>Priority: Trivial
> Fix For: 2.3.0
>
>
> The following method:
> {code:java}
> def mode(saveMode: String): DataFrameWriter[T]
> {code}
> sets the SaveMode of the DataFrameWriter depending on the string that is 
> pass-in as parameter.
> There is a java Enum with all the save modes which are Append, Overwrite, 
> ErrorIfExists and Ignore. In my current project I was writing some code that 
> was using this enum to get the string value that I use to call the mode 
> method:
> {code:java}
>   private[utils] val configModeAppend = SaveMode.Append.toString.toLowerCase
>   private[utils] val configModeErrorIfExists = 
> SaveMode.ErrorIfExists.toString.toLowerCase
>   private[utils] val configModeIgnore = SaveMode.Ignore.toString.toLowerCase
>   private[utils] val configModeOverwrite = 
> SaveMode.Overwrite.toString.toLowerCase
> {code}
> The configModeErrorIfExists val contains the value "errorifexists" and when I 
> call the saveMode method using this string it does not match. I suggest to 
> include "errorifexists" as a right match for the ErrorIfExists SaveMode.
> Will create a PR to address this issue ASAP.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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



[jira] [Commented] (SPARK-21640) Method mode with String parameters within DataFrameWriter is error prone

2017-08-04 Thread Alberto (JIRA)

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

Alberto commented on SPARK-21640:
-

Yes, that's is [~srowen]. I don't like to use string to do such things but in 
the case I have to.

If there is an enum I think the "best worst" scenario is to use the values to 
call it. And if the other values work I guess it should be also valid for the 
errorifexists case.

> Method mode with String parameters within DataFrameWriter is error prone
> 
>
> Key: SPARK-21640
> URL: https://issues.apache.org/jira/browse/SPARK-21640
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 2.2.0
>Reporter: Alberto
>Priority: Trivial
>
> The following method:
> {code:java}
> def mode(saveMode: String): DataFrameWriter[T]
> {code}
> sets the SaveMode of the DataFrameWriter depending on the string that is 
> pass-in as parameter.
> There is a java Enum with all the save modes which are Append, Overwrite, 
> ErrorIfExists and Ignore. In my current project I was writing some code that 
> was using this enum to get the string value that I use to call the mode 
> method:
> {code:java}
>   private[utils] val configModeAppend = SaveMode.Append.toString.toLowerCase
>   private[utils] val configModeErrorIfExists = 
> SaveMode.ErrorIfExists.toString.toLowerCase
>   private[utils] val configModeIgnore = SaveMode.Ignore.toString.toLowerCase
>   private[utils] val configModeOverwrite = 
> SaveMode.Overwrite.toString.toLowerCase
> {code}
> The configModeErrorIfExists val contains the value "errorifexists" and when I 
> call the saveMode method using this string it does not match. I suggest to 
> include "errorifexists" as a right match for the ErrorIfExists SaveMode.
> Will create a PR to address this issue ASAP.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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



[jira] [Commented] (SPARK-21640) Method mode with String parameters within DataFrameWriter is error prone

2017-08-04 Thread Sean Owen (JIRA)

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

Sean Owen commented on SPARK-21640:
---

Why would you lower-case it? you're saying that doesn't work, and it shouldn't. 
Just don't do that.

> Method mode with String parameters within DataFrameWriter is error prone
> 
>
> Key: SPARK-21640
> URL: https://issues.apache.org/jira/browse/SPARK-21640
> Project: Spark
>  Issue Type: Improvement
>  Components: SQL
>Affects Versions: 2.2.0
>Reporter: Alberto
>
> The following method:
> {code:java}
> def mode(saveMode: String): DataFrameWriter[T]
> {code}
> sets the SaveMode of the DataFrameWriter depending on the string that is 
> pass-in as parameter.
> There is a java Enum with all the save modes which are Append, Overwrite, 
> ErrorIfExists and Ignore. In my current project I was writing some code that 
> was using this enum to get the string value that I use to call the mode 
> method:
> {code:java}
>   private[utils] val configModeAppend = SaveMode.Append.toString.toLowerCase
>   private[utils] val configModeErrorIfExists = 
> SaveMode.ErrorIfExists.toString.toLowerCase
>   private[utils] val configModeIgnore = SaveMode.Ignore.toString.toLowerCase
>   private[utils] val configModeOverwrite = 
> SaveMode.Overwrite.toString.toLowerCase
> {code}
> The configModeErrorIfExists val contains the value "errorifexists" and when I 
> call the saveMode method using this string it does not match. I suggest to 
> include "errorifexists" as a right match for the ErrorIfExists SaveMode.
> Will create a PR to address this issue ASAP.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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