Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,7 @@ public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTable
.setType(column.getType())
.setNullable(column.isNullable())
.setComment(column.getComment())
.setHidden(isMetadataColumnId(column.getId()))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1815,6 +1815,16 @@ public void testDropPartitionColumn()
assertUpdate("DROP TABLE " + tableName);
}

@Test
void testDropHiddenMetadataColumn()
{
try (TestTable table = newTrinoTable("test_drop_metadata_column_", "(id int, col int)")) {
assertQueryFails("ALTER TABLE " + table.getName() + " DROP COLUMN \"$partition\"", "line 1:1: Cannot drop hidden column");
assertQueryFails("ALTER TABLE " + table.getName() + " DROP COLUMN \"$path\"", "line 1:1: Cannot drop hidden column");
assertQueryFails("ALTER TABLE " + table.getName() + " DROP COLUMN \"$file_modified_time\"", "line 1:1: Cannot drop hidden column");
}
}

@Test
public void testDropColumnUsedInOlderPartitionSpecs()
{
Expand Down