text:
Treasure Hounds Arrives on DVD, Digital HD, and On Demand August 15
The hunt begins! An adventure for the whole family, Treasure Hounds arrives on DVD, Digital HD, and On Demand August 15 from Lionsgate. Norm MacDonald stars as the voice of Skipper, a dog searching for hidden treasure with his owner, Jack. When their town is on the brink of an evacuation, Skipper and Jack race against the clock to find the treasure that will save the town. Considered "physical comedy at its best and…well worth seeing" by the Dove Foundation, and awarded the Dove Family Seal of Approval, the DVD includes a behind the scenes featurette and limited-edition specialty packaging. From the producers of Vampire Dog, the Treasure Hounds DVD will be available for the suggested retail price of $19.98.
From left to right: Helen Colliander ("Jennifer," bottom left) and Jessie Fraser ("Kim," upper right) and Valin Shinyei ("Jack," bottom right) star in Lionsgate Home Entertainment's TREASURE HOUNDS.
Moving into his late grandfather's house, young Jack inherits the old man's dog, Skipper (Norm MacDonald) — who can talk! With the sassy pooch's help, Jack learns that Grandpa left a priceless Spanish treasure hidden somewhere in the town. Jack joins forces with a trio of clever neighbor kids — a goth girl, a socialite, and a jokester—to find the valuable booty, with Skipper leading the way. But can they outrun the brazen, bumbling thieves that will stop at nothing to seize the prize for themselves?
From left to right: Valin Shinyei ("Jack," left) and Norm MacDonald (voice of "Skipper," right) star in Lionsgate Home Entertainment's TREASURE HOUNDS.
DVD/DIGITAL HD SPECIAL FEATURES
"Behind the Scene of Treasure Hounds" Featurette
Norm MacDonald Doctor Dolittle, Vampire Dog, TV's "Saturday Night Live"
Jessie Fraser TV's "The Man in the High Castle" and "Mistresses"
Valin Shinyei A Christmas Story 2, TV's "Noddy, Toyland Detective"
Check out the Treasure Hounds trailer below!
« Cars 3 Movie Prize Pack Giveaway
Country Music Film Forever My Girl »


The Dark Tower, the first film adaptation of Stephen King's book series of the same name, has had its 2017 release date put back.
Starring Idris Elba (playing Roland the Gunslinger) and Matthew McConaughey (the Man In Black), the adaptation is being helmed by director Nikolaj Arcel, with producer credits going to Ron Howard and King himself. The Dark Tower was expected to be released in February 2017.
However, as Entertainment Weekly reports, post-production could not be completed in time by Sony Pictures and production company MRC, with visual effects cited as the primary reason for the delay. Principal photography on the film wrapped back in July, but the delay in post- means that the film will now be released later in the year.
Distributors have now been informed that The Dark Tower will hit the big screen on July 28.
It is hoped that the film will become the first in a new movie franchise, which will follow King's series of Dark Tower novels.
Back in September, Elba was confirmed for a companion televised adaptation of The Dark Tower, which is expected to air in 2018.


What is the kind of this series ?
What is name of the father ?
How many people went to prison in the family ?
Who is stepmother of the family ?
Who they created there company ?
The parents are still together?
Who many are he it in the family ?
Where does the serieis have been shot ?


text:
Home / LIFESTYLE / Drivers clearly unprepared for a host of rule changes in 2015
Drivers clearly unprepared for a host of rule changes in 2015
The Institute of Advanced Motorists (IAM) is warning people to be ready for a host of changes coming up in driving laws in the UK – and fear many are totally unaware of what's in store in 2015.
New regulations that have changed driving licences, drug-drive limits and speed limits have already taken place in 2015. There are, however, other changes expected to take place later in the year.
For motorists oblivious to these changes, the IAM is raising awareness to ensure all road users understand the new driving laws and changes.
In March a new law on driving under the influence of legal or illegal drugs including prescription drugs including diazepam, methadone and morphine came into force across England and Wales.
Earlier this month, the IAM revealed the true scale of drug-driving since the new regulations started and found 902 arrests have already been made by police forces. Motorists convicted of drug-driving will get a minimum one year driving ban, unlimited fine, up to six months imprisonment and a criminal record.
In April, the speed limit for the largest heavy goods vehicles (HGVs) travelling on a single carriageway across England and Wales increased from 40mph to 50mph, and on a dual carriageway it has increased from 50mph to 60mph.
Motorists can now be charged with minor motoring offences including speeding, failing to identify the driver or using a vehicle without insurance to respond to the charges made against them digitally, to the scrapping of the Driver and Vehicle Licensing Agency (DVLA) paper counterpart of the photo card on 8 June, in which all driver information such as endorsements and which category of vehicles you are entitled to drive is stored electronically – the changes have allowed motorists to access information remotely.
Important changes have also come into force with how motorists provide proof of their driving records to a third party and will need to obtain a special code from online to allow sharing of data.
Upcoming changes to driving laws will also see smoking in cars carrying children under the age of 18 becoming illegal from 1 October. Potential fines and penalties are expected to be announced closer to the time.
Sarah Sillars, IAM chief executive officer said: "This year has seen some of the biggest changes in motoring procedures we have ever seen. It is very important drivers and riders are fully up-to-date on what is happening – they will affect everyone in one way or another. So don't get caught out, get informed."
Tags: driving ban, driving licence, drug driving, DVLA, endorsements, IAM, Institute of Advanced Motorists, motorists, older drivers, older motorists, rule changes, Sarah Sillars
admin 2151 views 0 likes Jul 9, 2015 LIFESTYLE Share
Mature drivers favour checks on over 70s
Don't give up driving get assessed
Is this the end of the road?
yesterdayDo you have trouble sleeping? Read more at /t.co/qNkXa51HHP

redpajama_set_name: RedPajamaCommonCrawl


A Yag capsulotomy is a special laser treatment used to improve your vision after cataract surgery. It is a simple, commonly performed procedure which is very safe. During your cataract operation, the natural lens inside your eye that had become cloudy was removed.
How much is YAG laser surgery ?
As an example of a common complication, you might need to undergo a laser procedure (YAG laser capsulotomy) costing about $300 to correct posterior capsule opacification (PCO). This complication involves clouding of the residual membrane left in the eye at the time of cataract surgery, and upon which the IOL is placed.
What is YAG laser posterior capsulotomy ?
This is a non-invasive laser procedure which eliminates the cloudiness that occasionally interferes with a patient's vision after cataract surgery. During cataract surgery the cataract is removed but a thin membrane (capsule) that held the cataract is left in place to hold the implanted artificial lens. Leaving the capsule in place during cataract surgery allows the vision after surgery to be more stable and ensures fewer surgical complications. However, sometimes the posterior or back portion of the capsule becomes cloudy over time. This can be resolved with a quick laser procedure performed in the outpatient clinic.
Problems after cataract surgery are rare but can occur. Sometimes the tissue that encloses the artificial intraocular lens becomes cloudy and blurs the vision. This is known as a secondary cataract, even though it's not a true cataract. This can develop months or even years after cataract surgery. This outpatient procedure is treated with a laser, called YAG laser capsulotomy.
The doctor will first use drops to dilate the pupil and then use a laser to make a tiny hole in the eye tissue behind the lens to let light pass through it. This outpatient procedure takes just minutes to perform. Most patients will have instant improvement to their vision while others will notice a gradual improvement over several days. Some doctors will prescribe anti-inflammatory drops for a few days after.
Serious complications with posterior capsulotomy are extremely rare. It is a safe and effective procedure, but like any medical procedure, it does have some risks. The most common being the rise in pressure within the eye. If this occurs then you may be given drops, or a combination of tablets and drops, to reduce the pressure. There is also a slightly higher risk of retinal detachment and also swelling of the macula both of which are rare if the laser treatment takes place more than 6 months following original cataract surgery.


text:
When Blossfeldt meets Googie Style and Interaction of Color meets Star Wars
A studio talk between Florian Waldvogel and Janine Eggert/Philipp Ricklefs
Florian Waldvogel: Are your sculptures and objects preceded by design drawings?
Janine Eggert: Yes, on the one hand we use design drawings simply as a practical means to implement our work; to know where to put which screw. But principally drawings precede the sculptures as a means of sketching and visualizing, especially to coordinate our ideas.
Philipp Ricklefs: The development process goes as follows: dialogue, sketch, model, 3D blueprint, 1:1 test, concrete design drawing, and finally the work is executed. The drawing is indeed the binding master plan, but due to the concept of collaboration the development process remains fluid.
FW: I'm asking because when I look at your works I get the impression that they are geometric drawings which dissolve into multiple layers and become three-dimensional.
PR: Great that you see it that way. Both in our joint work and in the single artistic production, geometry serves as the basis for the finding of stereometric formations. Our formal concept of framework or skeleton as the shape giving element can be compared to a drawing. The final cubature results from the use of the surface material.
FW: So, an important aspect in your work is geometry. Do you use geometry because it eludes a simple cursory viewing and because it requires successive viewings in order to decipher?
JE: For us, geometry is a means of schematization, a possibility to build objects whose components create an industrial aesthetic, one which negates the feeling of being "hand-made". These polygonal volumes have complex angles and sight lines, so they cannot be captured only from a single viewpoint. They can only be realized fully by moving around within the space.
PR: For the spectator, this capturing of the room is a performative act. This understanding is done gradually, by starting with the details of each component of the sculpture. This inductive process then creates the overall picture.
FW: Is geometry an alternative to the picture, like a cosmic signature? A sort of temptation that is triggered by the absence of a two-dimensional picture?
PR: Geometry is the necessity to decode the environment by means of mathematical laws. The point is to interpret nature instead of imitating it. Geometry offers the possibility of creating an equivalent to nature which is autonomous, not merely a copy of it. Therefore something natural is created through artificial means.
JE: In any case, geometry is an alternative draft to the image. It creates a structure. Rhythm, shape, and color are visual elements which stand for themselves and can also be used to realize the concretization of intellectual forms. The works don't communicate to the viewer via a certain image, rather through the parameters they create.
FW: Or is geometry rather an invitation to the viewer to semantically give their own meaning to the question of form?
JE: This is something that is inherent to geometric or abstract entities, it is a natural process of perception. However this does not have priority in our works.
PR: The thing is that there are examples for many works which stay recognizable despite formal reduction, and which function as an invitation to the viewer to get into the work's cosmos and its semantics.
JE: The term cosmic signature gets another meaning then. Since the ideas the works are based on become accessible not pictorially, but structurally, one could maybe say that their cosmic signature is radiated through or embedded in the work. Like a planet that sends out a specific light spectrum and thereby leaves its fingerprint, its signature, the Concorde also has its own particular signature which is a part of the work "Polygon".
FW: How important is the concept of "space" to you?
PR: The concept of "space" or "site" becomes important on different layers. Our joint works have a relationship with site in general which consists of a contextual debate between a site of art representation and production. The architecture of the site, the space, then determines the formal realization of the work.
JE: The works may be conceived starting with specific sites, and the exhibition space is structurally a part of the work, but the concepts of modularity and reproducibility make the works flexible, philosophic models which can be adapted to other spatial relations. They are related to the site but not bound to it.
PR: On the other hand, the extensive and accessible installations create an architecture which constitutes an area of interaction between the work and the viewer. These areas, which don't overlap in the usual frontal encounter, intertwine. As three-dimensional objects in space, the works infringe upon the viewer's field, and as interactive structures they surround him, making him become a part of them.
FW: Is it a trick that your works have an abstract character which is capable of describing specific ideas in their intellectual proportions and visualizing them?
JE: Why trick? Geometrism as a statement of intellectual ideas has immemorial tradition.
PR: I would rather consider it as a method that enables one to draft ideas in a universal language.
JE: Geometry is meant for phrasing the spiritual, the ineffable. The outset occurred with cultic symbols and continued into writing as form of communication. The principles of geometry are mirrored in the way the human mind works and because of this, reading abstract forms becomes a natural process.
FW: Do you extend the reference area for the awareness of site and theme by means of combining perspectives of natural and fictional spaces?
PR: The natural space is a necessary part of the perception of stereometric formations to the same degree as of the objects themselves. In establishing or abandoning a point of view, the space serves as frame of reference and becomes an integral part of the piece.
JE: The design principle of structure and shell creates inner and outer spaces that are very diverse. The interiors are detached from their topology and are removed from the reality of the exhibition space. Instead they simulate a fictional space, that broadens the view of site and scope.
FW: Is this fictional space a range of thought, like a universal frame of reference?
JE: Yes, this space is a vessel, that sets up a reference system. Depending upon the work you have to differentiate between absolute and relative spaces. The interior of the piece 'A Diamond As Big As The Ritz' is an absolute space, like the universe as universal frame, in which the action takes place only in reference to the space itself.
PR: Physically the wheel is set in motion through the spectator's own movement. From his perspective he can't determine whether it's the wheel that is moving or himself. His benchmarks are just himself and the surrounding space. This situation raises awareness of relationships.
JE: In the piece 'XEROX' however, there exist several fictional spaces. In the first space the star is on view assembled out of its separate components and therefore allows one to imagine its deconstructed state. In the next space it is shown the other way round, the star is fragmented and can only be assembled conceptually. Following there is a third space, an actually impossible space, from which both phases of the work and its virtual complements are conceivable. Upstairs the cat is alive and downstairs it is dead, two states of matter at the same time, a principle of quantum mechanics.
FW: Is it possible to speak of referential spaces, in whose universal frame of reference made of subjects, contexts, nexuses, coordinates, data and knowledge we can find our way despite all of the complexity?
PR: One really can orient oneself therein, since it is a matter of fundamental experiences and the spectator has to decide for himself to what extent he wants to yield to the further scope of reference.
FW: Would you agree if your works were referred to as symbolic sites where past and future meet?
PR: We are interested in utopias or utopian ideas, past and present, good and bad equally. These pipe-dreams will never become reality, since as utopias they already imply failure. Blossfeldt can meet with Googie Style and Interaction of Color with Star Wars.
We have a comprehensive view on the world of forms that permits us to view things detached of a specific context in time. In this process different concepts are transformed into an autonomous formal language.
FW: Do you think that this playful perception of structure is due to the fact that the standard is always the human being?
JE: The starting point is always the self and its relationship to the setting. Meaning man and his proportions are central to our pieces. The usability of the works creates a natural contact with them almost like they are everyday objects. There is no barrier between piece and spectator, neither through scale nor through the formal presentation. The initial approach occurs through immediate experience and without intellectual translation.
PR: In the same unhampered way we enter factories and play with the techniques of production.
FW: Do your works represent offers based on a world of perception allowing flexible contemplation without the need to take a fixed position or perspective?
JE: A specific point of view isn't the decisive factor in contemplating our works. It is rather the interaction between different possibilities or variations of experience. One might describe the various situations of engagement with the piece like an experimental set-up that doesn't allow for a fixed point of view.
Translation: Brenton Iversen/ Thorsten Schülke


text:
using namespace impala;
using namespace strings;

NestedLoopJoinNode::NestedLoopJoinNode(ObjectPool* pool, const TPlanNode& tnode,
    const DescriptorTbl& descs)
  : BlockingJoinNode("NestedLoopJoinNode", tnode.nested_loop_join_node.join_op, pool,
        tnode, descs),
    build_batches_(NULL),
    current_build_row_idx_(0),
    process_unmatched_build_rows_(false) {
}

NestedLoopJoinNode::~NestedLoopJoinNode() {
  DCHECK(is_closed());
}

Status NestedLoopJoinNode::Init(const TPlanNode& tnode, RuntimeState* state) {
  RETURN_IF_ERROR(BlockingJoinNode::Init(tnode, state));
  DCHECK(tnode.__isset.nested_loop_join_node);
  // join_conjunct_evals_ are evaluated in the context of rows assembled from
  // all inner and outer tuples.
  RowDescriptor full_row_desc(*child(0)->row_desc(), *child(1)->row_desc());
  RETURN_IF_ERROR(ScalarExpr::Create(tnode.nested_loop_join_node.join_conjuncts,
      full_row_desc, state, &join_conjuncts_));
  DCHECK(tnode.nested_loop_join_node.join_op != TJoinOp::CROSS_JOIN ||
      join_conjuncts_.size() == 0) << "Join conjuncts in a cross join";
  return Status::OK();
}

Status NestedLoopJoinNode::Open(RuntimeState* state) {
  SCOPED_TIMER(runtime_profile_->total_time_counter());
  ScopedOpenEventAdder ea(this);
  RETURN_IF_ERROR(BlockingJoinNode::Open(state));
  RETURN_IF_ERROR(ScalarExprEvaluator::Open(join_conjunct_evals_, state));

  // Check for errors and free expr result allocations before opening children.
  RETURN_IF_CANCELLED(state);
  RETURN_IF_ERROR(QueryMaintenance(state));

  if (child(1)->type() == TPlanNodeType::type::SINGULAR_ROW_SRC_NODE) {
    DCHECK(IsInSubplan());
    // When inside a subplan, open the first child before doing the build such that
    // UnnestNodes on the probe side are opened and project their unnested collection
    // slots. Otherwise, the build might unnecessarily deep-copy those collection slots,
    // and this node would return them in GetNext().
    // TODO: Remove this special-case behavior for subplans once we have proper
    // projection. See UnnestNode for details on the current projection implementation.
    RETURN_IF_ERROR(child(0)->Open(state));
    RETURN_IF_ERROR(ConstructSingularBuildSide(state));
    DCHECK_EQ(builder_->copied_build_batches()->total_num_rows(), 0);
    build_batches_ = builder_->input_build_batches();
  } else {
    RETURN_IF_ERROR(
        BlockingJoinNode::ProcessBuildInputAndOpenProbe(state, builder_.get()));
    build_batches_ = builder_->GetFinalBuildBatches();
    if (matching_build_rows_ != NULL) {
      RETURN_IF_ERROR(ResetMatchingBuildRows(state, build_batches_->total_num_rows()));
    }
  }
  RETURN_IF_ERROR(BlockingJoinNode::GetFirstProbeRow(state));
  ResetForProbe();
  return Status::OK();
}

Status NestedLoopJoinNode::Prepare(RuntimeState* state) {
  SCOPED_TIMER(runtime_profile_->total_time_counter());
  RETURN_IF_ERROR(BlockingJoinNode::Prepare(state));
  RETURN_IF_ERROR(ScalarExprEvaluator::Create(join_conjuncts_, state,
      pool_, expr_perm_pool(), expr_results_pool(), &join_conjunct_evals_));
  builder_.reset(new NljBuilder(child(1)->row_desc(), state));
  RETURN_IF_ERROR(builder_->Prepare(state, mem_tracker()));
  runtime_profile()->PrependChild(builder_->profile());

  // For some join modes we need to record the build rows with matches in a bitmap.
  if (join_op_ == TJoinOp::RIGHT_ANTI_JOIN || join_op_ == TJoinOp::RIGHT_SEMI_JOIN ||
      join_op_ == TJoinOp::RIGHT_OUTER_JOIN || join_op_ == TJoinOp::FULL_OUTER_JOIN) {
    if (child(1)->type() == TPlanNodeType::type::SINGULAR_ROW_SRC_NODE) {
      // Allocate a fixed-size bitmap with a single element if we have a singular
      // row source node as our build child.
      int64_t bitmap_mem_usage = Bitmap::MemUsage(1);
      if (!mem_tracker()->TryConsume(bitmap_mem_usage)) {
        return mem_tracker()->MemLimitExceeded(state,
            "Could not allocate bitmap in nested loop join", bitmap_mem_usage);
      }
      matching_build_rows_.reset(new Bitmap(1));
    } else {
      // Allocate empty bitmap to be expanded later.
      matching_build_rows_.reset(new Bitmap(0));
    }
  }
  return Status::OK();
}

Status NestedLoopJoinNode::Reset(RuntimeState* state, RowBatch* row_batch) {
  builder_->Reset();
  build_batches_ = NULL;
  matched_probe_ = false;
  current_probe_row_ = NULL;
  probe_batch_pos_ = 0;
  process_unmatched_build_rows_ = false;
  return BlockingJoinNode::Reset(state, row_batch);
}

void NestedLoopJoinNode::Close(RuntimeState* state) {
  if (is_closed()) return;
  ScalarExprEvaluator::Close(join_conjunct_evals_, state);
  ScalarExpr::Close(join_conjuncts_);
  if (builder_ != NULL) {
    // IMPALA-6595: builder must be closed before child.
    DCHECK(builder_->is_closed() || !children_[1]->is_closed());
    builder_->Close(state);
  }
  build_batches_ = NULL;
  if (matching_build_rows_ != NULL) {
    mem_tracker()->Release(matching_build_rows_->MemUsage());
    matching_build_rows_.reset();
  }
  BlockingJoinNode::Close(state);
}

Status NestedLoopJoinNode::ConstructSingularBuildSide(RuntimeState* state) {
  // Optimized path for a common subplan shape with a singular row src node on the build
  // side that avoids expensive timers, virtual function calls, and other overhead.
  DCHECK_EQ(child(1)->type(), TPlanNodeType::type::SINGULAR_ROW_SRC_NODE);
  DCHECK(IsInSubplan());
  RowBatch* batch = builder_->GetNextEmptyBatch();
  bool eos;
  RETURN_IF_ERROR(child(1)->GetNext(state, batch, &eos));
  DCHECK_EQ(batch->num_rows(), 1);
  DCHECK(eos);
  DCHECK(!batch->needs_deep_copy());
  builder_->AddBuildBatch(batch);
  if (matching_build_rows_ != NULL) {
    DCHECK_EQ(matching_build_rows_->num_bits(), 1);
    matching_build_rows_->SetAllBits(false);
  }
  return Status::OK();
}

Status NestedLoopJoinNode::ResetMatchingBuildRows(RuntimeState* state, int64_t num_bits) {
  // Reuse existing bitmap, expanding it if needed.
  if (matching_build_rows_->num_bits() >= num_bits) {
    matching_build_rows_->SetAllBits(false);
  } else {
    // Account for the additional memory used by the bitmap.
    int64_t bitmap_size_increase =
        Bitmap::MemUsage(num_bits) - matching_build_rows_->MemUsage();
    if (!mem_tracker()->TryConsume(bitmap_size_increase)) {
      return mem_tracker()->MemLimitExceeded(state,
          "Could not expand bitmap in nested loop join", bitmap_size_increase);
    }
    matching_build_rows_->Reset(num_bits);
  }
  return Status::OK();
}

void NestedLoopJoinNode::ResetForProbe() {
  DCHECK(build_batches_ != NULL);
  build_row_iterator_ = build_batches_->Iterator();
  current_build_row_idx_ = 0;
  matched_probe_ = false;
}

Status NestedLoopJoinNode::GetNext(
    RuntimeState* state, RowBatch* output_batch, bool* eos) {
  DCHECK(!output_batch->AtCapacity());
  SCOPED_TIMER(runtime_profile_->total_time_counter());
  ScopedGetNextEventAdder ea(this, eos);
  RETURN_IF_ERROR(ExecDebugAction(TExecNodePhase::GETNEXT, state));
  RETURN_IF_CANCELLED(state);
  RETURN_IF_ERROR(QueryMaintenance(state));
  *eos = false;

  if (!HasValidProbeRow()) {
    RETURN_IF_ERROR(NextProbeRow(state, output_batch));
    if (output_batch->AtCapacity()) goto end;
  }

  switch (join_op_) {
    case TJoinOp::INNER_JOIN:
    case TJoinOp::CROSS_JOIN:
      RETURN_IF_ERROR(GetNextInnerJoin(state, output_batch));
      break;
    case TJoinOp::LEFT_OUTER_JOIN:
      RETURN_IF_ERROR(GetNextLeftOuterJoin(state, output_batch));
      break;
    case TJoinOp::LEFT_SEMI_JOIN:
      RETURN_IF_ERROR(GetNextLeftSemiJoin(state, output_batch));
      break;
    case TJoinOp::LEFT_ANTI_JOIN:
      RETURN_IF_ERROR(GetNextLeftAntiJoin(state, output_batch));
      break;
    case TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN:
      RETURN_IF_ERROR(GetNextNullAwareLeftAntiJoin(state, output_batch));
      break;
    case TJoinOp::RIGHT_OUTER_JOIN:
      RETURN_IF_ERROR(GetNextRightOuterJoin(state, output_batch));
      break;
    case TJoinOp::RIGHT_SEMI_JOIN:
      RETURN_IF_ERROR(GetNextRightSemiJoin(state, output_batch));
      break;
    case TJoinOp::RIGHT_ANTI_JOIN:
      RETURN_IF_ERROR(GetNextRightAntiJoin(state, output_batch));
      break;
    case TJoinOp::FULL_OUTER_JOIN:
      RETURN_IF_ERROR(GetNextFullOuterJoin(state, output_batch));
      break;
    default:
      DCHECK(false) << "Unknown join type: " << join_op_;
  }

end:
  if (ReachedLimit()) {
    int64_t extra_rows = num_rows_returned_ - limit_;
    DCHECK_GE(extra_rows, 0);
    DCHECK_LE(extra_rows, output_batch->num_rows());
    output_batch->set_num_rows(output_batch->num_rows() - extra_rows);
    num_rows_returned_ = limit_;
    eos_ = true;
  }
  if (eos_) {
    *eos = true;
    probe_batch_->TransferResourceOwnership(output_batch);
    build_batches_->TransferResourceOwnership(output_batch);
  }
  COUNTER_SET(rows_returned_counter_, num_rows_returned_);
  return Status::OK();
}

Status NestedLoopJoinNode::GetNextInnerJoin(RuntimeState* state,
    RowBatch* output_batch) {
  while (!eos_) {
    DCHECK(HasValidProbeRow());
    bool return_output_batch;
    RETURN_IF_ERROR(
        FindBuildMatches(state, output_batch, &return_output_batch));
    if (return_output_batch) return Status::OK();
    RETURN_IF_ERROR(NextProbeRow(state, output_batch));
    if (output_batch->AtCapacity()) break;
  }
  return Status::OK();
}

Status NestedLoopJoinNode::GetNextLeftOuterJoin(RuntimeState* state,
    RowBatch* output_batch) {
  while (!eos_) {
    DCHECK(HasValidProbeRow());
    bool return_output_batch;
    RETURN_IF_ERROR(
        FindBuildMatches(state, output_batch, &return_output_batch));
    if (return_output_batch) return Status::OK();
    if (!matched_probe_) RETURN_IF_ERROR(ProcessUnmatchedProbeRow(state, output_batch));
    RETURN_IF_ERROR(NextProbeRow(state, output_batch));
    if (output_batch->AtCapacity()) break;
  }
  return Status::OK();
}

Status NestedLoopJoinNode::GetNextLeftSemiJoin(RuntimeState* state,
    RowBatch* output_batch) {
  ScalarExprEvaluator* const* join_conjunct_evals = join_conjunct_evals_.data();
  size_t num_join_conjuncts = join_conjuncts_.size();
  DCHECK_EQ(num_join_conjuncts, join_conjunct_evals_.size());
  const int N = BitUtil::RoundUpToPowerOfTwo(state->batch_size());

  while (!eos_) {
    DCHECK(HasValidProbeRow());
    while (!build_row_iterator_.AtEnd()) {
      DCHECK(HasValidProbeRow());
      CreateOutputRow(semi_join_staging_row_, current_probe_row_,
        build_row_iterator_.GetRow());
      build_row_iterator_.Next();
      ++current_build_row_idx_;
      // This loop can go on for a long time if the conjuncts are very selective. Do
      // expensive query maintenance after every N iterations.
      if ((current_build_row_idx_ & (N - 1)) == 0) {
        RETURN_IF_CANCELLED(state);
        RETURN_IF_ERROR(QueryMaintenance(state));
      }
      if (!EvalConjuncts(
              join_conjunct_evals, num_join_conjuncts, semi_join_staging_row_)) {
        continue;
      }
      // A match is found. Create the output row from the probe row.
      TupleRow* output_row = output_batch->GetRow(output_batch->AddRow());
      output_batch->CopyRow(current_probe_row_, output_row);
      VLOG_ROW << "match row: " << PrintRow(output_row, *row_desc());
      output_batch->CommitLastRow();
      ++num_rows_returned_;
      if (ReachedLimit()) {
        eos_ = true;
        return Status::OK();
      }
      // Stop scanning the build rows for the current probe row. If we reach
      // this point, we already have a match for this probe row.
      break;
    }
    RETURN_IF_ERROR(NextProbeRow(state, output_batch));
    if (output_batch->AtCapacity()) break;
  }
  return Status::OK();
}

Status NestedLoopJoinNode::GetNextLeftAntiJoin(RuntimeState* state,
    RowBatch* output_batch) {
  ScalarExprEvaluator* const* join_conjunct_evals = join_conjunct_evals_.data();
  size_t num_join_conjuncts = join_conjuncts_.size();
  DCHECK_EQ(num_join_conjuncts, join_conjunct_evals_.size());
  const int N = BitUtil::RoundUpToPowerOfTwo(state->batch_size());

  while (!eos_) {
    DCHECK(HasValidProbeRow());
    while (!build_row_iterator_.AtEnd()) {
      DCHECK(current_probe_row_ != NULL);
      CreateOutputRow(semi_join_staging_row_, current_probe_row_,
          build_row_iterator_.GetRow());
      build_row_iterator_.Next();
      ++current_build_row_idx_;
      // This loop can go on for a long time if the conjuncts are very selective. Do
      // expensive query maintenance after every N iterations.
      if ((current_build_row_idx_ & (N - 1)) == 0) {
        RETURN_IF_CANCELLED(state);
        RETURN_IF_ERROR(QueryMaintenance(state));
      }
      if (EvalConjuncts(
              join_conjunct_evals, num_join_conjuncts, semi_join_staging_row_)) {
        // Found a match for the probe row. This row will not be in the result.
        matched_probe_ = true;
        break;
      }
    }
    if (!matched_probe_) RETURN_IF_ERROR(ProcessUnmatchedProbeRow(state, output_batch));
    RETURN_IF_ERROR(NextProbeRow(state, output_batch));
    if (output_batch->AtCapacity()) break;
  }
  return Status::OK();
}

Status NestedLoopJoinNode::GetNextNullAwareLeftAntiJoin(RuntimeState* state,
    RowBatch* output_batch) {
  return Status("Nested-loop join with null-aware anti join mode is not implemented");
}

Status NestedLoopJoinNode::GetNextRightOuterJoin(RuntimeState* state,
    RowBatch* output_batch) {
  while (!eos_ && HasMoreProbeRows()) {
    DCHECK(HasValidProbeRow());
    bool return_output_batch = false;
    RETURN_IF_ERROR(
        FindBuildMatches(state, output_batch, &return_output_batch));
    if (return_output_batch) return Status::OK();
    RETURN_IF_ERROR(NextProbeRow(state, output_batch));
    if (output_batch->AtCapacity()) return Status::OK();
  }
  return ProcessUnmatchedBuildRows(state, output_batch);
}

Status NestedLoopJoinNode::GetNextRightSemiJoin(RuntimeState* state,
    RowBatch* output_batch) {
  ScalarExprEvaluator* const* join_conjunct_evals = join_conjunct_evals_.data();
  size_t num_join_conjuncts = join_conjuncts_.size();
  DCHECK_EQ(num_join_conjuncts, join_conjunct_evals_.size());
  DCHECK(matching_build_rows_ != NULL);
  const int N = BitUtil::RoundUpToPowerOfTwo(state->batch_size());

  while (!eos_) {
    DCHECK(HasValidProbeRow());
    while (!build_row_iterator_.AtEnd()) {
      DCHECK(HasValidProbeRow());
      // This loop can go on for a long time if the conjuncts are very selective.
      // Do query maintenance every N iterations.
      if ((current_build_row_idx_ & (N - 1)) == 0) {
        if (ReachedLimit()) {
          eos_ = true;
          return Status::OK();
        }
        RETURN_IF_CANCELLED(state);
        RETURN_IF_ERROR(QueryMaintenance(state));
      }

      // Check if we already have a match for the build row.
      if (matching_build_rows_->Get(current_build_row_idx_)) {
        build_row_iterator_.Next();
        ++current_build_row_idx_;
        continue;
      }
      CreateOutputRow(semi_join_staging_row_, current_probe_row_,
          build_row_iterator_.GetRow());
      // Evaluate the join conjuncts on the semi-join staging row.
      if (!EvalConjuncts(
              join_conjunct_evals, num_join_conjuncts, semi_join_staging_row_)) {
        build_row_iterator_.Next();
        ++current_build_row_idx_;
        continue;
      }
      TupleRow* output_row = output_batch->GetRow(output_batch->AddRow());
      matching_build_rows_->Set(current_build_row_idx_, true);
      output_batch->CopyRow(build_row_iterator_.GetRow(), output_row);
      build_row_iterator_.Next();
      ++current_build_row_idx_;
      VLOG_ROW << "match row: " << PrintRow(output_row, *row_desc());
      output_batch->CommitLastRow();
      ++num_rows_returned_;
      if (output_batch->AtCapacity()) return Status::OK();
    }
    RETURN_IF_ERROR(NextProbeRow(state, output_batch));
    if (output_batch->AtCapacity()) break;
  }
  return Status::OK();
}

Status NestedLoopJoinNode::GetNextRightAntiJoin(RuntimeState* state,
    RowBatch* output_batch) {
  ScalarExprEvaluator* const* join_conjunct_evals = join_conjunct_evals_.data();
  size_t num_join_conjuncts = join_conjuncts_.size();
  DCHECK_EQ(num_join_conjuncts, join_conjunct_evals_.size());
  DCHECK(matching_build_rows_ != NULL);
  const int N = BitUtil::RoundUpToPowerOfTwo(state->batch_size());

  while (!eos_ && HasMoreProbeRows()) {
    DCHECK(HasValidProbeRow());
    while (!build_row_iterator_.AtEnd()) {
      DCHECK(current_probe_row_ != NULL);
      // This loop can go on for a long time if the conjuncts are very selective.
      // Do query maintenance every N iterations.
      if ((current_build_row_idx_ & (N - 1)) == 0) {
        RETURN_IF_CANCELLED(state);
        RETURN_IF_ERROR(QueryMaintenance(state));
      }

      if (matching_build_rows_->Get(current_build_row_idx_)) {
        build_row_iterator_.Next();
        ++current_build_row_idx_;
        continue;
      }
      CreateOutputRow(semi_join_staging_row_, current_probe_row_,
          build_row_iterator_.GetRow());
      if (EvalConjuncts(
              join_conjunct_evals, num_join_conjuncts, semi_join_staging_row_)) {
        matching_build_rows_->Set(current_build_row_idx_, true);
      }
      build_row_iterator_.Next();
      ++current_build_row_idx_;
    }
    RETURN_IF_ERROR(NextProbeRow(state, output_batch));
    if (output_batch->AtCapacity()) return Status::OK();
  }
  return ProcessUnmatchedBuildRows(state, output_batch);
}

Status NestedLoopJoinNode::GetNextFullOuterJoin(RuntimeState* state,
    RowBatch* output_batch) {
  while (!eos_ && HasMoreProbeRows()) {
    DCHECK(HasValidProbeRow());
    bool return_output_batch;
    RETURN_IF_ERROR(
        FindBuildMatches(state, output_batch, &return_output_batch));
    if (return_output_batch) return Status::OK();
    if (!matched_probe_) {
      RETURN_IF_ERROR(ProcessUnmatchedProbeRow(state, output_batch));
    }
    RETURN_IF_ERROR(NextProbeRow(state, output_batch));
    if (output_batch->AtCapacity()) return Status::OK();
  }
  return ProcessUnmatchedBuildRows(state, output_batch);
}

Status NestedLoopJoinNode::ProcessUnmatchedProbeRow(RuntimeState* state,
    RowBatch* output_batch) {
  DCHECK(!matched_probe_);
  DCHECK(current_probe_row_ != NULL);
  ScalarExprEvaluator* const* conjunct_evals = conjunct_evals_.data();
  size_t num_conjuncts = conjuncts_.size();
  DCHECK_EQ(num_conjuncts, conjunct_evals_.size());
  TupleRow* output_row = output_batch->GetRow(output_batch->AddRow());
  if (join_op_ == TJoinOp::LEFT_OUTER_JOIN || join_op_ == TJoinOp::FULL_OUTER_JOIN) {
    CreateOutputRow(output_row, current_probe_row_, NULL);
  } else {
    DCHECK(join_op_ == TJoinOp::LEFT_ANTI_JOIN) << "Unsupported join operator: " <<
        join_op_;
    output_batch->CopyRow(current_probe_row_, output_row);
  }
  // Evaluate all the other (non-join) conjuncts.
  if (EvalConjuncts(conjunct_evals, num_conjuncts, output_row)) {
    VLOG_ROW << "match row:" << PrintRow(output_row, *row_desc());
    output_batch->CommitLastRow();
    ++num_rows_returned_;
    if (ReachedLimit()) eos_ = true;
  }
  return Status::OK();
}

Status NestedLoopJoinNode::ProcessUnmatchedBuildRows(
    RuntimeState* state, RowBatch* output_batch) {
  if (!process_unmatched_build_rows_) {
    // Reset the build row iterator to start processing the unmatched build rows.
    build_row_iterator_ = build_batches_->Iterator();
    current_build_row_idx_ = 0;
    process_unmatched_build_rows_ = true;
  }
  ScalarExprEvaluator* const* conjunct_evals = conjunct_evals_.data();
  size_t num_conjuncts = conjuncts_.size();
  DCHECK_EQ(num_conjuncts, conjunct_evals_.size());
  DCHECK(matching_build_rows_ != NULL);

  const int N = BitUtil::RoundUpToPowerOfTwo(state->batch_size());
  while (!build_row_iterator_.AtEnd()) {
    // This loop can go on for a long time if the conjuncts are very selective. Do query
    // maintenance every N iterations.
    if ((current_build_row_idx_ & (N - 1)) == 0) {
      if (ReachedLimit()) {
        eos_ = true;
        return Status::OK();
      }
      RETURN_IF_CANCELLED(state);
      RETURN_IF_ERROR(QueryMaintenance(state));
    }

    if (matching_build_rows_->Get(current_build_row_idx_)) {
      build_row_iterator_.Next();
      ++current_build_row_idx_;
      continue;
    }
    // Current build row is unmatched.
    TupleRow* output_row = output_batch->GetRow(output_batch->AddRow());
    if (join_op_ == TJoinOp::FULL_OUTER_JOIN || join_op_ == TJoinOp::RIGHT_OUTER_JOIN) {
      CreateOutputRow(output_row, NULL, build_row_iterator_.GetRow());
    } else {
      DCHECK(join_op_ == TJoinOp::RIGHT_ANTI_JOIN) << "Unsupported join operator: " <<
          join_op_;
      output_batch->CopyRow(build_row_iterator_.GetRow(), output_row);
    }
    build_row_iterator_.Next();
    ++current_build_row_idx_;
    // Evaluate conjuncts that don't affect the matching rows of the join on the
    // result row.
    if (EvalConjuncts(conjunct_evals, num_conjuncts, output_row)) {
      VLOG_ROW << "match row: " << PrintRow(output_row, *row_desc());
      output_batch->CommitLastRow();
      ++num_rows_returned_;
      if (output_batch->AtCapacity()) return Status::OK();
    }
  }
  eos_ = true;
  return Status::OK();
}

Status NestedLoopJoinNode::FindBuildMatches(
    RuntimeState* state, RowBatch* output_batch, bool* return_output_batch) {
  *return_output_batch = false;
  ScalarExprEvaluator* const* join_conjunct_evals = join_conjunct_evals_.data();
  size_t num_join_conjuncts = join_conjuncts_.size();
  DCHECK_EQ(num_join_conjuncts, join_conjunct_evals_.size());
  ScalarExprEvaluator* const* conjunct_evals = conjunct_evals_.data();
  size_t num_conjuncts = conjuncts_.size();
  DCHECK_EQ(num_conjuncts, conjunct_evals_.size());

  const int N = BitUtil::RoundUpToPowerOfTwo(state->batch_size());
  while (!build_row_iterator_.AtEnd()) {
    DCHECK(current_probe_row_ != NULL);
    TupleRow* output_row = output_batch->GetRow(output_batch->AddRow());
    CreateOutputRow(output_row, current_probe_row_, build_row_iterator_.GetRow());
    build_row_iterator_.Next();
    ++current_build_row_idx_;

    // This loop can go on for a long time if the conjuncts are very selective. Do
    // expensive query maintenance after every N iterations.
    if ((current_build_row_idx_ & (N - 1)) == 0) {
      if (ReachedLimit()) {
        eos_ = true;
        *return_output_batch = true;
        return Status::OK();
      }
      RETURN_IF_CANCELLED(state);
      RETURN_IF_ERROR(QueryMaintenance(state));
    }
    if (!EvalConjuncts(join_conjunct_evals, num_join_conjuncts, output_row)) {
      continue;
    }
    matched_probe_ = true;
    if (matching_build_rows_ != NULL) {
      matching_build_rows_->Set(current_build_row_idx_ - 1, true);
    }
    if (!EvalConjuncts(conjunct_evals, num_conjuncts, output_row)) continue;
    VLOG_ROW << "match row: " << PrintRow(output_row, *row_desc());
    output_batch->CommitLastRow();
    ++num_rows_returned_;
    if (output_batch->AtCapacity()) {
      *return_output_batch = true;
      return Status::OK();
    }
  }
  return Status::OK();
}

Status NestedLoopJoinNode::NextProbeRow(RuntimeState* state, RowBatch* output_batch) {
  current_probe_row_ = NULL;
  matched_probe_ = false;
  while (probe_batch_pos_ == probe_batch_->num_rows()) {
    probe_batch_->TransferResourceOwnership(output_batch);
    probe_batch_pos_ = 0;
    // If output_batch_ is at capacity after acquiring probe_batch_'s resources, we
    // need to pass it up through the execution before getting a new probe batch.
    // Otherwise, subsequent GetNext() calls to the probe input may cause the
    // memory referenced by this batch to be deleted (see IMPALA-2191).
    if (output_batch->AtCapacity()) return Status::OK();
    if (probe_side_eos_) {
      eos_ = !NeedToProcessUnmatchedBuildRows();
      return Status::OK();
    } else {
      RETURN_IF_ERROR(child(0)->GetNext(state, probe_batch_.get(), &probe_side_eos_));
    }
  }
  current_probe_row_ = probe_batch_->GetRow(probe_batch_pos_++);
  // We have a valid probe row; reset the build row iterator.
  build_row_iterator_ = build_batches_->Iterator();
  current_build_row_idx_ = 0;
  VLOG_ROW << "left row: " << GetLeftChildRowString(current_probe_row_);
  return Status::OK();
}

redpajama_set_name: RedPajamaGithub