-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fix(plugin-oracle): Switch to ALL_TAB_* as DBA_TAB* requires ADMIN pe… #26554
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
base: master
Are you sure you want to change the base?
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR updates the Oracle connector’s getTableStatistics logic to query ALL_TAB_STATISTICS instead of DBA_TAB_STATISTICS to avoid admin permission requirements, and improves column statistics by conditionally setting data size only for CHAR/VARCHAR types. ER diagram for change from DBA_TAB_STATISTICS to ALL_TAB_STATISTICSerDiagram
ALL_TAB_STATISTICS {
NUM_ROWS int
AVG_ROW_LEN int
LAST_ANALYZED date
OWNER varchar
TABLE_NAME varchar
}
TableStatistics {
NUM_ROWS int
AVG_ROW_LEN int
LAST_ANALYZED date
}
ALL_TAB_STATISTICS ||--o| TableStatistics : provides
Class diagram for updated OracleClient.getTableStatistics logicclassDiagram
class OracleClient {
+getTableStatistics(session, handle)
}
class TableStatistics
class ColumnStatistics {
+setDataSize(size)
+setNullsFraction(fraction)
+setDistinctValuesCount(count)
+setRange(range)
}
class Estimate {
+estimateFromDouble(value)
}
class DoubleRange
OracleClient --> TableStatistics
OracleClient --> ColumnStatistics
ColumnStatistics --> Estimate
ColumnStatistics --> DoubleRange
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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 only propagate varchar/char data size and null for the rest. In a subsequent PR, we could see how to convert presto data sizes corresponding to each oracle type. |
…rmission
Description
https://docs.oracle.com/en/database/oracle/oracle-database/21/refrn/ALL_TAB_STATISTICS.html#GUID-C567F729-3748-4DFE-A22C-115CB7575D63
As per the docs above, DB_TAB_STATISTICS table requires admin privilage, whereas ALL_TAB_STATISTICS returns stats for tables accessible by current user.
Motivation and Context
Fixes a case where user does not have permission on DBA_TAB_STATISTICS table.
Impact
Test Plan
Contributor checklist
Release Notes