-
Notifications
You must be signed in to change notification settings - Fork 135
IGNITE-20020: Sql. Support system views in planner. #2601
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
Conversation
9267a27 to
6dcc608
Compare
| */ | ||
| public class IgniteSystemViewScan extends ProjectableFilterableTableScan implements SourceAwareIgniteRel { | ||
|
|
||
| private final long sourceId; |
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.
could you please add a javadoc with an explanation what is it
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.
Filed an issue to document SourceIgniteRel - https://issues.apache.org/jira/browse/IGNITE-20461
| if (srcIdObj != null) { | ||
| sourceId = ((Number) srcIdObj).longValue(); | ||
| } else { | ||
| sourceId = -1; |
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.
so many times used -1, let's introduce constant for it
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.
May be we can create an issue to fix this for all scan operations?
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.
yes, it good idea
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.
Here is an issue https://issues.apache.org/jira/browse/IGNITE-20461
| String viewName = systemViewDescriptor.name(); | ||
| TableDescriptor descriptor = createTableDescriptorForSystemView(systemViewDescriptor); | ||
|
|
||
| IgniteSystemView schemaTable = new IgniteSystemViewImpl(viewName, viewId, version, descriptor, Statistics.UNKNOWN); |
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.
Is seems we could have special statistics realization for system views. At least we know distribution
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.
Unfortunately, there is no statistics for rows for system views, because the API asks a user to provide it a function that returns data (see SystemView's dataProvider property).
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.
yes, but statistics it not only about concrete rows, it also knowns about data structure and distribution, both of them don't depends on dataprovider
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.
Thanks. Fixed.
|
|
||
| @Override | ||
| public FragmentMapping visit(IgniteSystemViewScan rel) { | ||
| throw new UnsupportedOperationException(); |
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.
| throw new UnsupportedOperationException(); | |
| throw new UnsupportedOperationException("System view scan is not implemented"); |
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.
Fixed.
| private static final AtomicInteger SYSTEM_VIEW_ID = new AtomicInteger(); | ||
|
|
||
| @Test | ||
| public void testReadAllColumns() throws Exception { |
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.
assertPlan("INSERT into SYS_PROPS(key, VAL) VALUES('', '')"
throws confused exception, seems all cases with VIEWS mutations need to be covered.
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.
CREATE INDEX idx on SYS_PROPS
the same i suppose
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.
There is no facilities to add such tests - there is no means to write DDL tests for the planner.
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.
assertPlan("INSERT into SYS_PROPS(key, VAL) VALUES('', '')"
Fixed.
| assert dataSource != null; | ||
|
|
||
| if (dataSource instanceof IgniteSystemView) { | ||
| throw newValidationError(identifier, IgniteResource.INSTANCE.systemViewIsNotModifiable(identifier.toString())); |
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 think that SysView mutation error need to be raised not from getIgniteTable call, wdyt ?
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.
Renamed to getTableForModification.
Fix INSERT, Rename get*Table methods. Add error message.
Makes system views accessible to planner via calcite's Table class.
IgniteDataSourceinterface that represents both Tables and System Views.https://issues.apache.org/jira/browse/IGNITE-20020
Thank you for submitting the pull request.
To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:
The Review Checklist
- There is a single JIRA ticket related to the pull request.
- The web-link to the pull request is attached to the JIRA ticket.
- The JIRA ticket has the Patch Available state.
- The description of the JIRA ticket explains WHAT was made, WHY and HOW.
- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
Notes