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

    https://github.com/apache/spark/pull/13280#discussion_r64947459
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaSuite.scala
 ---
    @@ -1415,6 +1425,18 @@ class ParquetSchemaSuite extends ParquetSchemaTest {
             |}
           """.stripMargin)
     
    +  // !! HACK ALERT !!
    +  //
    +  // PARQUET-363 and PARQUET-278: Parquet 1.8.1 doesn't allow constructing 
empty groups, but does
    +  // support empty groups as valid projections, for cases like select 
count(*). This work-around
    +  // constructs a group with a dummy column and then removes it.
    +  //
    +  // This is fixed in Parquet so this hack should be removed when Parquet 
is updated.
    +  val emptySchema: MessageType = Types.buildMessage()
    +      .required(PrimitiveType.PrimitiveTypeName.INT32).named("dummy")
    +      .named("root")
    +  emptySchema.getFields.clear(); // remove the dummy column
    --- End diff --
    
    Yes, those are equivalent. The builders nest so that it reads like the 
schema definition and the parent builder is returned by `named`.


---
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.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to