Open Fokko opened 1 month ago
Can you move then rename? Just wondering how this is actually set up.
Yes, this works:
@Test
public void testMoveAfterRename() {
Schema schema =
new Schema(
required(1, "b", Types.IntegerType.get()),
required(2, "c", Types.IntegerType.get()));
Schema actual = new SchemaUpdate(schema, 4)
.moveBefore("c", "b")
.renameColumn("c", "a")
.apply();
Schema expected =
new Schema(
required(2, "a", Types.IntegerType.get()),
required(1, "b", Types.IntegerType.get()));
assertThat(actual.asStruct()).isEqualTo(expected.asStruct());
}
To make the other way around work, we have to track the in-flight renames, so it is essentially more bookkeeping. Just wanted to check if this is intentional.
I doubt we intend it to work that way, but I'm not sure it's worth fixing?
I ran into it when you evolve an existing schema, the move operation is different when you add new fields or evolve existing fields (you can move newly added fields). But you're right, it's probably something nice to have.
This may be a good first issue for someone @Fokko In case you want to leave it for someone else to tinker with :)
@RussellSpitzer For sure!
@Fokko , I'd like to take this issue, could you assign it to me?
Apache Iceberg version
1.6.0 (latest release)
Query engine
Other
Please describe the bug 🐞
When you try to move a renamed column, this fails:
It cannot find the column:
Should we allow this?
Willingness to contribute