Skip to content
Open
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 @@ -1284,7 +1284,9 @@ public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, Con
Location location = Location.of(transaction.table().location());
try {
// S3 Tables internally assigns a unique location for each table
if (!isS3Tables(location.toString())) {
// we create a non-staged table if tableLocation.isEmpty(), in that case, the table location will not be
// empty
if (!isS3Tables(location.toString()) && !(tableLocation != null && tableLocation.isEmpty())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about non-zero length whitespaced string : " " or " " ?
should we also add tableLocation.isBlank() e.g.

if (!isS3Tables(location.toString()) && !(tableLocation != null && tableLocation.isEmpty() && tableLocation.isBlank())) {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can add those, wondering if location should reject such invalid location strings?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, this all looks a bit hacky, ideally, we'd know if a table's creation was staged or not and only verify the location's emptiness based on that

TrinoFileSystem fileSystem = fileSystemFactory.create(session.getIdentity(), transaction.table().io().properties());
if (!replace && fileSystem.listFiles(location).hasNext()) {
throw new TrinoException(ICEBERG_FILESYSTEM_ERROR, format("" +
Expand Down
Loading