[
https://issues.apache.org/jira/browse/PHOENIX-1312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15058430#comment-15058430
]
ramkrishna.s.vasudevan commented on PHOENIX-1312:
-------------------------------------------------
{code}
ParseNode node = aliasedNode.getNode();
// TODO: visitor?
if (node instanceof WildcardParseNode) {
if (statement.isAggregate()) {
ExpressionCompiler.throwNonAggExpressionInAggException(node.toString());
}
if (tableRef == TableRef.EMPTY_TABLE_REF) {
throw new
SQLExceptionInfo.Builder(SQLExceptionCode.NO_TABLE_SPECIFIED_FOR_WILDCARD_SELECT).build().buildException();
}
isWildcard = true;
if (tableRef.getTable().getType() == PTableType.INDEX &&
((WildcardParseNode)node).isRewrite()) {
projectAllIndexColumns(context, tableRef,
resolveColumn, projectedExpressions, projectedColumns, targetColumns);
} else {
projectAllTableColumns(context, tableRef, resolveColumn,
projectedExpressions, projectedColumns, targetColumns);
}
} else if (node instanceof TableWildcardParseNode) {
TableName tName = ((TableWildcardParseNode)
node).getTableName();
TableRef tRef = resolver.resolveTable(tName.getSchemaName(),
tName.getTableName());
if (tRef.equals(tableRef)) {
isWildcard = true;
}
if (tRef.getTable().getType() == PTableType.INDEX &&
((TableWildcardParseNode)node).isRewrite()) {
projectAllIndexColumns(context, tRef, true,
projectedExpressions, projectedColumns, targetColumns);
} else {
projectAllTableColumns(context, tRef, true,
projectedExpressions, projectedColumns, targetColumns);
}
} else if (node instanceof FamilyWildcardParseNode) {
if (tableRef == TableRef.EMPTY_TABLE_REF) {
throw new
SQLExceptionInfo.Builder(SQLExceptionCode.NO_TABLE_SPECIFIED_FOR_WILDCARD_SELECT).build().buildException();
}
// Project everything for SELECT cf.*
String cfName = ((FamilyWildcardParseNode) node).getName();
// Delay projecting to scan, as when any other column in the
column family gets
// added to the scan, it overwrites that we want to project the
entire column
// family. Instead, we do the projection at the end.
// TODO: consider having a ScanUtil.addColumn and
ScanUtil.addFamily to work
// around this, as this code depends on this function being the
last place where
// columns are projected (which is currently true, but could
change).
projectedFamilies.add(Bytes.toBytes(cfName));
if (tableRef.getTable().getType() == PTableType.INDEX &&
((FamilyWildcardParseNode)node).isRewrite()) {
projectIndexColumnFamily(context, cfName, tableRef,
resolveColumn, projectedExpressions, projectedColumns);
} else {
projectTableColumnFamily(context, cfName, tableRef,
resolveColumn, projectedExpressions, projectedColumns);
}
}
{code}
Here the problem is that in the above eg
{code}
SELECT B.V2 FROM T WHERE B.V2 = 'a'
{code}
The where clause B.V2 comes as a ColumnParseNode. So projectedFamilies always
remains empty. But I don't think we can directly add a ColumnParseNode as one
more else if here.
> Do not always project the empty column family
> ---------------------------------------------
>
> Key: PHOENIX-1312
> URL: https://issues.apache.org/jira/browse/PHOENIX-1312
> Project: Phoenix
> Issue Type: Bug
> Reporter: James Taylor
> Assignee: ramkrishna.s.vasudevan
> Fix For: 4.7.0
>
> Attachments: PHOENIX-1312_1.patch, PHOENIX-1312_v2.patch,
> Phoenix-1312.patch
>
>
> Often times, we don't need to, but it seems we always are. See
> MultiCfQueryExecIT.testGuidePostsForMultiCFs() where we run a query like this:
> {code}
> SELECT count(*) FROM multi_cf WHERE e.cpu_utilization IS NOT NULL
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)