Skip to content

Conversation

@inv-jishnu
Copy link
Contributor

Description

This PR introduces consistent handling of NULL values for TEXT fields when exporting and importing CSV files.
When exporting data to CSV, TEXT columns with null values are now written as \N.
During CSV import, any \N value is interpreted as a real null.

This ensures reliable round-trip data integrity for TEXT fields, addressing issues where "null" string values and actual null values were previously indistinguishable in CSV exports.

This change was introduced based on discussion from https://scalar-labs.slack.com/archives/C043ATSHAQL/p1763548538773339?thread_ts=1763536825.886369&cid=C043ATSHAQL.

Related issues and/or PRs

NA

Changes made

  • CSV Export
    If a TEXT field value is null, the exported CSV now adds \N instead of null.

  • CSV Import
    When reading CSV files, the value \N for text field it is interpreted as a real null.

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

NA

Release notes

Add Explicit \N NULL Marker for CSV Export/Import of TEXT Fields

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @inv-jishnu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a standardized mechanism for handling null values in TEXT fields during CSV export and import operations. By implementing "\N" as an explicit marker for nulls in TEXT columns, the changes eliminate data integrity issues where actual nulls could be confused with the string literal "null", thereby ensuring accurate round-trip data processing.

Highlights

  • CSV Export Enhancement: TEXT columns with null values are now explicitly written as "\N" in CSV exports, ensuring a clear distinction from the string literal "null".
  • CSV Import Interpretation: During CSV import, the "\N" string found in TEXT fields is now correctly interpreted as a real null value, completing the round-trip consistency.
  • Improved Data Integrity: This change ensures reliable round-trip data integrity for TEXT fields, resolving previous ambiguity where actual null values and the string "null" were indistinguishable.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a consistent way to handle NULL values for TEXT fields during CSV export and import, which is a great improvement for data integrity.

My main feedback is regarding the choice of the NULL marker. The implementation uses the literal string "/N", whereas the pull request description and common conventions (like MySQL's) use \N. Using \N is the standard way to represent NULL in many bulk data formats.

I've left specific comments with suggestions to change "/N" to "\\N" in the code and update the corresponding tests. I've also suggested a small refactoring to improve code readability in ColumnUtils.java.

Addressing these points will make the feature more robust and aligned with industry standards.

@inv-jishnu inv-jishnu marked this pull request as draft November 20, 2025 12:25
@inv-jishnu inv-jishnu marked this pull request as ready for review November 20, 2025 12:35
@ypeckstadt ypeckstadt requested review from a team, Torch3333, brfrn169, feeblefakie, komamitsu and ypeckstadt and removed request for a team November 21, 2025 01:19
Copy link
Contributor

@ypeckstadt ypeckstadt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you.

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Copy link
Contributor

@thongdk8 thongdk8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!

Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you

@brfrn169 brfrn169 merged commit c34c508 into master Nov 21, 2025
139 of 140 checks passed
@brfrn169 brfrn169 deleted the feat/data-loader/csv-null-export-import branch November 21, 2025 06:43
feeblefakie pushed a commit that referenced this pull request Nov 21, 2025
Co-authored-by: Peckstadt Yves <peckstadt.yves@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants