public PTable createProjectedTable(RowProjector rowProjector) throws SQLException { assert(isSubselect()); TableRef tableRef = FromCompiler.getResolverForCompiledDerivedTable(statement.getConnection(), this.tableRef, rowProjector).getTables().get(0); List<ColumnRef> sourceColumns = new ArrayList<ColumnRef>(); PTable table = tableRef.getTable(); for (PColumn column : table.getColumns()) { sourceColumns.add(new ColumnRef(tableRef, column.getPosition())); } return TupleProjectionCompiler.createProjectedTable(tableRef, sourceColumns, false); } }
TableRef tableRef = context.getCurrentTable(); PTable table = tableRef.getTable(); boolean resolveColumn = !tableRef.equals(resolver.getTables().get(0)); boolean isWildcard = false; Scan scan = context.getScan(); TableRef tRef = resolver.resolveTable(tName.getSchemaName(), tName.getTableName()); if (tRef.equals(tableRef)) { isWildcard = true; return new RowProjector(projectedColumns, Math.max(estimatedKeySize, estimatedByteSize), isProjectEmptyKeyValue, resolver.hasUDFs(), isWildcard);
@Override public Void visit(ColumnParseNode node) throws SQLException { // Inner query column definitions should shade those of outer query. try { localResolver.resolveColumn(node.getSchemaName(), node.getTableName(), node.getName()); addType(true); return null; } catch (TableNotFoundException e) { } catch (ColumnNotFoundException e) { } catch (ColumnFamilyNotFoundException e) { } outerResolver.resolveColumn(node.getSchemaName(), node.getTableName(), node.getName()); addType(false); return null; }
@Override public Void visit(ColumnParseNode node) throws SQLException { ColumnRef columnRef = null; try { columnRef = resolver.resolveColumn(node.getSchemaName(), node.getTableName(), node.getName()); } catch (ColumnNotFoundException e) { // This could be a LocalIndexDataColumnRef. If so, the table name must have // been appended by the IndexStatementRewriter, and we can convert it into. TableRef tableRef = resolver.resolveTable(node.getSchemaName(), node.getTableName()); if (tableRef.getTable().getIndexType() == IndexType.LOCAL) { TableRef parentTableRef = FromCompiler.getResolver( NODE_FACTORY.namedTable(null, TableName.create(tableRef.getTable() .getSchemaName().getString(), tableRef.getTable() .getParentTableName().getString())), connection).resolveTable( tableRef.getTable().getSchemaName().getString(), tableRef.getTable().getParentTableName().getString()); columnRef = new LocalIndexColumnRef(parentTableRef, IndexUtil.getDataColumnFamilyName(node.getName()), IndexUtil.getDataColumnName(node.getName()), tableRef); } else { throw e; } } columnRefMap.put(columnRef, node); tableRefSet.add(columnRef.getTableRef()); return null; }
|| select.isAggregate() || select.isDistinct() || (context.getResolver().getTables().get(0).getTable().getType() != PTableType.TABLE && context.getResolver().getTables().get(0).getTable().getType() != PTableType.INDEX && context.getResolver().getTables().get(0).getTable().getType() != PTableType.VIEW)) return null; TableRef parentTableRef = FromCompiler.getResolver( NODE_FACTORY.namedTable(null, TableName.create(table.getSchemaName().getString(), table.getParentTableName().getString())), context.getConnection()).resolveTable( table.getSchemaName().getString(), table.getParentTableName().getString()); TableRef parentTableRef = FromCompiler.getResolver( NODE_FACTORY.namedTable(null, TableName.create(table.getSchemaName().getString(), table.getParentTableName().getString())), context.getConnection()).resolveTable( table.getSchemaName().getString(), table.getParentTableName().getString());
while (true) { final ColumnResolver resolver = FromCompiler.getResolver(statement, connection); TableRef tableRef = resolver.getTables().get(0); PTable table = tableRef.getTable(); ColumnRef columnRef = null; try { columnRef = resolver.resolveColumn(null, column.getFamilyName(), column.getColumnName()); } catch (ColumnNotFoundException e) { if (statement.ifExists()) {
private TableRef resolveTable(String alias, TableName name) throws SQLException { if (alias != null) return resolver.resolveTable(null, alias); return resolver.resolveTable(name.getSchemaName(), name.getTableName()); }
public MutationState useSchema(UseSchemaStatement useSchemaStatement) throws SQLException { // As we allow default namespace mapped to empty schema, so this is to reset schema in connection if (useSchemaStatement.getSchemaName().equals(StringUtil.EMPTY_STRING)) { connection.setSchema(null); } else { FromCompiler.getResolverForSchema(useSchemaStatement, connection) .resolveSchema(useSchemaStatement.getSchemaName()); connection.setSchema(useSchemaStatement.getSchemaName()); } return new MutationState(0, 0, connection); }
PFunction function = null; if(node instanceof UDFParseNode) { function = context.getResolver().resolveFunction(node.getName()); BuiltInFunctionInfo info = new BuiltInFunctionInfo(function); node = new UDFParseNode(node.getName(), node.getChildren(), info);
|| select.isAggregate() || select.isDistinct() || (context.getResolver().getTables().get(0).getTable().getType() != PTableType.TABLE && context.getResolver().getTables().get(0).getTable().getType() != PTableType.INDEX && context.getResolver().getTables().get(0).getTable().getType() != PTableType.VIEW)) return null; TableRef parentTableRef = FromCompiler.getResolver( NODE_FACTORY.namedTable(null, TableName.create(table.getSchemaName().getString(), table.getParentTableName().getString())), context.getConnection()).resolveTable( table.getSchemaName().getString(), table.getParentTableName().getString()); TableRef parentTableRef = FromCompiler.getResolver( NODE_FACTORY.namedTable(null, TableName.create(table.getSchemaName().getString(), table.getParentTableName().getString())), context.getConnection()).resolveTable( table.getSchemaName().getString(), table.getParentTableName().getString());
tableRefToBe = resolver.getTables().get(0); table = tableRefToBe.getTable(); ColumnRef ref = resolver.resolveColumn(null, colName.getFamilyName(), colName.getColumnName()); PColumn column = ref.getColumn(); if (IndexUtil.getViewConstantValue(column, ptr)) { && tableRefToBe.equals(selectResolver.getTables().get(0)); long serverTime = selectResolver.getTables().get(0).getCurrentTime(); if (serverTime == QueryConstants.UNSET_TIMESTAMP) { for (Pair<ColumnName,ParseNode> columnPair : onDupKeyPairs) { ColumnName colName = columnPair.getFirst(); PColumn updateColumn = resolver.resolveColumn(null, colName.getFamilyName(), colName.getColumnName()).getColumn(); if (SchemaUtil.isPKColumn(updateColumn)) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.CANNOT_UPDATE_PK_ON_DUP_KEY)
private TableRef resolveTable(String alias, TableName name) throws SQLException { if (alias != null) return origResolver.resolveTable(null, alias); return origResolver.resolveTable(name.getSchemaName(), name.getTableName()); }
@Override public Void visit(ColumnParseNode node) throws SQLException { ColumnRef columnRef = null; try { columnRef = resolver.resolveColumn(node.getSchemaName(), node.getTableName(), node.getName()); } catch (ColumnNotFoundException e) { // This could be a LocalIndexDataColumnRef. If so, the table name must have // been appended by the IndexStatementRewriter, and we can convert it into. TableRef tableRef = resolver.resolveTable(node.getSchemaName(), node.getTableName()); if (tableRef.getTable().getIndexType() == IndexType.LOCAL) { TableRef parentTableRef = FromCompiler.getResolver( NODE_FACTORY.namedTable(null, TableName.create(tableRef.getTable() .getSchemaName().getString(), tableRef.getTable() .getParentTableName().getString())), connection).resolveTable( tableRef.getTable().getSchemaName().getString(), tableRef.getTable().getParentTableName().getString()); columnRef = new LocalIndexColumnRef(parentTableRef, IndexUtil.getDataColumnFamilyName(node.getName()), IndexUtil.getDataColumnName(node.getName()), tableRef); } else { throw e; } } columnRefMap.put(columnRef, node); tableRefSet.add(columnRef.getTableRef()); return null; }
public MutationState useSchema(UseSchemaStatement useSchemaStatement) throws SQLException { // As we allow default namespace mapped to empty schema, so this is to reset schema in connection if (useSchemaStatement.getSchemaName().equals(StringUtil.EMPTY_STRING)) { connection.setSchema(null); } else { FromCompiler.getResolverForSchema(useSchemaStatement, connection) .resolveSchema(useSchemaStatement.getSchemaName()); connection.setSchema(useSchemaStatement.getSchemaName()); } return new MutationState(0, 0, connection); }
PFunction function = null; if(node instanceof UDFParseNode) { function = context.getResolver().resolveFunction(node.getName()); BuiltInFunctionInfo info = new BuiltInFunctionInfo(function); node = new UDFParseNode(node.getName(), node.getChildren(), info);
public MutationState addColumn(AddColumnStatement statement) throws SQLException { PTable table = FromCompiler.getResolver(statement, connection).getTables().get(0).getTable(); return addColumn(table, statement.getColumnDefs(), statement.getProps(), statement.ifNotExists(), false, statement.getTable(), statement.getTableType()); }
TableRef tableRef = context.getCurrentTable(); PTable table = tableRef.getTable(); boolean resolveColumn = !tableRef.equals(resolver.getTables().get(0)); boolean isWildcard = false; Scan scan = context.getScan(); TableRef tRef = resolver.resolveTable(tName.getSchemaName(), tName.getTableName()); if (tRef.equals(tableRef)) { isWildcard = true; return new RowProjector(projectedColumns, Math.max(estimatedKeySize, estimatedByteSize), isProjectEmptyKeyValue, resolver.hasUDFs(), isWildcard);
@Override public Void visit(ColumnParseNode node) throws SQLException { ColumnRef ref = context.getResolver().resolveColumn(node.getSchemaName(), node.getTableName(), node.getName()); boolean isAggregateColumn = groupBy.getExpressions().indexOf(ref.newColumnExpression(node.isTableNameCaseSensitive(), node.isCaseSensitive())) >= 0; if (hasOnlyAggregateColumns == null) { hasOnlyAggregateColumns = isAggregateColumn; } else { hasOnlyAggregateColumns &= isAggregateColumn; } return null; }
|| select.isAggregate() || select.isDistinct() || (context.getResolver().getTables().get(0).getTable().getType() != PTableType.TABLE && context.getResolver().getTables().get(0).getTable().getType() != PTableType.INDEX && context.getResolver().getTables().get(0).getTable().getType() != PTableType.VIEW)) return null; TableRef parentTableRef = FromCompiler.getResolver( NODE_FACTORY.namedTable(null, TableName.create(table.getSchemaName().getString(), table.getParentTableName().getString())), context.getConnection()).resolveTable( table.getSchemaName().getString(), table.getParentTableName().getString()); TableRef parentTableRef = FromCompiler.getResolver( NODE_FACTORY.namedTable(null, TableName.create(table.getSchemaName().getString(), table.getParentTableName().getString())), context.getConnection()).resolveTable( table.getSchemaName().getString(), table.getParentTableName().getString());
try { ColumnResolver resolver = FromCompiler.getResolver(statement, connection, statement.getUdfParseNodes()); tableRef = resolver.getTables().get(0); Date asyncCreatedDate = null; if (statement.isAsync()) { PColumn col = resolver.resolveColumn(null, colName.getFamilyName(), colName.getColumnName()).getColumn(); colName = ColumnName.caseSensitiveColumnName(IndexUtil.getIndexColumnName(col));