[
https://issues.apache.org/jira/browse/FLINK-8407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16341026#comment-16341026
]
ASF GitHub Bot commented on FLINK-8407:
---------------------------------------
Github user aljoscha commented on a diff in the pull request:
https://github.com/apache/flink/pull/5369#discussion_r164106802
--- Diff:
flink-streaming-scala/src/test/scala/org/apache/flink/streaming/api/scala/DataStreamTest.scala
---
@@ -299,6 +299,19 @@ class DataStreamTest extends AbstractTestBase {
assert(4 ==
env.getStreamGraph.getStreamNode(sink.getTransformation.getId).getParallelism)
}
+ /**
+ * Tests setting the parallelism after a partitioning operation (e.g.,
broadcast, rescale)
+ * should fail.
+ */
+ @Test(expected = classOf[UnsupportedOperationException])
+ def testParallelismFailAfterPartitioning(): Unit = {
+ val env: StreamExecutionEnvironment =
StreamExecutionEnvironment.getExecutionEnvironment
+
+ val src = env.fromElements(new Tuple2[Long, Long](0L, 0L))
+ val map = src.map(_ => (0L, 0L))
+ map.broadcast.setParallelism(1)
--- End diff --
I think this test could be made more fine-grained by verifying that
`setParallelism()` is in fact throwing the exception. As it is now, any parts
of the code could throw the exception and the test would succeed.
You could use the `ExpectedException` `@Rule`, as for example here:
https://github.com/apache/flink/blob/db440f2434423a23207ba666b33f4ccb55adede5/flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/BufferPoolFactoryTest.java#L53
> Setting the parallelism after a partitioning operation should be forbidden
> --------------------------------------------------------------------------
>
> Key: FLINK-8407
> URL: https://issues.apache.org/jira/browse/FLINK-8407
> Project: Flink
> Issue Type: Bug
> Components: DataStream API
> Reporter: Xingcan Cui
> Assignee: Xingcan Cui
> Priority: Major
>
> Partitioning operations ({{shuffle}}, {{rescale}}, etc.) for a {{DataStream}}
> create new {{DataStreams}}, which allow the users to set parallelisms for
> them. However, the {{PartitionTransformations}} in these returned
> {{DataStreams}} will only add virtual nodes, whose parallelisms could not be
> specified, in the execution graph. We should forbid users to set the
> parallelism after a partitioning operation since they won't actually work.
> Also the corresponding documents should be updated.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)