Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix harelba/q#62 #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions bin/q
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ class TableColumnInferer(object):
if self.expected_column_count is not None:
self.column_count = self.expected_column_count
else:
# If no rows and has header_row, take the header_row
if not len(column_count_list) and len(self.header_row):
self.column_count = len(self.header_row)
return
# If not specified, we'll take the largest row in the sample rows
self.column_count = max(column_count_list)

Expand Down Expand Up @@ -737,7 +741,7 @@ class TableCreator(object):
self._insert_row(col_vals)
if stop_after_analysis and self.column_inferer.inferred:
return
if mfs.lines_read == 0 or (mfs.lines_read == 1 and self.skip_header):
if mfs.lines_read == 0:
raise EmptyDataException()
except StrictModeColumnCountMismatchException,e:
raise ColumnCountMismatchException(
Expand Down Expand Up @@ -1357,7 +1361,7 @@ class QOutputPrinter(object):
if formatting_dict is not None and str(i + 1) in formatting_dict.keys():
fmt_str = formatting_dict[str(i + 1)]
else:
if self.output_params.beautify:
if self.output_params.beautify and i in max_lengths:
fmt_str = "%%-%ss" % max_lengths[i]
else:
fmt_str = "%s"
Expand Down