| 51 | static constexpr double MinEstimateBatchSizeFactor = 0.15; |
| 52 | |
| 53 | TableScan::TableScan( |
| 54 | int32_t operatorId, |
| 55 | DriverCtx* driverCtx, |
| 56 | std::shared_ptr<const core::TableScanNode> tableScanNode) |
| 57 | : SourceOperator( |
| 58 | driverCtx, |
| 59 | tableScanNode->outputType(), |
| 60 | operatorId, |
| 61 | tableScanNode->id(), |
| 62 | "TableScan"), |
| 63 | tableHandle_(tableScanNode->tableHandle()), |
| 64 | columnHandles_(tableScanNode->assignments()), |
| 65 | driverCtx_(driverCtx), |
| 66 | connectorPool_(driverCtx_->task->addConnectorPoolLocked( |
| 67 | planNodeId(), |
| 68 | driverCtx_->pipelineId, |
| 69 | driverCtx_->driverId, |
| 70 | operatorType(), |
| 71 | tableHandle_->connectorId())), |
| 72 | maxSplitPreloadPerDriver_( |
| 73 | driverCtx_->queryConfig().maxSplitPreloadPerDriver()), |
| 74 | readBatchSize_(driverCtx_->queryConfig().preferredOutputBatchRows()), |
| 75 | maxReadBatchSize_(getMaxReadBatchSize(4096, 1024, 8)), |
| 76 | minReadBatchSize_(driverCtx_->queryConfig().minOutputBatchRows()), |
| 77 | getOutputTimeLimitMs_( |
| 78 | driverCtx_->queryConfig().tableScanGetOutputTimeLimitMs()), |
| 79 | enableEstimateBytesPerRow_( |
| 80 | driverCtx_->queryConfig().iskEstimateRowSizeBasedOnSampleEnabled()), |
| 81 | asyncThreadCtx_(std::make_shared<connector::AsyncThreadCtx>( |
| 82 | driverCtx_->queryConfig().preloadBytesLimit(), |
| 83 | driverCtx_->queryConfig().adaptivePreloadEnabled())) { |
| 84 | for (const auto& type : asRowType(outputType_)->children()) { |
| 85 | if (!type->isFixedWidth()) { |
| 86 | isFixedWidthOutputType_ = false; |
| 87 | break; |
| 88 | } |
| 89 | } |
| 90 | if (isFixedWidthOutputType_) { |
| 91 | enableEstimateBytesPerRow_ = false; |
| 92 | } |
| 93 | connector_ = connector::getConnector(tableHandle_->connectorId()); |
| 94 | this->setRuntimeMetric(kCanUsedToEstimateHashBuildPartitionNum, "true"); |
| 95 | this->setRuntimeMetric( |
| 96 | OperatorMetricKey::kHasBeenProcessedRowCount, folly::to<std::string>(0)); |
| 97 | |
| 98 | VLOG(1) << "TableScan RowCount=" << tableScanNode->getRowCount(); |
| 99 | this->setRuntimeMetric( |
| 100 | OperatorMetricKey::kTotalRowCount, |
| 101 | std::to_string(tableScanNode->getRowCount())); |
| 102 | } |
| 103 | |
| 104 | folly::dynamic TableScan::toJson() const { |
| 105 | auto ret = SourceOperator::toJson(); |
nothing calls this directly
no test coverage detected