code: func (d *ddl) CoalescePartitions(ctx sessionctx.Context, ident ast.Ident, spec *ast.AlterTableSpec) error {
  	is := d.infoHandle.Get()
  	schema, ok := is.SchemaByName(ident.Schema)
  	if !ok {
  		return errors.Trace(infoschema.ErrDatabaseNotExists.GenWithStackByArgs(schema))
  	}
  	t, err := is.TableByName(ident.Schema, ident.Name)
  	if err != nil {
  		return errors.Trace(infoschema.ErrTableNotExists.GenWithStackByArgs(ident.Schema, ident.Name))
  	}
  
  	meta := t.Meta()
  	if meta.GetPartitionInfo() == nil {
  		return errors.Trace(ErrPartitionMgmtOnNonpartitioned)
  	}
  
  	// Coalesce partition can only be used on hash/key partitions.
  	if meta.Partition.Type == model.PartitionTypeRange {
  		return errors.Trace(ErrCoalesceOnlyOnHashPartition)
  	}
  
  	// We don't support coalesce partitions hash type partition now.
  	if meta.Partition.Type == model.PartitionTypeHash {
  		return errors.Trace(ErrUnsupportedCoalescePartition)
  	}
  
  	return errors.Trace(err)
  }
docs: // CoalescePartitions coalesce partitions can be used with a table that is partitioned by hash or key to reduce the number of partitions by number.