MCPcopy Create free account
hub / github.com/apache/cloudberry / SeparateOutNumSegments

Function SeparateOutNumSegments

src/backend/foreign/foreign.c:87–116  ·  view source on GitHub ↗

Get and separate out the num_segments option */

Source from the content-addressed store, hash-verified

85
86/* Get and separate out the num_segments option */
87int32
88SeparateOutNumSegments(List **options)
89{
90 ListCell *lc = NULL;
91 char *num_segments_str = NULL;
92 int32 num_segments = 0;
93
94 foreach(lc, *options)
95 {
96 DefElem *def = (DefElem *) lfirst(lc);
97
98 if (strcmp(def->defname, "num_segments") == 0)
99 {
100 num_segments_str = defGetString(def);
101 num_segments = pg_atoi(num_segments_str, sizeof(int32), 0);
102
103 if (num_segments <= 0)
104 {
105 ereport(ERROR,
106 (errcode(ERRCODE_SYNTAX_ERROR),
107 errmsg("\"%d\" is not a valid num_segments value",
108 num_segments)));
109 }
110
111 *options = list_delete_cell(*options, lc);
112 break;
113 }
114 }
115 return num_segments;
116}
117
118/*
119 * GetForeignDataWrapper - look up the foreign-data wrapper by OID.

Callers 3

transformGenericOptionsFunction · 0.85
GetForeignServerExtendedFunction · 0.85
GetForeignTableFunction · 0.85

Calls 6

defGetStringFunction · 0.85
pg_atoiFunction · 0.85
list_delete_cellFunction · 0.85
foreachFunction · 0.50
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected