Skip to content

Commit

Permalink
Eliminate unneeded wrapping by ByteArrayInputStream per-line during s…
Browse files Browse the repository at this point in the history
…chema inferring
  • Loading branch information
MaxGekk committed Apr 15, 2018
1 parent c35d5d1 commit 58fc5c6
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ private[sql] object CreateJacksonParser extends Serializable {

def text(enc: String, jsonFactory: JsonFactory, record: Text): JsonParser = {
val bain = new ByteArrayInputStream(record.getBytes, 0, record.getLength)

jsonFactory.createParser(new InputStreamReader(bain, enc))
}

Expand All @@ -58,9 +59,9 @@ private[sql] object CreateJacksonParser extends Serializable {
}

def internalRow(jsonFactory: JsonFactory, row: InternalRow): JsonParser = {
val is = new ByteArrayInputStream(row.getBinary(0))
val ba = row.getBinary(0)

inputStream(jsonFactory, is)
jsonFactory.createParser(ba, 0, ba.length)
}

def internalRow(enc: String, jsonFactory: JsonFactory, row: InternalRow): JsonParser = {
Expand Down

0 comments on commit 58fc5c6

Please sign in to comment.