@Override public String toString() { return toStringHelper(this) .add("table", table.getName()) .add("where", where) .toString(); } }
@Override protected Void visitTable(Table node, Integer indent) { builder.append(formatName(node.getName())); return null; }
@Override protected Void visitTable(Table node, Integer indentLevel) { String name = Joiner.on('.').join(node.getName().getParts()); print(indentLevel, "Table[" + name + "]"); return null; }
private void processRelation(Relation relation, Integer indent) { // TODO: handle this properly if (relation instanceof Table) { builder.append("TABLE ") .append(((Table) relation).getName()) .append('\n'); } else { process(relation, indent); } }
@Override protected Void visitDelete(Delete node, Integer context) { builder.append("DELETE FROM ") .append(formatName(node.getTable().getName())); if (node.getWhere().isPresent()) { builder.append(" WHERE ") .append(formatExpression(node.getWhere().get(), parameters)); } return null; }
private Node rewriteShowStats(ShowStats node, Table table, Constraint<ColumnHandle> constraint) { TableHandle tableHandle = getTableHandle(node, table.getName()); TableStatistics tableStatistics = metadata.getTableStatistics(session, tableHandle, constraint); List<String> statsColumnNames = buildColumnsNames(); List<SelectItem> selectItems = buildSelectItems(statsColumnNames); TableMetadata tableMetadata = metadata.getTableMetadata(session, tableHandle); Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle); List<Expression> resultRows = buildStatisticsRows(tableMetadata, columnHandles, tableStatistics); return simpleQuery(selectAll(selectItems), aliased(new Values(resultRows), "table_stats_for_" + table.getName(), statsColumnNames)); }
@Override protected Scope visitTable(Table table, Optional<Scope> scope) if (!table.getName().getPrefix().isPresent()) { String name = table.getName().getSuffix(); QualifiedObjectName name = createQualifiedObjectName(session, table, table.getName()); analysis.addEmptyColumnReferencesForTable(accessControl, session.getIdentity(), name); for (ColumnMetadata column : tableMetadata.getColumns()) { Field field = Field.newQualified( table.getName(), Optional.of(column.getName()), column.getType(),
@Override protected Scope visitDelete(Delete node, Optional<Scope> scope) { Table table = node.getTable(); QualifiedObjectName tableName = createQualifiedObjectName(session, table, table.getName()); if (metadata.getView(session, tableName).isPresent()) { throw new SemanticException(NOT_SUPPORTED, node, "Deleting from views is not supported"); } // Analyzer checks for select permissions but DELETE has a separate permission, so disable access checks // TODO: we shouldn't need to create a new analyzer. The access control should be carried in the context object StatementAnalyzer analyzer = new StatementAnalyzer( analysis, metadata, sqlParser, new AllowAllAccessControl(), session, WarningCollector.NOOP); Scope tableScope = analyzer.analyze(table, scope); node.getWhere().ifPresent(where -> analyzeWhere(node, tableScope, where)); analysis.setUpdateType("DELETE"); accessControl.checkCanDeleteFromTable(session.getRequiredTransactionId(), session.getIdentity(), tableName); return createAndAssignScope(node, scope, Field.newUnqualified("rows", BIGINT)); }
private void processRelation(Relation relation, Integer indent) { // TODO: handle this properly if (relation instanceof Table) { builder.append("TABLE ") .append(tableNameMapper.apply(((Table) relation).getName())) .append('\n'); } else { process(relation, indent); } }
@Override protected Void visitTable(Table node, Integer indent) { if (!node.getName().getPrefix().isPresent() && queryWithTables.contains(node.getName().getSuffix().toLowerCase(Locale.ENGLISH))) { builder.append(formatName(node.getName().toString(), escapeIdentifier)); return null; } builder.append(tableNameMapper.apply(node.getName())); return null; }
@Override protected Void visitDelete(Delete node, Integer context) { builder.append("DELETE FROM ") .append(formatName(node.getTable().getName())); if (node.getWhere().isPresent()) { builder.append(" WHERE ") .append(formatExpression(node.getWhere().get(), tableNameMapper, columnNameMapper, queryWithTables, escapeIdentifier)); } return null; }
@Override public String toString() { return toStringHelper(this) .add("table", table.getName()) .add("where", where) .toString(); } }
@Override public String toString() { return toStringHelper(this) .add("table", table.getName()) .add("where", where) .toString(); } }
private void processRelation(Relation relation, Integer indent) { // TODO: handle this properly if (relation instanceof Table) { builder.append("TABLE ") .append(((Table) relation).getName()) .append('\n'); } else { process(relation, indent); } }
@Override protected Void visitTable(Table node, Integer indent) { builder.append(formatName(node.getName())); return null; }
@Override protected Void visitTable(Table node, Integer indentLevel) { String name = Joiner.on('.').join(node.getName().getParts()); print(indentLevel, "Table[" + name + "]"); return null; }
private void processRelation(Relation relation, Integer indent) { // TODO: handle this properly if (relation instanceof Table) { builder.append("TABLE ") .append(((Table) relation).getName()) .append('\n'); } else { process(relation, indent); } }
@Override protected Void visitTable(Table node, Integer indentLevel) { String name = Joiner.on('.').join(node.getName().getParts()); print(indentLevel, "Table[" + name + "]"); return null; }
@Override protected Void visitDelete(Delete node, Integer context) { builder.append("DELETE FROM ") .append(node.getTable().getName()); if (node.getWhere().isPresent()) { builder.append(" WHERE ") .append(formatExpression(node.getWhere().get())); } return null; }
@Override protected Void visitDelete(Delete node, Integer context) { builder.append("DELETE FROM ") .append(formatName(node.getTable().getName())); if (node.getWhere().isPresent()) { builder.append(" WHERE ") .append(formatExpression(node.getWhere().get(), parameters)); } return null; }