Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1581#discussion_r52495987
  
    --- Diff: 
flink-examples/flink-examples-batch/src/main/java/org/apache/flink/examples/java/clustering/KMeans.java
 ---
    @@ -61,42 +62,46 @@
      * <li>Cluster centers are represented by an integer id and a point 
value.<br>
      * For example <code>"1 6.2 3.2\n2 2.9 5.7\n"</code> gives two centers 
(id=1, x=6.2, y=3.2) and (id=2, x=2.9, y=5.7).
      * </ul>
    - * 
    + *
      * <p>
    - * Usage: <code>KMeans &lt;points path&gt; &lt;centers path&gt; &lt;result 
path&gt; &lt;num iterations&gt;</code><br>
    - * If no parameters are provided, the program is run with default data 
from {@link org.apache.flink.examples.java.clustering.util.KMeansData} and 10 
iterations. 
    - * 
    + * Usage: <code>KMeans --points &lt;path&gt; --centroids &lt;path&gt; 
--output &lt;path&gt; --iterations &lt;n&gt;</code><br>
    + * If no parameters are provided, the program is run with default data 
from {@link org.apache.flink.examples.java.clustering.util.KMeansData} and 10 
iterations.
    + *
      * <p>
      * This example shows how to use:
      * <ul>
      * <li>Bulk iterations
      * <li>Broadcast variables in bulk iterations
    - * <li>Custom Java objects (PoJos)
    + * <li>Custom Java objects (POJOs)
      * </ul>
      */
     @SuppressWarnings("serial")
     public class KMeans {
    -   
    -   // 
*************************************************************************
    -   //     PROGRAM
    -   // 
*************************************************************************
    -   
    +
        public static void main(String[] args) throws Exception {
    -           
    -           if(!parseParameters(args)) {
    -                   return;
    +
    +           // Checking input parameters
    +           final ParameterTool params = ParameterTool.fromArgs(args);
    +           if (params.getNumberOfParameters() < 4) {
    --- End diff --
    
    We used this pattern to check unnamed parameters. I think we can do better 
now and a shorter message into the `else` clause of the named parameter check. 
    For this example print something like "Executing K-Means example with 
default point data set. Use --points to specify file input." in the `else` case 
of the `getPointDataSet()` method.


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

Reply via email to