You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by GitBox <gi...@apache.org> on 2021/09/24 18:18:05 UTC

[GitHub] [drill] cgivre opened a new pull request #2322: DRILL-8004: Splunk Sends Newlines in INT Fields, Causing Exceptions

cgivre opened a new pull request #2322:
URL: https://github.com/apache/drill/pull/2322


   # [DRILL-8004](https://issues.apache.org/jira/browse/DRILL-8004): DRILL-8004: Splunk Sends Newlines in INT Fields, Causing Exceptions
   
   ## Description
   Splunk occasionally sends extra white space in `INT` fields.  This was discovered by a user, and when Drill tries to parse the response, it causes `NumberFormatExceptions`.  This PR removes white space in known `INT` fields.  If an exception is thrown, it replaces the value with `-1`.   
   
   Note that all the known `INT` fields are fields derived from time stamps, so in theory they should never be negative.
   
   ## Documentation
   N/A
   
   ## Testing
   Manually tested.


-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [drill] mdeshmu commented on pull request #2322: DRILL-8004: Splunk Sends Newlines in INT Fields, Causing Exceptions

Posted by GitBox <gi...@apache.org>.
mdeshmu commented on pull request #2322:
URL: https://github.com/apache/drill/pull/2322#issuecomment-926848402


   I faced this issue and Charles happily agreed to make this quick fix for me. I have build this branch and tested on my system. 
   I am no more getting those exceptions that were coming due to new lines. Thanks Charles.  


-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [drill] cgivre commented on a change in pull request #2322: DRILL-8004: Splunk Sends Newlines in INT Fields, Causing Exceptions

Posted by GitBox <gi...@apache.org>.
cgivre commented on a change in pull request #2322:
URL: https://github.com/apache/drill/pull/2322#discussion_r716126399



##########
File path: contrib/storage-splunk/src/main/java/org/apache/drill/exec/store/splunk/SplunkBatchReader.java
##########
@@ -370,7 +370,17 @@ public void load(String[] record) {
     @Override
     public void load(String[] record) {
       if (record[columnIndex] != null) {
-        int value = Integer.parseInt(record[columnIndex]);
+        // Splunk may include extra garbage such as newlines or other whitespace in INT fields.
+        String stringValue = record[columnIndex];
+        stringValue = stringValue.replaceAll("\\s","");

Review comment:
       Fixed




-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [drill] cgivre merged pull request #2322: DRILL-8004: Splunk Sends Newlines in INT Fields, Causing Exceptions

Posted by GitBox <gi...@apache.org>.
cgivre merged pull request #2322:
URL: https://github.com/apache/drill/pull/2322


   


-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [drill] luocooong commented on a change in pull request #2322: DRILL-8004: Splunk Sends Newlines in INT Fields, Causing Exceptions

Posted by GitBox <gi...@apache.org>.
luocooong commented on a change in pull request #2322:
URL: https://github.com/apache/drill/pull/2322#discussion_r715965836



##########
File path: contrib/storage-splunk/src/main/java/org/apache/drill/exec/store/splunk/SplunkBatchReader.java
##########
@@ -370,7 +370,17 @@ public void load(String[] record) {
     @Override
     public void load(String[] record) {
       if (record[columnIndex] != null) {
-        int value = Integer.parseInt(record[columnIndex]);
+        // Splunk may include extra garbage such as newlines or other whitespace in INT fields.
+        String stringValue = record[columnIndex];
+        stringValue = stringValue.replaceAll("\\s","");

Review comment:
       Keep a whitespace between the "," and "".




-- 
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: dev-unsubscribe@drill.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org