You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by dj...@apache.org on 2025/12/18 08:21:23 UTC

(cloudberry-pxf) 18/37: Applying master changes for pxfheaders.c and test.yml to the branch to avoid conflict

This is an automated email from the ASF dual-hosted git repository.

djwang pushed a commit to branch merge-with-upstream
in repository https://gitbox.apache.org/repos/asf/cloudberry-pxf.git

commit 22810f6d1549a11606ff62da105cd8b2aa0677b4
Author: Himanshu Pandey <pa...@vmware.com>
AuthorDate: Thu Oct 20 15:19:00 2022 -0700

    Applying master changes for pxfheaders.c and test.yml to the branch to avoid conflict
---
 external-table/src/pxfheaders.c | 223 +++++++++++++++++++---------------------
 1 file changed, 104 insertions(+), 119 deletions(-)

diff --git a/external-table/src/pxfheaders.c b/external-table/src/pxfheaders.c
index 2845ca45..251add4e 100644
--- a/external-table/src/pxfheaders.c
+++ b/external-table/src/pxfheaders.c
@@ -116,15 +116,15 @@ build_http_headers(PxfInputData *input)
 
 		churl_headers_append(headers, "X-GP-FORMAT", format);
 
-		/* Parse fmtOptString here */
-		if (fmttype_is_text(exttbl->fmtcode) || fmttype_is_csv(exttbl->fmtcode))
-		{
+    /* Parse fmtOptString here */
+    if (fmttype_is_text(exttbl->fmtcode) || fmttype_is_csv(exttbl->fmtcode))
+    {
 #if PG_VERSION_NUM >= 120000
-			copyFmtOpts = exttbl->options;
+      copyFmtOpts = exttbl->options;
 #else
-			copyFmtOpts = parseCopyFormatString(rel, exttbl->fmtopts, exttbl->fmtcode);
+      copyFmtOpts = parseCopyFormatString(rel, exttbl->fmtopts, exttbl->fmtcode);
 #endif
-		}
+    }
 
 		/* pass external table's encoding to copy's options */
 		copyFmtOpts = appendCopyEncodingOptionToList(copyFmtOpts, exttbl->encoding);
@@ -508,14 +508,13 @@ int getNumSimpleVars(ProjectionInfo *projInfo)
 #if PG_VERSION_NUM < 120000
 static void
 add_projection_desc_httpheader_pg94(CHURL_HEADERS headers,
-							   ProjectionInfo *projInfo,
-							   List *qualsAttributes,
-							   Relation rel)
+                 ProjectionInfo *projInfo,
+                 List *qualsAttributes,
+                 Relation rel)
 {
 	int			   i;
 	int			   dropped_count;
 	int			   number;
-	int			   numTargetList;
 #if PG_VERSION_NUM < 90400
 	int			   numSimpleVars;
 #endif
@@ -528,7 +527,8 @@ add_projection_desc_httpheader_pg94(CHURL_HEADERS headers,
 
 	// STEP 0: initialize variables
 	initStringInfo(&formatter);
-	numTargetList = 0;
+	attrs_used = NULL;
+	number = 0;
 
 #if PG_VERSION_NUM >= 90400
 	/*
@@ -576,21 +576,6 @@ add_projection_desc_httpheader_pg94(CHURL_HEADERS headers,
 	}
 #endif
 
-	number = numTargetList +
-#if PG_VERSION_NUM >= 90400
-		projInfo->pi_numSimpleVars +
-#else
-		numSimpleVars +
-#endif
-		list_length(qualsAttributes);
-	if (number == 0)
-		return;
-
-	attrs_used = NULL;
-
-	/* Convert the number of projection columns to a string */
-	pg_ltoa(number, long_number);
-	churl_headers_append(headers, "X-GP-ATTRS-PROJ", long_number);
 
 #if PG_VERSION_NUM >= 90400
 	for (i = 0; i < projInfo->pi_numSimpleVars; i++)
@@ -668,35 +653,35 @@ add_projection_desc_httpheader_pg94(CHURL_HEADERS headers,
 #if PG_VERSION_NUM >= 120000
 static void
 add_projection_desc_httpheader_pg12(CHURL_HEADERS headers,
-							   ProjectionInfo *projInfo,
-							   List *qualsAttributes,
-							   Relation rel)
+                 ProjectionInfo *projInfo,
+                 List *qualsAttributes,
+                 Relation rel)
 {
-	int			   i;
-	int			   dropped_count;
-	int			   number;
-	int			   numTargetList;
-	char			long_number[sizeof(int32) * 8];
+  int        i;
+  int        dropped_count;
+  int        number;
+  int        numTargetList;
+  char      long_number[sizeof(int32) * 8];
     // In versions < 120000, projInfo->pi_varNumbers contains atttribute numbers of SimpleVars
     // Since,this pi_varNumbers doesn't exist in PG12 and above, we can add the attribute numbers by
     // iterating on the Simple vars.
-	int				varNumbers[sizeof(int32) * 8];
-	Bitmapset		*attrs_used;
-	StringInfoData	formatter;
-	TupleDesc		tupdesc;
-	initStringInfo(&formatter);
-	numTargetList = 0;
-
-	 List *targetList = (List *) projInfo->pi_state.expr;
+  int       varNumbers[sizeof(int32) * 8];
+  Bitmapset   *attrs_used;
+  StringInfoData  formatter;
+  TupleDesc   tupdesc;
+  initStringInfo(&formatter);
+  numTargetList = 0;
+
+   List *targetList = (List *) projInfo->pi_state.expr;
      int  numSimpleVars = 0;
 
-	int numNonSimpleVars = 0;
+  int numNonSimpleVars = 0;
 
     // TODO Re-evaluate this logic and may be we don't need numNonSimpleVars
-	 for (int i = 0; i < projInfo->pi_state.steps_len; i++)
+   for (int i = 0; i < projInfo->pi_state.steps_len; i++)
      {
          ExprEvalStep *step = &projInfo->pi_state.steps[i];
-         ExprEvalOp	opcode = ExecEvalStepOp(&projInfo->pi_state, step);
+         ExprEvalOp opcode = ExecEvalStepOp(&projInfo->pi_state, step);
              if ( opcode == EEOP_ASSIGN_INNER_VAR ||
                      opcode == EEOP_ASSIGN_OUTER_VAR ||
                      opcode == EEOP_ASSIGN_SCAN_VAR)
@@ -706,94 +691,94 @@ add_projection_desc_httpheader_pg12(CHURL_HEADERS headers,
                      numNonSimpleVars++;
      }
 
-	/*
-	 * Non-simpleVars are added to the targetlist
-	 * we use expression_tree_walker to access attrno information
-	 * we do it through a helper function add_attnums_from_targetList
-	 */
-	if (targetList)
-	{
+  /*
+   * Non-simpleVars are added to the targetlist
+   * we use expression_tree_walker to access attrno information
+   * we do it through a helper function add_attnums_from_targetList
+   */
+  if (targetList)
+  {
 
-		List     *l = lappend_int(NIL, 0);
-		ListCell *lc1;
+    List     *l = lappend_int(NIL, 0);
+    ListCell *lc1;
 
-		foreach(lc1, targetList)
-		{
-			ExprState *gstate = (ExprState *) lfirst(lc1);
+    foreach(lc1, targetList)
+    {
+      ExprState *gstate = (ExprState *) lfirst(lc1);
             add_attnums_from_targetList( (Node *) gstate, l);
-		}
+    }
 
         int i=0;
-		foreach(lc1, l)
-		{
-			int attno = lfirst_int(lc1);
-			if (attno > InvalidAttrNumber)
-			{
-				add_projection_index_header(headers,
-											formatter, attno - 1, long_number);
-				numTargetList++;
+    foreach(lc1, l)
+    {
+      int attno = lfirst_int(lc1);
+      if (attno > InvalidAttrNumber)
+      {
+        add_projection_index_header(headers,
+                      formatter, attno - 1, long_number);
+        numTargetList++;
                 varNumbers[i] = attno;
                 i++;
-			}
-		}
+      }
+    }
 
-		list_free(l);
-	}
+    list_free(l);
+  }
 
-	number = numTargetList + numSimpleVars + list_length(qualsAttributes);
-	if (number == 0)
-		return;
+  number = numTargetList + numSimpleVars + list_length(qualsAttributes);
+  if (number == 0)
+    return;
 
-	attrs_used = NULL;
+  attrs_used = NULL;
 
-	/* Convert the number of projection columns to a string */
-	pg_ltoa(number, long_number);
-	churl_headers_append(headers, "X-GP-ATTRS-PROJ", long_number);
+  /* Convert the number of projection columns to a string */
+  pg_ltoa(number, long_number);
+  churl_headers_append(headers, "X-GP-ATTRS-PROJ", long_number);
 
     for (i = 0;varNumbers && i < numSimpleVars ; i++)
-	{
-		attrs_used =
-			bms_add_member(attrs_used,
+  {
+    attrs_used =
+      bms_add_member(attrs_used,
                            varNumbers[i] - FirstLowInvalidHeapAttributeNumber);
-	}
-
-	ListCell *attribute = NULL;
-
-	/*
-	 * AttrNumbers coming from quals
-	 */
-	foreach(attribute, qualsAttributes)
-	{
-		AttrNumber attrNumber = (AttrNumber) lfirst_int(attribute);
-		attrs_used =
-			bms_add_member(attrs_used,
-						 attrNumber + 1 - FirstLowInvalidHeapAttributeNumber);
-	}
-
-	tupdesc = RelationGetDescr(rel);
-	dropped_count = 0;
-
-	for (i = 1; i <= tupdesc->natts; i++)
-	{
-		/* Ignore dropped attributes. */
-		if (tupdesc->attrs[i - 1].attisdropped)
-		{
-			/* keep a counter of the number of dropped attributes */
-			dropped_count++;
-			continue;
-		}
-
-		if (bms_is_member(i - FirstLowInvalidHeapAttributeNumber, attrs_used))
-		{
-			/* Shift the column index by the running dropped_count */
-			add_projection_index_header(headers, formatter,
-										i - 1 - dropped_count, long_number);
-		}
-	}
-
-	list_free(qualsAttributes);
-	pfree(formatter.data);
-	bms_free(attrs_used);
+  }
+
+  ListCell *attribute = NULL;
+
+  /*
+   * AttrNumbers coming from quals
+   */
+  foreach(attribute, qualsAttributes)
+  {
+    AttrNumber attrNumber = (AttrNumber) lfirst_int(attribute);
+    attrs_used =
+      bms_add_member(attrs_used,
+             attrNumber + 1 - FirstLowInvalidHeapAttributeNumber);
+  }
+
+  tupdesc = RelationGetDescr(rel);
+  dropped_count = 0;
+
+  for (i = 1; i <= tupdesc->natts; i++)
+  {
+    /* Ignore dropped attributes. */
+    if (tupdesc->attrs[i - 1].attisdropped)
+    {
+      /* keep a counter of the number of dropped attributes */
+      dropped_count++;
+      continue;
+    }
+
+    if (bms_is_member(i - FirstLowInvalidHeapAttributeNumber, attrs_used))
+    {
+      /* Shift the column index by the running dropped_count */
+      add_projection_index_header(headers, formatter,
+                    i - 1 - dropped_count, long_number);
+    }
+  }
+
+  list_free(qualsAttributes);
+  pfree(formatter.data);
+  bms_free(attrs_used);
 }
 #endif
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org