Search in sources :

Example 1 with VacuumTable

use of io.prestosql.sql.tree.VacuumTable in project hetu-core by openlookeng.

the class AstBuilder method visitVacuumTable.

@Override
public Node visitVacuumTable(SqlBaseParser.VacuumTableContext context) {
    boolean isFull = context.FULL() != null;
    boolean isMerge = context.UNIFY() != null;
    // Exclude single quotes
    Optional<String> partition = getTextIfPresent(context.partition).map(s -> {
        if (s.startsWith("'") && s.endsWith("'")) {
            return Optional.of(s.substring(1, s.length() - 1));
        }
        return Optional.of(s);
    }).orElse(Optional.empty());
    boolean isAsync = context.AND_WAIT() == null;
    return new VacuumTable(Optional.of(getLocation(context)), new Table(getLocation(context), getQualifiedName(context.qualifiedName())), isFull, isMerge, partition, isAsync);
}
Also used : CreateSchema(io.prestosql.sql.tree.CreateSchema) DETERMINISTIC(io.prestosql.sql.tree.RoutineCharacteristics.Determinism.DETERMINISTIC) Prepare(io.prestosql.sql.tree.Prepare) Statement(io.prestosql.sql.tree.Statement) Execute(io.prestosql.sql.tree.Execute) ArithmeticUnaryExpression(io.prestosql.sql.tree.ArithmeticUnaryExpression) ArrayConstructor(io.prestosql.sql.tree.ArrayConstructor) FetchFirst(io.prestosql.sql.tree.FetchFirst) Identifier(io.prestosql.sql.tree.Identifier) Cube(io.prestosql.sql.tree.Cube) DescribeInput(io.prestosql.sql.tree.DescribeInput) RenameColumn(io.prestosql.sql.tree.RenameColumn) GrantRoles(io.prestosql.sql.tree.GrantRoles) Delete(io.prestosql.sql.tree.Delete) GroupingElement(io.prestosql.sql.tree.GroupingElement) NullLiteral(io.prestosql.sql.tree.NullLiteral) ShowStats(io.prestosql.sql.tree.ShowStats) ShowCache(io.prestosql.sql.tree.ShowCache) Insert(io.prestosql.sql.tree.Insert) TableElement(io.prestosql.sql.tree.TableElement) DropView(io.prestosql.sql.tree.DropView) GenericLiteral(io.prestosql.sql.tree.GenericLiteral) LongLiteral(io.prestosql.sql.tree.LongLiteral) Call(io.prestosql.sql.tree.Call) Union(io.prestosql.sql.tree.Union) ExplainFormat(io.prestosql.sql.tree.ExplainFormat) BetweenPredicate(io.prestosql.sql.tree.BetweenPredicate) Extract(io.prestosql.sql.tree.Extract) DropRole(io.prestosql.sql.tree.DropRole) VacuumTable(io.prestosql.sql.tree.VacuumTable) DropTable(io.prestosql.sql.tree.DropTable) AllColumns(io.prestosql.sql.tree.AllColumns) ShowRoleGrants(io.prestosql.sql.tree.ShowRoleGrants) Node(io.prestosql.sql.tree.Node) ResetSession(io.prestosql.sql.tree.ResetSession) Deallocate(io.prestosql.sql.tree.Deallocate) Lists(com.google.common.collect.Lists) SqlParameterDeclaration(io.prestosql.sql.tree.SqlParameterDeclaration) BooleanLiteral(io.prestosql.sql.tree.BooleanLiteral) Comment(io.prestosql.sql.tree.Comment) SelectItem(io.prestosql.sql.tree.SelectItem) RETURNS_NULL_ON_NULL_INPUT(io.prestosql.sql.tree.RoutineCharacteristics.NullCallClause.RETURNS_NULL_ON_NULL_INPUT) RenameTable(io.prestosql.sql.tree.RenameTable) LogicalBinaryExpression(io.prestosql.sql.tree.LogicalBinaryExpression) NotExpression(io.prestosql.sql.tree.NotExpression) TransactionMode(io.prestosql.sql.tree.TransactionMode) DescribeOutput(io.prestosql.sql.tree.DescribeOutput) Query(io.prestosql.sql.tree.Query) Cache(io.prestosql.sql.tree.Cache) TransactionAccessMode(io.prestosql.sql.tree.TransactionAccessMode) ComparisonExpression(io.prestosql.sql.tree.ComparisonExpression) NodeLocation(io.prestosql.sql.tree.NodeLocation) Iterables.getOnlyElement(com.google.common.collect.Iterables.getOnlyElement) CurrentUser(io.prestosql.sql.tree.CurrentUser) ShowFunctions(io.prestosql.sql.tree.ShowFunctions) Lateral(io.prestosql.sql.tree.Lateral) ShowCreate(io.prestosql.sql.tree.ShowCreate) Format(io.prestosql.sql.tree.Format) Expression(io.prestosql.sql.tree.Expression) TableSubquery(io.prestosql.sql.tree.TableSubquery) Intersect(io.prestosql.sql.tree.Intersect) RoutineCharacteristics(io.prestosql.sql.tree.RoutineCharacteristics) CreateCube(io.prestosql.sql.tree.CreateCube) DropSchema(io.prestosql.sql.tree.DropSchema) Locale(java.util.Locale) StartTransaction(io.prestosql.sql.tree.StartTransaction) Return(io.prestosql.sql.tree.Return) QuerySpecification(io.prestosql.sql.tree.QuerySpecification) Except(io.prestosql.sql.tree.Except) ImmutableSet(com.google.common.collect.ImmutableSet) IsNullPredicate(io.prestosql.sql.tree.IsNullPredicate) PathElement(io.prestosql.sql.tree.PathElement) DropCache(io.prestosql.sql.tree.DropCache) PathSpecification(io.prestosql.sql.tree.PathSpecification) Collectors(java.util.stream.Collectors) Rollback(io.prestosql.sql.tree.Rollback) SingleColumn(io.prestosql.sql.tree.SingleColumn) CharLiteral(io.prestosql.sql.tree.CharLiteral) With(io.prestosql.sql.tree.With) ExplainType(io.prestosql.sql.tree.ExplainType) DropCube(io.prestosql.sql.tree.DropCube) ShowRoles(io.prestosql.sql.tree.ShowRoles) ShowTables(io.prestosql.sql.tree.ShowTables) CreateRole(io.prestosql.sql.tree.CreateRole) ShowViews(io.prestosql.sql.tree.ShowViews) CurrentPath(io.prestosql.sql.tree.CurrentPath) DecimalLiteral(io.prestosql.sql.tree.DecimalLiteral) Values(io.prestosql.sql.tree.Values) ArithmeticBinaryExpression(io.prestosql.sql.tree.ArithmeticBinaryExpression) ImmutableList(com.google.common.collect.ImmutableList) FunctionCall(io.prestosql.sql.tree.FunctionCall) JoinUsing(io.prestosql.sql.tree.JoinUsing) IntervalLiteral(io.prestosql.sql.tree.IntervalLiteral) SearchedCaseExpression(io.prestosql.sql.tree.SearchedCaseExpression) Limit(io.prestosql.sql.tree.Limit) DereferenceExpression(io.prestosql.sql.tree.DereferenceExpression) QuantifiedComparisonExpression(io.prestosql.sql.tree.QuantifiedComparisonExpression) NullIfExpression(io.prestosql.sql.tree.NullIfExpression) PrincipalSpecification(io.prestosql.sql.tree.PrincipalSpecification) RenameIndex(io.prestosql.sql.tree.RenameIndex) WithQuery(io.prestosql.sql.tree.WithQuery) Offset(io.prestosql.sql.tree.Offset) Collectors.toList(java.util.stream.Collectors.toList) DropIndex(io.prestosql.sql.tree.DropIndex) ReloadCube(io.prestosql.sql.tree.ReloadCube) Use(io.prestosql.sql.tree.Use) JoinOn(io.prestosql.sql.tree.JoinOn) ShowCatalogs(io.prestosql.sql.tree.ShowCatalogs) Table(io.prestosql.sql.tree.Table) SampledRelation(io.prestosql.sql.tree.SampledRelation) Relation(io.prestosql.sql.tree.Relation) Token(org.antlr.v4.runtime.Token) Property(io.prestosql.sql.tree.Property) ShowGrants(io.prestosql.sql.tree.ShowGrants) AliasedRelation(io.prestosql.sql.tree.AliasedRelation) Cast(io.prestosql.sql.tree.Cast) CreateTable(io.prestosql.sql.tree.CreateTable) Join(io.prestosql.sql.tree.Join) ExplainOption(io.prestosql.sql.tree.ExplainOption) ShowExternalFunction(io.prestosql.sql.tree.ShowExternalFunction) WhenClause(io.prestosql.sql.tree.WhenClause) Row(io.prestosql.sql.tree.Row) AssignmentItem(io.prestosql.sql.tree.AssignmentItem) ShowIndex(io.prestosql.sql.tree.ShowIndex) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) Set(java.util.Set) CALLED_ON_NULL_INPUT(io.prestosql.sql.tree.RoutineCharacteristics.NullCallClause.CALLED_ON_NULL_INPUT) TimeLiteral(io.prestosql.sql.tree.TimeLiteral) SetSession(io.prestosql.sql.tree.SetSession) TerminalNode(org.antlr.v4.runtime.tree.TerminalNode) LambdaExpression(io.prestosql.sql.tree.LambdaExpression) CreateView(io.prestosql.sql.tree.CreateView) DoubleLiteral(io.prestosql.sql.tree.DoubleLiteral) StringLiteral(io.prestosql.sql.tree.StringLiteral) DropColumn(io.prestosql.sql.tree.DropColumn) ParserRuleContext(org.antlr.v4.runtime.ParserRuleContext) Grant(io.prestosql.sql.tree.Grant) GroupingSets(io.prestosql.sql.tree.GroupingSets) Analyze(io.prestosql.sql.tree.Analyze) LikeClause(io.prestosql.sql.tree.LikeClause) SetPath(io.prestosql.sql.tree.SetPath) ShowCubes(io.prestosql.sql.tree.ShowCubes) Types(io.prestosql.spi.sql.expression.Types) ArrayList(java.util.ArrayList) CreateTableAsSelect(io.prestosql.sql.tree.CreateTableAsSelect) ShowColumns(io.prestosql.sql.tree.ShowColumns) ParseTree(org.antlr.v4.runtime.tree.ParseTree) LikePredicate(io.prestosql.sql.tree.LikePredicate) LinkedHashSet(java.util.LinkedHashSet) Isolation(io.prestosql.sql.tree.Isolation) ExternalBodyReference(io.prestosql.sql.tree.ExternalBodyReference) CurrentTime(io.prestosql.sql.tree.CurrentTime) QueryBody(io.prestosql.sql.tree.QueryBody) Explain(io.prestosql.sql.tree.Explain) NOT_DETERMINISTIC(io.prestosql.sql.tree.RoutineCharacteristics.Determinism.NOT_DETERMINISTIC) ColumnDefinition(io.prestosql.sql.tree.ColumnDefinition) AddColumn(io.prestosql.sql.tree.AddColumn) BinaryLiteral(io.prestosql.sql.tree.BinaryLiteral) JoinCriteria(io.prestosql.sql.tree.JoinCriteria) Unnest(io.prestosql.sql.tree.Unnest) Parameter(io.prestosql.sql.tree.Parameter) QualifiedName(io.prestosql.sql.tree.QualifiedName) FunctionProperty(io.prestosql.sql.tree.FunctionProperty) RenameSchema(io.prestosql.sql.tree.RenameSchema) Select(io.prestosql.sql.tree.Select) GrantorSpecification(io.prestosql.sql.tree.GrantorSpecification) Rollup(io.prestosql.sql.tree.Rollup) WindowFrame(io.prestosql.sql.tree.WindowFrame) SetRole(io.prestosql.sql.tree.SetRole) Window(io.prestosql.sql.tree.Window) SimpleCaseExpression(io.prestosql.sql.tree.SimpleCaseExpression) Commit(io.prestosql.sql.tree.Commit) BindExpression(io.prestosql.sql.tree.BindExpression) GroupingOperation(io.prestosql.sql.tree.GroupingOperation) IsNotNullPredicate(io.prestosql.sql.tree.IsNotNullPredicate) ShowSchemas(io.prestosql.sql.tree.ShowSchemas) CreateIndex(io.prestosql.sql.tree.CreateIndex) GroupBy(io.prestosql.sql.tree.GroupBy) NaturalJoin(io.prestosql.sql.tree.NaturalJoin) String.format(java.lang.String.format) RefreshMetadataCache(io.prestosql.sql.tree.RefreshMetadataCache) List(java.util.List) SubqueryExpression(io.prestosql.sql.tree.SubqueryExpression) SimpleGroupBy(io.prestosql.sql.tree.SimpleGroupBy) AtTimeZone(io.prestosql.sql.tree.AtTimeZone) Optional(java.util.Optional) FrameBound(io.prestosql.sql.tree.FrameBound) IfExpression(io.prestosql.sql.tree.IfExpression) InPredicate(io.prestosql.sql.tree.InPredicate) UpdateIndex(io.prestosql.sql.tree.UpdateIndex) InListExpression(io.prestosql.sql.tree.InListExpression) CoalesceExpression(io.prestosql.sql.tree.CoalesceExpression) CallArgument(io.prestosql.sql.tree.CallArgument) Objects.requireNonNull(java.util.Objects.requireNonNull) RevokeRoles(io.prestosql.sql.tree.RevokeRoles) SubscriptExpression(io.prestosql.sql.tree.SubscriptExpression) SortItem(io.prestosql.sql.tree.SortItem) TimestampLiteral(io.prestosql.sql.tree.TimestampLiteral) Iterator(java.util.Iterator) OrderBy(io.prestosql.sql.tree.OrderBy) LambdaArgumentDeclaration(io.prestosql.sql.tree.LambdaArgumentDeclaration) Update(io.prestosql.sql.tree.Update) ExistsPredicate(io.prestosql.sql.tree.ExistsPredicate) InsertCube(io.prestosql.sql.tree.InsertCube) Revoke(io.prestosql.sql.tree.Revoke) ShowSession(io.prestosql.sql.tree.ShowSession) TryExpression(io.prestosql.sql.tree.TryExpression) VacuumTable(io.prestosql.sql.tree.VacuumTable) DropTable(io.prestosql.sql.tree.DropTable) RenameTable(io.prestosql.sql.tree.RenameTable) Table(io.prestosql.sql.tree.Table) CreateTable(io.prestosql.sql.tree.CreateTable) VacuumTable(io.prestosql.sql.tree.VacuumTable)

Example 2 with VacuumTable

use of io.prestosql.sql.tree.VacuumTable in project hetu-core by openlookeng.

the class LogicalPlanner method createVacuumTablePlan.

private RelationPlan createVacuumTablePlan(Analysis analysis, VacuumTable vacuumTable) {
    TableHandle handle = analysis.getTableHandle(vacuumTable.getTable());
    TableMetadata tableMetadata = metadata.getTableMetadata(session, handle);
    List<ColumnMetadata> columns = tableMetadata.getColumns();
    List<String> columnNames = columns.stream().filter(column -> !column.isHidden()).map(ColumnMetadata::getName).collect(Collectors.toList());
    List<Symbol> symbols = columns.stream().filter(column -> !column.isHidden()).map(c -> planSymbolAllocator.newSymbol(c.getName(), c.getType())).collect(Collectors.toList());
    ColumnHandle rowIdHandle = metadata.getDeleteRowIdColumnHandle(session, handle);
    ColumnMetadata rowIdColumnMetadata = metadata.getColumnMetadata(session, handle, rowIdHandle);
    Type rowIdType = rowIdColumnMetadata.getType();
    Symbol rowIdSymbol = planSymbolAllocator.newSymbol("$rowId", rowIdType);
    symbols.add(rowIdSymbol);
    columnNames.add(rowIdHandle.getColumnName());
    String catalogName = handle.getCatalogName().getCatalogName();
    TableStatisticsMetadata statisticsMetadata = TableStatisticsMetadata.empty();
    return createVacuumWriterPlan(analysis, handle, vacuumTable, new VacuumTargetReference(handle, vacuumTable.isFull(), vacuumTable.isUnify(), vacuumTable.getPartition()), symbols, columnNames, statisticsMetadata);
}
Also used : TableMetadata(io.prestosql.metadata.TableMetadata) ConnectorTableMetadata(io.prestosql.spi.connector.ConnectorTableMetadata) GREATER_THAN_OR_EQUAL(io.prestosql.sql.tree.ComparisonExpression.Operator.GREATER_THAN_OR_EQUAL) LongSupplier(java.util.function.LongSupplier) CostCalculator(io.prestosql.cost.CostCalculator) ConstantExpression(io.prestosql.spi.relation.ConstantExpression) CreateReference(io.prestosql.sql.planner.plan.TableWriterNode.CreateReference) AggregationNode(io.prestosql.spi.plan.AggregationNode) Cast(io.prestosql.sql.tree.Cast) Statement(io.prestosql.sql.tree.Statement) WarningCollector(io.prestosql.execution.warnings.WarningCollector) ExpressionFormatter(io.prestosql.sql.ExpressionFormatter) SystemSessionProperties.isSkipAttachingStatsWithPlan(io.prestosql.SystemSessionProperties.isSkipAttachingStatsWithPlan) PlanSanityChecker(io.prestosql.sql.planner.sanity.PlanSanityChecker) Map(java.util.Map) OriginalExpressionUtils.castToRowExpression(io.prestosql.sql.relational.OriginalExpressionUtils.castToRowExpression) OutputNode(io.prestosql.sql.planner.plan.OutputNode) CubeFilter(io.hetu.core.spi.cube.CubeFilter) Identifier(io.prestosql.sql.tree.Identifier) CostProvider(io.prestosql.cost.CostProvider) Delete(io.prestosql.sql.tree.Delete) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) TableScanNode(io.prestosql.spi.plan.TableScanNode) TableStatisticsMetadata(io.prestosql.spi.statistics.TableStatisticsMetadata) Set(java.util.Set) NullLiteral(io.prestosql.sql.tree.NullLiteral) PlanNode(io.prestosql.spi.plan.PlanNode) ProjectNode(io.prestosql.spi.plan.ProjectNode) Metadata(io.prestosql.metadata.Metadata) Insert(io.prestosql.sql.tree.Insert) NodeRef(io.prestosql.sql.tree.NodeRef) CachingCostProvider(io.prestosql.cost.CachingCostProvider) SymbolUtils.toSymbolReference(io.prestosql.sql.planner.SymbolUtils.toSymbolReference) ReuseExchangeOperator(io.prestosql.spi.operator.ReuseExchangeOperator) ImmutableMap.toImmutableMap(com.google.common.collect.ImmutableMap.toImmutableMap) ExpressionUtils(io.prestosql.sql.ExpressionUtils) GenericLiteral(io.prestosql.sql.tree.GenericLiteral) VacuumTargetReference(io.prestosql.sql.planner.plan.TableWriterNode.VacuumTargetReference) StringLiteral(io.prestosql.sql.tree.StringLiteral) StatisticAggregations(io.prestosql.sql.planner.plan.StatisticAggregations) StatisticsWriterNode(io.prestosql.sql.planner.plan.StatisticsWriterNode) VacuumTableNode(io.prestosql.sql.planner.plan.VacuumTableNode) WriterTarget(io.prestosql.sql.planner.plan.TableWriterNode.WriterTarget) Field(io.prestosql.sql.analyzer.Field) OriginalExpressionUtils(io.prestosql.sql.relational.OriginalExpressionUtils) Analyze(io.prestosql.sql.tree.Analyze) FIXED_HASH_DISTRIBUTION(io.prestosql.sql.planner.SystemPartitioningHandle.FIXED_HASH_DISTRIBUTION) TableMetadata(io.prestosql.metadata.TableMetadata) VacuumTable(io.prestosql.sql.tree.VacuumTable) CharType(io.prestosql.spi.type.CharType) Node(io.prestosql.sql.tree.Node) QualifiedObjectName(io.prestosql.spi.connector.QualifiedObjectName) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) VARCHAR(io.prestosql.spi.type.VarcharType.VARCHAR) CreateTableAsSelect(io.prestosql.sql.tree.CreateTableAsSelect) BooleanLiteral(io.prestosql.sql.tree.BooleanLiteral) Session(io.prestosql.Session) ParsingUtil.createParsingOptions(io.prestosql.sql.ParsingUtil.createParsingOptions) Signature(io.prestosql.spi.function.Signature) DeleteNode(io.prestosql.sql.planner.plan.DeleteNode) TypeSignatureProvider.fromTypes(io.prestosql.sql.analyzer.TypeSignatureProvider.fromTypes) StatsProvider(io.prestosql.cost.StatsProvider) Query(io.prestosql.sql.tree.Query) Assignments(io.prestosql.spi.plan.Assignments) QUERY_REJECTED(io.prestosql.spi.StandardErrorCode.QUERY_REJECTED) ComparisonExpression(io.prestosql.sql.tree.ComparisonExpression) ConnectorTableMetadata(io.prestosql.spi.connector.ConnectorTableMetadata) Explain(io.prestosql.sql.tree.Explain) MetadataUtil.toSchemaTableName(io.prestosql.metadata.MetadataUtil.toSchemaTableName) VARBINARY(io.prestosql.spi.type.VarbinaryType.VARBINARY) ValuesNode(io.prestosql.spi.plan.ValuesNode) ColumnHandle(io.prestosql.spi.connector.ColumnHandle) LimitNode(io.prestosql.spi.plan.LimitNode) CubeMetadata(io.hetu.core.spi.cube.CubeMetadata) PlanOptimizer(io.prestosql.sql.planner.optimizations.PlanOptimizer) VarcharType(io.prestosql.spi.type.VarcharType) Expression(io.prestosql.sql.tree.Expression) StatisticAggregationsDescriptor(io.prestosql.sql.planner.plan.StatisticAggregationsDescriptor) QualifiedName(io.prestosql.sql.tree.QualifiedName) APPLY_ALL_RULES(io.prestosql.spi.plan.PlanNode.SkipOptRuleLevel.APPLY_ALL_RULES) SqlParser(io.prestosql.sql.parser.SqlParser) CachingStatsProvider(io.prestosql.cost.CachingStatsProvider) TableFinishNode(io.prestosql.sql.planner.plan.TableFinishNode) Type(io.prestosql.spi.type.Type) TypeCoercion(io.prestosql.type.TypeCoercion) BIGINT(io.prestosql.spi.type.BigintType.BIGINT) StatsCalculator(io.prestosql.cost.StatsCalculator) NewTableLayout(io.prestosql.metadata.NewTableLayout) AggregationNode.singleGroupingSet(io.prestosql.spi.plan.AggregationNode.singleGroupingSet) PrestoException(io.prestosql.spi.PrestoException) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) CatalogName(io.prestosql.spi.connector.CatalogName) ROW_COUNT(io.prestosql.spi.statistics.TableStatisticType.ROW_COUNT) UUID(java.util.UUID) RelationType(io.prestosql.sql.analyzer.RelationType) CubeFinishNode(io.prestosql.sql.planner.plan.CubeFinishNode) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) Preconditions.checkState(com.google.common.base.Preconditions.checkState) OptimizerUtils(io.prestosql.utils.OptimizerUtils) Scope(io.prestosql.sql.analyzer.Scope) List(java.util.List) Entry(java.util.Map.Entry) Optional(java.util.Optional) Analysis(io.prestosql.sql.analyzer.Analysis) NOT_SUPPORTED(io.prestosql.spi.StandardErrorCode.NOT_SUPPORTED) IfExpression(io.prestosql.sql.tree.IfExpression) StatsAndCosts(io.prestosql.cost.StatsAndCosts) HashMap(java.util.HashMap) RelationId(io.prestosql.sql.analyzer.RelationId) SimpleImmutableEntry(java.util.AbstractMap.SimpleImmutableEntry) NOT_FOUND(io.prestosql.spi.StandardErrorCode.NOT_FOUND) TableHandle(io.prestosql.spi.metadata.TableHandle) Function(java.util.function.Function) HashSet(java.util.HashSet) CubeStatus(io.hetu.core.spi.cube.CubeStatus) ImmutableList(com.google.common.collect.ImmutableList) FunctionCall(io.prestosql.sql.tree.FunctionCall) Verify.verify(com.google.common.base.Verify.verify) InsertReference(io.prestosql.sql.planner.plan.TableWriterNode.InsertReference) Objects.requireNonNull(java.util.Objects.requireNonNull) TableStatisticAggregation(io.prestosql.sql.planner.StatisticsAggregationPlanner.TableStatisticAggregation) Symbol(io.prestosql.spi.plan.Symbol) TableWriterNode(io.prestosql.sql.planner.plan.TableWriterNode) CubeUpdateMetadata(io.prestosql.spi.cube.CubeUpdateMetadata) ColumnMetadata(io.prestosql.spi.connector.ColumnMetadata) UpdateNode(io.prestosql.sql.planner.plan.UpdateNode) LambdaArgumentDeclaration(io.prestosql.sql.tree.LambdaArgumentDeclaration) Update(io.prestosql.sql.tree.Update) InsertCube(io.prestosql.sql.tree.InsertCube) PlanNodeIdAllocator(io.prestosql.spi.plan.PlanNodeIdAllocator) DISTRIBUTED_PLAN_SANITY_CHECKER(io.prestosql.sql.planner.sanity.PlanSanityChecker.DISTRIBUTED_PLAN_SANITY_CHECKER) ExplainAnalyzeNode(io.prestosql.sql.planner.plan.ExplainAnalyzeNode) Streams.zip(com.google.common.collect.Streams.zip) ColumnHandle(io.prestosql.spi.connector.ColumnHandle) TableStatisticsMetadata(io.prestosql.spi.statistics.TableStatisticsMetadata) ColumnMetadata(io.prestosql.spi.connector.ColumnMetadata) Symbol(io.prestosql.spi.plan.Symbol) VacuumTargetReference(io.prestosql.sql.planner.plan.TableWriterNode.VacuumTargetReference) CharType(io.prestosql.spi.type.CharType) VarcharType(io.prestosql.spi.type.VarcharType) Type(io.prestosql.spi.type.Type) RelationType(io.prestosql.sql.analyzer.RelationType) TableHandle(io.prestosql.spi.metadata.TableHandle)

Example 3 with VacuumTable

use of io.prestosql.sql.tree.VacuumTable in project hetu-core by openlookeng.

the class TestSqlParser method testVacuum.

@Test
public void testVacuum() {
    assertStatement("VACUUM TABLE t", new VacuumTable(Optional.empty(), table(QualifiedName.of("t")), false, false, Optional.empty(), true));
    assertStatement("VACUUM TABLE t AND WAIT", new VacuumTable(Optional.empty(), table(QualifiedName.of("t")), false, false, Optional.empty(), false));
    assertStatement("VACUUM TABLE t FULL AND WAIT", new VacuumTable(Optional.empty(), table(QualifiedName.of("t")), true, false, Optional.empty(), false));
    assertStatement("VACUUM TABLE t FULL UNIFY AND WAIT", new VacuumTable(Optional.empty(), table(QualifiedName.of("t")), true, true, Optional.empty(), false));
    assertStatement("VACUUM TABLE t PARTITION 'age = 10' AND WAIT", new VacuumTable(Optional.empty(), table(QualifiedName.of("t")), false, false, Optional.of("age = 10"), false));
}
Also used : VacuumTable(io.prestosql.sql.tree.VacuumTable) Test(org.testng.annotations.Test)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 VacuumTable (io.prestosql.sql.tree.VacuumTable)2 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 Verify.verify (com.google.common.base.Verify.verify)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableMap.toImmutableMap (com.google.common.collect.ImmutableMap.toImmutableMap)1 Iterables.getOnlyElement (com.google.common.collect.Iterables.getOnlyElement)1 Lists (com.google.common.collect.Lists)1 Streams.zip (com.google.common.collect.Streams.zip)1 CubeFilter (io.hetu.core.spi.cube.CubeFilter)1 CubeMetadata (io.hetu.core.spi.cube.CubeMetadata)1 CubeStatus (io.hetu.core.spi.cube.CubeStatus)1 Session (io.prestosql.Session)1 SystemSessionProperties.isSkipAttachingStatsWithPlan (io.prestosql.SystemSessionProperties.isSkipAttachingStatsWithPlan)1 CachingCostProvider (io.prestosql.cost.CachingCostProvider)1 CachingStatsProvider (io.prestosql.cost.CachingStatsProvider)1 CostCalculator (io.prestosql.cost.CostCalculator)1 CostProvider (io.prestosql.cost.CostProvider)1