n3world commented on a change in pull request #10321:
URL: https://github.com/apache/arrow/pull/10321#discussion_r640037240



##########
File path: python/pyarrow/tests/test_csv.py
##########
@@ -52,18 +52,20 @@ def generate_col_names():
             yield first + second
 
 
-def make_random_csv(num_cols=2, num_rows=10, linesep='\r\n'):
+def make_random_csv(num_cols=2, num_rows=10, linesep='\r\n', write_names=True):
     arr = np.random.RandomState(42).randint(0, 1000, size=(num_cols, num_rows))
-    col_names = list(itertools.islice(generate_col_names(), num_cols))
     csv = io.StringIO()
-    csv.write(",".join(col_names))
+    if write_names:
+        col_names = list(itertools.islice(generate_col_names(), num_cols))
+        csv.write(",".join(col_names))
     csv.write(linesep)
     for row in arr.T:
         csv.write(",".join(map(str, row)))
         csv.write(linesep)
     csv = csv.getvalue().encode()
     columns = [pa.array(a, type=pa.int64()) for a in arr]
-    expected = pa.Table.from_arrays(columns, col_names)
+    expected = pa.Table.from_arrays(
+        columns, col_names) if write_names else None

Review comment:
       But then the column names returned by the csv parser may be different 
than the table or is that not an issue?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to