-
Notifications
You must be signed in to change notification settings - Fork 1k
Branch for testinf Phoenix-6984, phoenix-6983 and phoenix 6959 together on 5.1 #1631
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,7 +208,7 @@ private static void projectAllIndexColumns(StatementContext context, TableRef ta | |
| int tableOffset = dataTable.getBucketNum() == null ? 0 : 1; | ||
| int minTablePKOffset = getMinPKOffset(dataTable, tenantId); | ||
| int minIndexPKOffset = getMinPKOffset(index, tenantId); | ||
| if (index.getIndexType() != IndexType.LOCAL) { | ||
| if (index.getIndexType() != IndexType.LOCAL && !isHintedGlobalIndex(tableRef)) { | ||
| if (index.getColumns().size()-minIndexPKOffset != dataTable.getColumns().size()-minTablePKOffset) { | ||
| // We'll end up not using this by the optimizer, so just throw | ||
| String schemaNameStr = dataTable.getSchemaName()==null?null:dataTable.getSchemaName().getString(); | ||
|
|
@@ -246,7 +246,7 @@ private static void projectAllIndexColumns(StatementContext context, TableRef ta | |
| } | ||
| String colName = tableColumn.getName().getString(); | ||
| String tableAlias = tableRef.getTableAlias(); | ||
| if (resolveColumn) { | ||
| if (resolveColumn && !(ref instanceof IndexDataColumnRef)) { | ||
| try { | ||
| if (tableAlias != null) { | ||
| ref = resolver.resolveColumn(null, tableAlias, indexColName); | ||
|
|
@@ -505,7 +505,15 @@ public static RowProjector compile(StatementContext context, SelectStatement sta | |
| } else { | ||
| isProjectEmptyKeyValue = where == null || LiteralExpression.isTrue(where) || where.requiresFinalEvaluation(); | ||
| for (byte[] family : projectedFamilies) { | ||
| projectColumnFamily(table, scan, family); | ||
| try { | ||
| if (table.getColumnFamily(family) != null) { | ||
| projectColumnFamily(table, scan, family); | ||
| } | ||
| } catch (ColumnFamilyNotFoundException e) { | ||
| if (!(tableRef.getTable().getIndexType() == IndexType.LOCAL || isHintedGlobalIndex(tableRef))) { | ||
| throw e; | ||
| } | ||
|
Comment on lines
+513
to
+515
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for else case, would a DEBUG log be helpful?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is again synced from 5.2, which does not have a debug statement there. |
||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -341,9 +341,22 @@ private QueryPlan addPlan(PhoenixStatement statement, SelectStatement select, PT | |
| if (indexState == PIndexState.ACTIVE || indexState == PIndexState.PENDING_ACTIVE | ||
| || (indexState == PIndexState.PENDING_DISABLE && isUnderPendingDisableThreshold(indexTableRef.getCurrentTime(), indexTable.getIndexDisableTimestamp()))) { | ||
| try { | ||
| if (select.getHint().hasHint(HintNode.Hint.NO_INDEX_SERVER_MERGE)) { | ||
| String schemaNameStr = index.getSchemaName() == null ? null | ||
| : index.getSchemaName().getString(); | ||
| String tableNameStr = index.getTableName() == null ? null | ||
| : index.getTableName().getString(); | ||
| throw new ColumnNotFoundException(schemaNameStr, tableNameStr, null, "*"); | ||
| } | ||
| // translate nodes that match expressions that are indexed to the associated column parse node | ||
| indexSelect = ParseNodeRewriter.rewrite(indexSelect, new IndexExpressionParseNodeRewriter(index, null, statement.getConnection(), indexSelect.getUdfParseNodes())); | ||
| QueryCompiler compiler = new QueryCompiler(statement, indexSelect, resolver, targetColumns, parallelIteratorFactory, dataPlan.getContext().getSequenceManager(), isProjected, true, dataPlans); | ||
| SelectStatement rewrittenIndexSelect = | ||
| ParseNodeRewriter.rewrite(indexSelect, | ||
| new IndexExpressionParseNodeRewriter(index, null, | ||
| statement.getConnection(), indexSelect.getUdfParseNodes())); | ||
| QueryCompiler compiler = | ||
| new QueryCompiler(statement, rewrittenIndexSelect, resolver, targetColumns, | ||
| parallelIteratorFactory, dataPlan.getContext().getSequenceManager(), | ||
| isProjected, true, dataPlans); | ||
|
|
||
| QueryPlan plan = compiler.compile(); | ||
|
|
||
|
|
@@ -357,8 +370,10 @@ private QueryPlan addPlan(PhoenixStatement statement, SelectStatement select, PT | |
| if (plan.getProjector().getColumnCount() == nColumns) { | ||
| return plan; | ||
| } else if (index.getIndexType() == IndexType.GLOBAL) { | ||
| String schemaNameStr = index.getSchemaName()==null?null:index.getSchemaName().getString(); | ||
| String tableNameStr = index.getTableName()==null?null:index.getTableName().getString(); | ||
| String schemaNameStr = index.getSchemaName() == null ? null | ||
| : index.getSchemaName().getString(); | ||
| String tableNameStr = index.getTableName() == null ? null | ||
| : index.getTableName().getString(); | ||
| throw new ColumnNotFoundException(schemaNameStr, tableNameStr, null, "*"); | ||
| } | ||
| } | ||
|
|
@@ -369,6 +384,10 @@ private QueryPlan addPlan(PhoenixStatement statement, SelectStatement select, PT | |
| * otherwise we just don't use this index (as opposed to trying to join back from | ||
| * the index table to the data table. | ||
| */ | ||
| // Reset the state changes from the attempt above | ||
| indexTableRef.setHinted(false); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. without this reset, the compiler might still end up using uncovered index right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'd use the skip-scan-join plan with the projector for the server merge plan, which doesn't work.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For example we saw Error: ERROR 504 (42703): Undefined column. columnName=BILLING_ORDER.0:PERIOD_END (state=42703,code=504) which would refer to the projected data table in the server merge plan, but the actual Table is unprojected data table in the skip-join-scan, which doesn't have a column of that name. Resetting those flags makes sure that we generate and use the correct projector. |
||
| dataPlan.getContext().setUncoveredIndex(false); | ||
|
|
||
| SelectStatement dataSelect = (SelectStatement)dataPlan.getStatement(); | ||
| ParseNode where = dataSelect.getWhere(); | ||
| if (isHinted && where != null) { | ||
|
|
||
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.
do we not need
NO_INDEX_SERVER_MERGEwithINDEX("dt" "it")for this to be changed?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.
With PHOENIX-6959 the behaviour is the same as 5.2, and these changes are taken from 5.2 branch.
I have added a single new test case for the NO_INDEX_SERVER_MERGE option below.