| /********************************************************************** |
| // @@@ START COPYRIGHT @@@ |
| // |
| // Licensed to the Apache Software Foundation (ASF) under one |
| // or more contributor license agreements. See the NOTICE file |
| // distributed with this work for additional information |
| // regarding copyright ownership. The ASF licenses this file |
| // to you under the Apache License, Version 2.0 (the |
| // "License"); you may not use this file except in compliance |
| // with the License. You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, |
| // software distributed under the License is distributed on an |
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| // KIND, either express or implied. See the License for the |
| // specific language governing permissions and limitations |
| // under the License. |
| // |
| // @@@ END COPYRIGHT @@@ |
| **********************************************************************/ |
| /* -*-C++-*- |
| **************************************************************************** |
| * |
| * File: ComTdbPackRows.cpp |
| * Description: |
| * |
| * Created: 5/6/98 |
| * Language: C++ |
| * |
| * |
| * |
| * |
| **************************************************************************** |
| */ |
| |
| #include "ComTdbPackRows.h" |
| #include "ComTdbCommon.h" |
| |
| ////////////////////////////////////////////////////////////////////////////// |
| // |
| // TDB procedures |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| |
| // Default Constructor. |
| ComTdbPackRows::ComTdbPackRows() : |
| ComTdb(ComTdb::ex_PACKROWS,eye_PACKROWS), |
| packTuppIndex_(0) |
| { |
| } |
| |
| // Copy Constructor. |
| ComTdbPackRows::ComTdbPackRows(const ComTdbPackRows* packTdb) |
| : ComTdb(ComTdb::ex_PACKROWS,eye_PACKROWS), |
| childTdb_(packTdb->childTdb_), |
| packExpr_(packTdb->packExpr_), |
| predExpr_(packTdb->predExpr_), |
| packTuppLen_(packTdb->packTuppLen_), |
| givenCriDesc_(packTdb->givenCriDesc_), |
| returnedCriDesc_(packTdb->returnedCriDesc_), |
| fromParent_(packTdb->fromParent_), |
| toParent_(packTdb->toParent_), |
| packTuppIndex_(packTdb->packTuppIndex_), |
| bufferSize_(10000), |
| noOfBuffers_(5) |
| { |
| } |
| |
| // Constructor. |
| // |
| // Parameters |
| // |
| // ComTdb* childTdb |
| // IN: The child of this Pack TDB. |
| // |
| // ex_expr* packExpr |
| // IN: The expression to copy a row into a packed row. |
| // |
| // ex_expr* predExpr |
| // IN: The expression to apply a selection predicates on the packed row. |
| // |
| // const unsigned short packTuppIndex |
| // IN: The index of the tuple generated by the operator in the ATP. |
| // |
| // long packTuppLen |
| // IN: Length of the tuple generated by the operator. |
| // |
| // ex_cri_desc* givenCriDesc |
| // IN: the Cri Descriptor given to this node by its parent. |
| // |
| // ex_cri_desc* returnedCriDesc |
| // IN: the Cri Descriptor return to the parent node. |
| // |
| // queue_index fromParent |
| // IN: Recommended queue size for the down queue used to communicate |
| // with the parent. |
| // |
| // queue_index toParent |
| // IN: Recommended queue size for the up queue used to communicate |
| // with the parent. |
| // |
| ComTdbPackRows::ComTdbPackRows(ComTdb* childTdb, |
| ex_expr* packExpr, |
| ex_expr* predExpr, |
| const unsigned short packTuppIndex, |
| Lng32 packTuppLen, |
| ex_cri_desc* givenCriDesc, |
| ex_cri_desc* returnedCriDesc, |
| queue_index fromParent, |
| queue_index toParent) : |
| ComTdb(ComTdb::ex_PACKROWS,eye_PACKROWS), |
| childTdb_(childTdb), |
| packExpr_(packExpr), |
| predExpr_(predExpr), |
| packTuppIndex_(packTuppIndex), |
| packTuppLen_(packTuppLen), |
| givenCriDesc_(givenCriDesc), |
| returnedCriDesc_(returnedCriDesc), |
| fromParent_(fromParent), |
| toParent_(toParent), |
| bufferSize_(10024), |
| noOfBuffers_(5) |
| { |
| } |
| |
| void ComTdbPackRows::display() const |
| { |
| // Do nothing for now. |
| } |
| |
| // Pack the Pack node (double pack?) for transmission between processes. |
| Long ComTdbPackRows::pack(void * space) |
| { |
| // Pack the child TDB. |
| childTdb_.pack(space); |
| |
| // Pack all the pointers that can be reached from data members of TDB. |
| givenCriDesc_.pack(space); |
| returnedCriDesc_.pack(space); |
| packExpr_.pack(space); |
| predExpr_.pack(space); |
| |
| // Return the packed pointer to 'this', so that my parent can store the |
| // packed version of my address. |
| return ComTdb::pack(space); |
| } |
| |
| // Unpack the pack TDB after transmission between processes. |
| Lng32 ComTdbPackRows::unpack(void * base, void * reallocator) |
| { |
| if(childTdb_.unpack(base, reallocator)) return -1; |
| if(givenCriDesc_.unpack(base, reallocator)) return -1; |
| if(returnedCriDesc_.unpack(base, reallocator)) return -1; |
| if(packExpr_.unpack(base, reallocator)) return -1; |
| if(predExpr_.unpack(base, reallocator)) return -1; |
| return ComTdb::unpack(base, reallocator); |
| } |
| |
| // We are observing order queue protocol. |
| Int32 ComTdbPackRows::orderedQueueProtocol() const { return -1; } |