| 1269 | } |
| 1270 | |
| 1271 | static void executor_start(QueryDesc* query_desc, int32_t eflags) |
| 1272 | { |
| 1273 | pg::init_deeplake(); |
| 1274 | if (prev_executor_start != nullptr) { |
| 1275 | prev_executor_start(query_desc, eflags); |
| 1276 | } else { |
| 1277 | standard_ExecutorStart(query_desc, eflags); |
| 1278 | } |
| 1279 | |
| 1280 | if (!pg::query_info::is_in_top_context() || pg::utils::spi_connector::is_execution_in_progress()) { |
| 1281 | return; |
| 1282 | } |
| 1283 | |
| 1284 | pg::query_info::push_context(query_desc); |
| 1285 | pg::query_info::current().set_command_type(static_cast<enum pg::command_type>(query_desc->operation)); |
| 1286 | |
| 1287 | if (!pg::query_info::current().is_deeplake_table_referenced()) { |
| 1288 | pg::analyze_plan(query_desc->plannedstmt); |
| 1289 | } |
| 1290 | if (query_desc->operation == CMD_SELECT && !pg::query_info::current().is_deeplake_table_referenced()) { |
| 1291 | return; |
| 1292 | } |
| 1293 | |
| 1294 | Plan* plan = query_desc->plannedstmt->planTree; |
| 1295 | if (plan != nullptr && IsA(plan, Limit)) { |
| 1296 | Limit* limitNode = (Limit*)plan; |
| 1297 | if (limitNode->limitCount != nullptr) { |
| 1298 | const auto limit = DatumGetInt32(((Const*)limitNode->limitCount)->constvalue); |
| 1299 | pg::query_info::current().set_limit(limit); |
| 1300 | } |
| 1301 | plan = plan->lefttree; |
| 1302 | } |
| 1303 | |
| 1304 | if (plan != nullptr) { |
| 1305 | List* targetList = plan->targetlist; |
| 1306 | ListCell* lc = nullptr; |
| 1307 | foreach (lc, targetList) { |
| 1308 | TargetEntry* tle = (TargetEntry*)lfirst(lc); |
| 1309 | if (::is_count_star(tle)) { |
| 1310 | pg::query_info::current().set_count_star(true); |
| 1311 | break; |
| 1312 | } |
| 1313 | } |
| 1314 | } |
| 1315 | } |
| 1316 | |
| 1317 | struct ReceiverState |
| 1318 | { |
nothing calls this directly
no test coverage detected