data-prep-kit icon indicating copy to clipboard operation
data-prep-kit copied to clipboard

Enhance Code2Parquet module to handle non-code text as well

Open shahrokhDaijavad opened this issue 1 year ago • 7 comments

Search before asking

  • [X] I searched the issues and found no similar issues.

Component

Other

Feature

The current version of Code2Parquet takes zip files made of text files that are all code. We need the ability to handle plain text (non-code) files as input as well.

Are you willing to submit a PR?

  • [ ] Yes I am willing to submit a PR!

shahrokhDaijavad avatar Aug 19 '24 21:08 shahrokhDaijavad

What extensions are you proposing be handled as text? Can we be more specific about requirements?

daw3rd avatar Aug 21 '24 12:08 daw3rd

I do not think it matters. All the files inside zip are handled as text

blublinsky avatar Aug 21 '24 12:08 blublinsky

@daw3rd The requirement to "handle" general text (code and non-code) came from Nirmit last Friday when I was showing him the new root README files. He said in addition to code, pdf and html ingestion, we should have text too. So, when I discussed this with Boris, he convinced me that the best way to do this is to generalize code2parquet to handle arbitrary text and not just code text.

shahrokhDaijavad avatar Aug 21 '24 12:08 shahrokhDaijavad

That does not provide any more detail on the requirements.

  1. Do you want to import .txt files from zips similarly to how we do .pdf contained in zip?
  2. Are there other extensions?
  3. In the case of code2parquet, we know it is code (.py, .java, .c, etc.). how do we know which we're importing? Or maybe we don't put any code-specific columns?

Why not merge all html, text, pdf into the same module. Probably because of the varying requirements, but to not have text2parquet, when we already have pdf2parquet and html2parquet, breaks the pattern. I'm not convinced adapting code2parquet is the right way to go.

daw3rd avatar Aug 21 '24 17:08 daw3rd

Answers and comments to your questions:

  1. Yes
  2. No
  3. I don't think Boris has changed anything that the original code2parquet was doing when the code_data parameter is by default true, so the ext column has the file extension extracted from the file path (.py, .java, ...) I assume with the new code, when code_data is false, the ext column says .txt? (@blublinsky to confirm).

When I discussed this with Boris, he mentioned the alternative option of creating an independent text2parquet, but he convinced himself (and me) that it meant duplicating almost everything that the code2parquet was doing, whereas adding a new flag to that code was much more efficient.

shahrokhDaijavad avatar Aug 21 '24 18:08 shahrokhDaijavad

@shahrokhDaijavad is this still an active thread?

agoyal26 avatar Apr 07 '25 09:04 agoyal26

It is not active, @agoyal26, but the submitted PR was never reviewed and approved, so let's keep this open.

shahrokhDaijavad avatar Apr 07 '25 15:04 shahrokhDaijavad