Revert "printtup优化"

This reverts commit 69348ac2c2.
This commit is contained in:
zhengshaoyu 2023-01-08 10:35:16 +08:00
parent e7e3ccb0e1
commit e025e2b018
3 changed files with 11 additions and 15 deletions

View File

@ -4582,7 +4582,7 @@ static char* get_str_from_var(NumericVar* var)
* CAUTION: var's contents may be modified by rounding!
* Returns a palloc'd string.
*/
char output_buffer_str_from_var[64] = {0};
static char output_buffer_str_from_var[64] = {0};
static char* output_get_str_from_var(NumericVar* var)
{
int dscale;
@ -4613,11 +4613,7 @@ static char* output_get_str_from_var(NumericVar* var)
i = 1;
len = i + dscale + DEC_DIGITS + 2;
if (len > 64) {
str = (char*)palloc(len);
} else {
str = (char*)output_buffer_str_from_var;
}
str = (char*)palloc(len);
cp = str;
/*

View File

@ -230,7 +230,7 @@ char* text_to_cstring(const text* t)
return result;
}
char output_buffer[256] {0};
static char output_buffer[256] {0};
char* output_text_to_cstring(const text* t)
{
if (unlikely(t == NULL)) {
@ -244,11 +244,7 @@ char* output_text_to_cstring(const text* t)
int len = VARSIZE_ANY_EXHDR(tunpacked);
char* result = NULL;
if (len + 1 > 256) {
result = (char*)palloc(len + 1);
} else {
result = output_buffer;
}
result = (char*)palloc(len + 1);
memcpy(result, VARDATA_ANY(tunpacked), len);
result[len] = '\0';
@ -258,11 +254,12 @@ char* output_text_to_cstring(const text* t)
return result;
}
char output_int32_buffer[32] = {0};
static char output_int32_buffer[32] = {0};
char* output_int32_to_cstring(int32 value)
{
pg_ltoa(value, output_int32_buffer);
return output_int32_buffer;
char* result = (char*)palloc(12); /*sign, 10 digits, '\0' */
pg_ltoa(value, result);
return result;
}
/*

View File

@ -1022,6 +1022,7 @@ void printtup(TupleTableSlot *slot, DestReceiver *self)
/* just as we define in backend/commands/analyze.cpp */
#define WIDTH_THRESHOLD 1024
StreamTimeSerilizeStart(t_thrd.pgxc_cxt.GlobalNetInstr);
/* Set or update my derived attribute info, if needed */
if (myState->attrinfo != typeinfo || myState->nattrs != natts)
printtup_prepare_info(myState, typeinfo, natts);
@ -1051,6 +1052,7 @@ void printtup(TupleTableSlot *slot, DestReceiver *self)
appendBinaryStringInfo(buf, slot->tts_dataRow, slot->tts_dataLen);
AddCheckInfo(buf);
pq_endmessage_reuse(buf);
StreamTimeSerilizeEnd(t_thrd.pgxc_cxt.GlobalNetInstr);
return;
}
#endif
@ -1162,6 +1164,7 @@ void printtup(TupleTableSlot *slot, DestReceiver *self)
}
(void)MemoryContextSwitchTo(old_context);
StreamTimeSerilizeEnd(t_thrd.pgxc_cxt.GlobalNetInstr);
AddCheckInfo(buf);
pq_endmessage_reuse(buf);