spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zero323 <>
Subject [GitHub] spark pull request #17077: [SPARK-16931][PYTHON][SQL] Add Python wrapper for...
Date Mon, 10 Apr 2017 10:29:03 GMT
Github user zero323 commented on a diff in the pull request:
    --- Diff: python/pyspark/sql/ ---
    @@ -2038,6 +2038,61 @@ def test_BinaryType_serialization(self):
             df = self.spark.createDataFrame(data, schema=schema)
    +    def test_bucketed_write(self):
    +        data = [
    +            (1, "foo", 3.0), (2, "foo", 5.0),
    +            (3, "bar", -1.0), (4, "bar", 6.0),
    +        ]
    +        df = self.spark.createDataFrame(data, ["x", "y", "z"])
    +        # Test write with one bucketing column
    +        df.write.bucketBy(3, "x").mode("overwrite").saveAsTable("pyspark_bucket")
    +        self.assertEqual(
    +            len([c for c in self.spark.catalog.listColumns("pyspark_bucket")
    +                 if == "x" and c.isBucket]),
    --- End diff --
    We can simplify this to 
        catalog =  self.spark.catalog
        sum( == "x" and c.isBucket for c in catalog.listColumns("pyspark_bucket"))
    f you think this is more readable but i am not convinced that it makes sense to use a
separate variable here. We have a few tests like this, don't care about the sequence itself,
and I think it would only pollute the scope. But if you have strong feelings about I am happy
to adjust it.
    Regarding the comment style... Right now (excluding `bucket` by and `sortBy`) we have

    - 23 docstrings with:
    - 7 docstrings:
    in `readwriter`.  As you said both are valid, but if we want to keep only one convention
it would be a good idea to adjust a whole module.

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message