Skip to content
Open
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
59 changes: 31 additions & 28 deletions src/Storages/ObjectStorage/StorageObjectStorageSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,40 +886,43 @@ StorageObjectStorageSource::ReaderHolder StorageObjectStorageSource::createReade
}
}
}
for (const auto & column : requested_columns_list)
if (file_meta_data.has_value() && !file_meta_data.value()->columns_info.empty())
{
const auto & column_name = column.first;
for (const auto & column : requested_columns_list)
{
const auto & column_name = column.first;

if (file_meta_data.value()->columns_info.contains(column_name))
continue;
if (file_meta_data.value()->columns_info.contains(column_name))
continue;

if (!column.second.second.type->isNullable())
continue;
if (!column.second.second.type->isNullable())
continue;

/// With View over Iceberg table we have someting like 'materialize(time)' as column_name
/// Simple cheap check
if (column_name.starts_with("materialize(") && column_name.ends_with(")"))
continue;
/// With View over Iceberg table we have someting like 'materialize(time)' as column_name
/// Simple cheap check
if (column_name.starts_with("materialize(") && column_name.ends_with(")"))
continue;

/// Skip columns produced by prewhere or row-level filter expressions —
/// they are computed at read time, not stored in the file.
if (format_filter_info
&& ((format_filter_info->prewhere_info && column_name == format_filter_info->prewhere_info->prewhere_column_name)
|| (format_filter_info->row_level_filter && column_name == format_filter_info->row_level_filter->column_name)))
continue;
/// Skip columns produced by prewhere or row-level filter expressions —
/// they are computed at read time, not stored in the file.
if (format_filter_info
&& ((format_filter_info->prewhere_info && column_name == format_filter_info->prewhere_info->prewhere_column_name)
|| (format_filter_info->row_level_filter && column_name == format_filter_info->row_level_filter->column_name)))
continue;

/// Column is nullable and absent in file
constant_columns_with_values[column.second.first] =
ConstColumnWithValue{
column.second.second,
Field()
};
constant_columns.insert(column_name);

LOG_DEBUG(log, "In file {} constant column '{}' type '{}' with value 'NULL'",
object_info->getPath(),
column_name,
column.second.second.type);
/// Column is nullable and absent in file
constant_columns_with_values[column.second.first] =
ConstColumnWithValue{
column.second.second,
Field()
};
constant_columns.insert(column_name);

LOG_DEBUG(log, "In file {} constant column '{}' type '{}' with value 'NULL'",
object_info->getPath(),
column_name,
column.second.second.type);
}
}
}

Expand Down
Loading
Loading