[ 
https://issues.apache.org/jira/browse/PARQUET-379?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cheng Lian updated PARQUET-379:
-------------------------------
    Description: 
The following ScalaTest test case
{code}
  test("merge primitive types") {
    val expected =
      Types.buildMessage()
        .addField(
          Types
            .required(INT32)
            .as(DECIMAL)
            .precision(9)
            .scale(0)
            .named("f"))
        .named("root")

    assert(expected.union(expected) === expected)
  }
{code}
produces the following assertion error
{noformat}
message root {
  required int32 f;
}
 did not equal message root {
  required int32 f (DECIMAL(9,0));
}
{noformat}
This is because {{PrimitiveType.union}} doesn't handle original type properly. 
An open question is that, can two primitive types with the same primitive type 
name but different original types be unioned?

  was:
The following test case
{code}
  test("merge primitive types") {
    val expected =
      Types.buildMessage()
        .addField(
          Types
            .required(INT32)
            .as(DECIMAL)
            .precision(9)
            .scale(0)
            .named("f"))
        .named("root")

    assert(expected.union(expected) === expected)
  }
{code}
produces the following assertion error
{noformat}
message root {
  required int32 f;
}
 did not equal message root {
  required int32 f (DECIMAL(9,0));
}
{noformat}
This is because {{PrimitiveType.union}} doesn't handle original type properly. 
An open question is that, can two primitive types with the same primitive type 
name but different original types be unioned?


> PrimitiveType.union erases original type
> ----------------------------------------
>
>                 Key: PARQUET-379
>                 URL: https://issues.apache.org/jira/browse/PARQUET-379
>             Project: Parquet
>          Issue Type: Bug
>          Components: parquet-mr
>    Affects Versions: 1.5.0, 1.6.0, 1.7.0, 1.8.0
>            Reporter: Cheng Lian
>
> The following ScalaTest test case
> {code}
>   test("merge primitive types") {
>     val expected =
>       Types.buildMessage()
>         .addField(
>           Types
>             .required(INT32)
>             .as(DECIMAL)
>             .precision(9)
>             .scale(0)
>             .named("f"))
>         .named("root")
>     assert(expected.union(expected) === expected)
>   }
> {code}
> produces the following assertion error
> {noformat}
> message root {
>   required int32 f;
> }
>  did not equal message root {
>   required int32 f (DECIMAL(9,0));
> }
> {noformat}
> This is because {{PrimitiveType.union}} doesn't handle original type 
> properly. An open question is that, can two primitive types with the same 
> primitive type name but different original types be unioned?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to