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

Add parquet support to write_to_file_stage.py #1937

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import mrc
import mrc.core.operators as ops
import pyarrow.parquet as pq

from morpheus.common import FileTypes
from morpheus.common import determine_file_type
Expand Down Expand Up @@ -124,9 +125,12 @@ def node_fn(self, obs: mrc.Observable, sub: mrc.Subscriber):

def write_to_file(x: MessageMeta):

lines = self._convert_to_strings(x.df)

out_file.writelines(lines)
if self._file_type == FileTypes.PARQUET:
table = x.df.to_arrow()
pq.write_table(table, out_file)
else:
lines = self._convert_to_strings(x.df)
out_file.writelines(lines)

if self._flush:
out_file.flush()
Expand Down
Loading