Skip to content

PrimitiveType.union erases original type #1456

@asfimport

Description

@asfimport

The following ScalaTest test case

  test("merge primitive types") {
    val expected =
      Types.buildMessage()
        .addField(
          Types
            .required(INT32)
            .as(DECIMAL)
            .precision(7)
            .scale(2)
            .named("f"))
        .named("root")

    assert(expected.union(expected) === expected)
  }

produces the following assertion error

message root {
  required int32 f;
}
 did not equal message root {
  required int32 f (DECIMAL(9,0));
}

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?

Reporter: Cheng Lian / @liancheng
Assignee: Cheng Lian / @liancheng

Related issues:

PRs and other links:

Note: This issue was originally created as PARQUET-379. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions