Github user chiyang10000 commented on a diff in the pull request: https://github.com/apache/incubator-hawq/pull/1321#discussion_r157335240 --- Diff: src/backend/executor/nodeExternalscan.c --- @@ -80,8 +83,61 @@ ExternalNext(ExternalScanState *node) /* * get the next tuple from the file access methods */ - externalSelectDesc = external_getnext_init(&(node->ss.ps), node); - tuple = external_getnext(scandesc, direction, externalSelectDesc); + if (scandesc->fs_formatter_type == ExternalTableType_Invalid) + { + elog(ERROR, "invalid formatter type for external table: %s", __func__); + } + else if (scandesc->fs_formatter_type != ExternalTableType_PLUG) + { + externalSelectDesc = external_getnext_init(&(node->ss.ps), node); + + returnTuple = external_getnext(scandesc, direction, externalSelectDesc, + &(node->ss), slot); + } + else + { + Assert(scandesc->fs_formatter_name); + + FmgrInfo *getnextInitFunc = scandesc->fs_ps_scan_funcs.getnext_init; + + if (getnextInitFunc) + { + /* + * pg_strncasecmp(scandesc->fs_formatter_name, "orc", strlen("orc")) + * Performance improvement for string comparison. + */ + const char *formatter_name = "orc"; + if (*(int *)(scandesc->fs_formatter_name) != *(int *)formatter_name) --- End diff -- Thanks for your advise. I will update this PR with a simple demo in the near days.
---