Skip to content

Commit

Permalink
Test saving bigStringColumn to Arrow
Browse files Browse the repository at this point in the history
  • Loading branch information
Kopilov authored and Kopilov committed Apr 20, 2023
1 parent 399b2f5 commit 13f3c4b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,11 @@ internal class ArrowKtTest {
Locale.setDefault(currentLocale)
}
}

@Test
fun testBigStringColumn() {
val dataFrame = dataFrameOf(bigStringColumn)
val data = dataFrame.saveArrowFeatherToByteArray()
DataFrame.readArrowFeather(data) shouldBe dataFrame
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,39 @@ val citiesExampleSchema = """{
} ]
}
""".trimIndent()

/**
* String column (variable length vector) with size >1 MiB
*/
val bigStringColumn = run {
val list = ArrayList<String>()
for (i in 0 until 1024) {
val row = StringBuilder()
for (j in 0 until 64) {
row.append("abcd")
}
list.add(row.toString())
}
for (i in 0 until 1024) {
val row = StringBuilder()
for (j in 0 until 64) {
row.append("гдёж")
}
list.add(row.toString())
}
for (i in 0 until 1024) {
val row = StringBuilder()
for (j in 0 until 64) {
row.append("αβγδ")
}
list.add(row.toString())
}
for (i in 0 until 1024) {
val row = StringBuilder()
for (j in 0 until 64) {
row.append("正体字")
}
list.add(row.toString())
}
DataColumn.createValueColumn("bigStringColumn", list)
}

0 comments on commit 13f3c4b

Please sign in to comment.