-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter table columns in bulk #18956
Filter table columns in bulk #18956
Conversation
6a6aa5c
to
4517213
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should deprecate the old method
@@ -153,6 +153,12 @@ public Set<String> filterColumns(SystemSecurityContext context, CatalogSchemaTab | |||
return columns; | |||
} | |||
|
|||
@Override | |||
public Map<SchemaTableName, Set<String>> filterColumns(SystemSecurityContext context, String catalogName, Map<SchemaTableName, Set<String>> tableColumns) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we deprecate the other filterColumns
method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
lib/trino-array/pom.xml
Outdated
@@ -13,7 +13,6 @@ | |||
|
|||
<properties> | |||
<air.main.basedir>${project.parent.basedir}</air.main.basedir> | |||
<air.compiler.fail-warnings>true</air.compiler.fail-warnings> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure thing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done! -- #18971
4274fd1
to
3dc8f85
Compare
3dc8f85
to
da06cea
Compare
requireNonNull(tableColumns, "tableColumns is null"); | ||
|
||
Set<SchemaTableName> filteredTables = filterTables(securityContext, catalogName, tableColumns.keySet()); | ||
if (!filteredTables.equals(tableColumns.keySet())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if
seems redundant as equals
uses contains
as well so in some cases it will execute contains
twice for some elements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would expect equals to invoke contains only if sets are equal (size chcked first?), and there is no second call then for given element
}); | ||
List<ColumnMetadata> columns = metadata.getTableMetadata(session, targetTableHandle).getColumns(); | ||
|
||
Set<String> allowedColumns = accessControl.filterColumns( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can all redirected tables be collected and batched in a single accessControl.filterColumns
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they would need to be grouped by catalog, but yes, that's possible
note that there are also other deficiencies around redirected tables handling. this requires test coverage and is not the part i am focusing on
Refactor information_schema.columns handling code.