beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-5141) Improve error message when SET unregistered options
Date Thu, 16 Aug 2018 17:52:00 GMT

     [ https://issues.apache.org/jira/browse/BEAM-5141?focusedWorklogId=135435&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-135435
]

ASF GitHub Bot logged work on BEAM-5141:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/Aug/18 17:51
            Start Date: 16/Aug/18 17:51
    Worklog Time Spent: 10m 
      Work Description: amaliujia commented on a change in pull request #6216: [BEAM-5141]
Improve error message when SET unregistered options
URL: https://github.com/apache/beam/pull/6216#discussion_r210685434
 
 

 ##########
 File path: sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamEnumerableConverter.java
 ##########
 @@ -118,7 +120,27 @@ public static PipelineOptions createPipelineOptions(Map<String, String>
map) {
     for (Map.Entry<String, String> entry : map.entrySet()) {
       args[i++] = "--" + entry.getKey() + "=" + entry.getValue();
     }
-    PipelineOptions options = PipelineOptionsFactory.fromArgs(args).withValidation().create();
+
+    PipelineOptions options;
+    try {
+      options = PipelineOptionsFactory.fromArgs(args).withValidation().create();
+    } catch (PipelineOptionUnexpectedPropertyException e) {
+      String errorMessage =
+          String.format(
+              "Pipeline option '%s' is not supported in this context. It must be "
+                  + "cleared by 'RESET %s'.",
+              e.getPropertyName(), e.getPropertyName());
+
+      if (e.getClosestMatches().size() == 1) {
+        errorMessage +=
+            String.format(
+                " Did you mean 'SET %s'?", Iterables.getOnlyElement(e.getClosestMatches()));
+      } else if (e.getClosestMatches().size() > 1) {
+        errorMessage += String.format(" Did you mean SET one of %s?", e.getClosestMatches());
+      }
+      throw new IllegalArgumentException(errorMessage);
 
 Review comment:
   Done!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 135435)
    Time Spent: 4h 50m  (was: 4h 40m)

> Improve error message when SET unregistered options 
> ----------------------------------------------------
>
>                 Key: BEAM-5141
>                 URL: https://issues.apache.org/jira/browse/BEAM-5141
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-sql
>            Reporter: Rui Wang
>            Assignee: Rui Wang
>            Priority: Major
>          Time Spent: 4h 50m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message