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

    https://github.com/apache/flink/pull/1857#discussion_r58673148
  
    --- Diff: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
 ---
    @@ -673,6 +673,43 @@ public TimeCharacteristic 
getStreamTimeCharacteristic() {
        }
     
        /**
    +    * Creates a new data stream that contains the given elements. The 
elements must all be of the same type, for
    +    * example, all of the {@link String} or {@link Integer}.
    +    * <p>
    +    * The framework will try and determine the exact type from the 
elements. In case of generic elements, it may be
    +    * necessary to manually supply the type information via {@link 
#fromCollection(java.util.Collection,
    +    * org.apache.flink.api.common.typeinfo.TypeInformation)}.
    +    * <p>
    +    * Note that this operation will result in a non-parallel data stream 
source, i.e. a data stream source with a
    +    * degree of parallelism one.
    +    *
    +    * @param clazz
    +    *              The base class type in the collection.
    +    * @param data
    +    *              The array of elements to create the data stream from.
    +    * @param <OUT>
    +    *              The type of the returned data stream
    +    * @return The data stream representing the given array of elements
    +    */
    +   @SafeVarargs
    +   public final <OUT> DataStreamSource<OUT> fromElements(Class<OUT> clazz, 
OUT... data) {
    +           if (data.length == 0) {
    +                   throw new IllegalArgumentException("fromElements needs 
at least one element as argument");
    +           }
    +
    +           TypeInformation<OUT> typeInfo;
    +           try {
    +                   typeInfo = TypeExtractor.getForClass(clazz);
    +           }
    +           catch (Exception e) {
    +                   throw new RuntimeException("Could not create 
TypeInformation for type " + data[0].getClass().getName()
    --- End diff --
    
    shouldn't this exception contain clazz.getName() instead?


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to