[
https://issues.apache.org/jira/browse/DRILL-7979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17391603#comment-17391603
]
ASF GitHub Bot commented on DRILL-7979:
---------------------------------------
dzamo commented on a change in pull request #2283:
URL: https://github.com/apache/drill/pull/2283#discussion_r680914361
##########
File path:
contrib/format-xml/src/main/java/org/apache/drill/exec/store/xml/XMLReader.java
##########
@@ -72,9 +72,10 @@
private InputStream fsStream;
private XMLEventReader reader;
private ImplicitColumns metadata;
+ private boolean isSelfClosingEvent;
Review comment:
Did you consider adding something like `IGNORED_ELEMENT` or
`SELF_CLOSING_TAG` state to the `xmlState` enum? Would that come out any
simpler than the new boolean `isSelfClosingEvent`?
##########
File path:
contrib/format-xml/src/main/java/org/apache/drill/exec/store/xml/XMLUtils.java
##########
@@ -82,12 +82,27 @@ public static String removeField(String prefix, String
fieldName) {
}
int index = prefix.lastIndexOf(fieldName);
- if (index == 0) {
+ if (index <= 0) {
return "";
} else if (index < 0) {
return prefix;
Review comment:
Line 88 becomes unreachable because of the change on line 85.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
> Self-Closing XML Tags Cause Schema Change Exceptions
> ----------------------------------------------------
>
> Key: DRILL-7979
> URL: https://issues.apache.org/jira/browse/DRILL-7979
> Project: Apache Drill
> Issue Type: Bug
> Components: Storage - Other
> Affects Versions: 1.19.0
> Reporter: Charles Givre
> Assignee: Charles Givre
> Priority: Major
> Fix For: 1.20.0
>
>
> Self closing XML tags are dealt with strangely by java's streaming parser.
> If you have data where you have one row containing a self closing XML tag foo
> (<foo/>) but then in the next row `foo` contains a map or other nested field,
> Drill will throw a schema change exception.
> This proposed fix causes Drill to ignore self-closing tags unless they have
> attributes, which allows data like this to be successfully queried.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)