Skip to content

Commit

Permalink
Cast table properties based on its type in Faker connector
Browse files Browse the repository at this point in the history
  • Loading branch information
sthandassery authored and ebyhr committed Jan 29, 2025
1 parent 798eb19 commit aa8f839
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ public synchronized void setTableProperties(ConnectorSession session, ConnectorT
oldInfo.properties().entrySet().stream()
.filter(entry -> !properties.containsKey(entry.getKey())),
properties.entrySet().stream()
.filter(entry -> entry.getValue().isPresent()))
.filter(entry -> entry.getValue().isPresent())
.map(entry -> Map.entry(entry.getKey(), entry.getValue().get())))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
tables.put(tableName, oldInfo.withProperties(newProperties));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,4 +447,14 @@ String columnSchema()
return "%s %s NOT NULL%s".formatted(name, type, propertiesSchema.isEmpty() ? "" : " WITH (%s)".formatted(propertiesSchema));
}
}

@Test
void testSetTableProperties()
{
try (TestTable table = newTrinoTable("set_table_properties", "(id INTEGER, name VARCHAR)")) {
assertUpdate("ALTER TABLE " + table.getName() + " SET PROPERTIES default_limit = 100");
assertThat((String) computeScalar("SHOW CREATE TABLE " + table.getName()))
.contains("default_limit = 100");
}
}
}

0 comments on commit aa8f839

Please sign in to comment.