Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/snowflake/snowpark/_internal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
XML_ROW_TAG_STRING = "ROWTAG"
XML_ROW_DATA_COLUMN_NAME = "ROW_DATA"
XML_READER_FILE_PATH = os.path.join(os.path.dirname(__file__), "xml_reader.py")
XML_READER_SQL_COMMENT = "/* Python:snowflake.snowpark.DataFrameReader.xml[rowTag] */"

QUERY_TAG_STRING = "QUERY_TAG"
SKIP_LEVELS_TWO = (
Expand Down
6 changes: 5 additions & 1 deletion src/snowflake/snowpark/dataframe_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
XML_ROW_TAG_STRING,
XML_ROW_DATA_COLUMN_NAME,
XML_READER_FILE_PATH,
XML_READER_SQL_COMMENT,
INFER_SCHEMA_FORMAT_TYPES,
SNOWFLAKE_PATH_PREFIXES,
TempObjectType,
Expand Down Expand Up @@ -1159,7 +1160,10 @@ def _read_semi_structured_file(self, path: str, format: str) -> DataFrame:
_emit_ast=False,
)
df._reader = self
set_api_call_source(df, f"DataFrameReader.{format.lower()}")
if xml_reader_udtf:
set_api_call_source(df, XML_READER_SQL_COMMENT)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should be DataFrameReader.xml[rowTag] instead of the entire comment.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

good catch, fixed

else:
set_api_call_source(df, f"DataFrameReader.{format.lower()}")
return df

@private_preview(version="1.29.0")
Expand Down
Loading