raminqaf commented on code in PR #27972:
URL: https://github.com/apache/flink/pull/27972#discussion_r3504907327


##########
flink-python/pyflink/table/tests/test_compiled_plan.py:
##########
@@ -26,6 +27,10 @@
 JSON_PLAN_DIR = os.path.join(THIS_DIR, "jsonplan")
 
 
+def generate_random_table_name():
+    return "Table{0}".format(str(uuid.uuid1()).replace("-", "_"))

Review Comment:
   just wondering if this can be simplified to:
   ```suggestion
   def generate_random_table_name():
       return f"Table_{uuid.uuid4().hex}"
   ```



##########
flink-python/pyflink/table/tests/test_compiled_plan.py:
##########
@@ -97,6 +102,47 @@ def test_write_load_compiled_plan(self):
                 compiled_plan.as_json_string(), 
compiled_plan_from_string.as_json_string()
             )
 
+    def test_load_plan_execute(self):
+        schema = Schema.new_builder().column("f0", DataTypes.STRING()).build()
+        table = self.t_env.from_descriptor(
+            TableDescriptor.for_connector("datagen")
+            .option("number-of-rows", "5")
+            .schema(schema)
+            .build()
+        )
+        self.t_env.create_temporary_table(
+            "Sink",
+            TableDescriptor.for_connector("blackhole").schema(schema).build(),
+        )
+
+        compiled_plan = table.insert_into("Sink").compile_plan()
+        plan_path = Path(self.tempdir + "/plan.json")

Review Comment:
   Shouldn't there be a generated plan.json file in the PR? 🤔 



##########
flink-python/pyflink/table/tests/test_compiled_plan.py:
##########
@@ -97,6 +102,47 @@ def test_write_load_compiled_plan(self):
                 compiled_plan.as_json_string(), 
compiled_plan_from_string.as_json_string()
             )
 
+    def test_load_plan_execute(self):
+        schema = Schema.new_builder().column("f0", DataTypes.STRING()).build()
+        table = self.t_env.from_descriptor(
+            TableDescriptor.for_connector("datagen")
+            .option("number-of-rows", "5")
+            .schema(schema)
+            .build()
+        )
+        self.t_env.create_temporary_table(
+            "Sink",
+            TableDescriptor.for_connector("blackhole").schema(schema).build(),
+        )
+
+        compiled_plan = table.insert_into("Sink").compile_plan()
+        plan_path = Path(self.tempdir + "/plan.json")

Review Comment:
   can we pythonify a bit here?
   ```suggestion
           plan_path = Path(self.tempdir) / "plan.json"
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to