@@ -4,7 +4,11 @@ import org.jetbrains.kotlinx.dataframe.DataColumn
4
4
import org.jetbrains.kotlinx.dataframe.api.forEach
5
5
import org.jetbrains.kotlinx.dataframe.api.forEachIndexed
6
6
import java.math.BigInteger
7
+ import java.time.LocalDate
8
+ import java.time.LocalDateTime
9
+ import java.time.ZoneOffset
7
10
import kotlin.math.absoluteValue
11
+ import kotlin.math.pow
8
12
import kotlin.reflect.typeOf
9
13
10
14
/* *
@@ -90,8 +94,29 @@ internal fun assertEstimations(exampleFrame: AnyFrame) {
90
94
element shouldBe (iBatch(i).toBigInteger() * 100000000000000000L .toBigInteger() % (Long .MIN_VALUE .toBigInteger() * 2 .toBigInteger()).abs())
91
95
}
92
96
93
- val dateCol = exampleFrame[" date32" ]
94
- val datetimeCol = exampleFrame[" date64" ]
97
+ val floatCol = exampleFrame[" float" ] as DataColumn <Float ?>
98
+ floatCol.type() shouldBe typeOf<Float ?>()
99
+ floatCol.forEachIndexed { i, element ->
100
+ element shouldBe (2.0f .pow(iBatch(i).toFloat()))
101
+ }
102
+
103
+ val doubleCol = exampleFrame[" double" ] as DataColumn <Double ?>
104
+ doubleCol.type() shouldBe typeOf<Double ?>()
105
+ doubleCol.forEachIndexed { i, element ->
106
+ element shouldBe (2.0 .pow(iBatch(i).toDouble()))
107
+ }
108
+
109
+ val dateCol = exampleFrame[" date32" ] as DataColumn <LocalDate ?>
110
+ dateCol.type() shouldBe typeOf<LocalDate ?>()
111
+ dateCol.forEachIndexed { i, element ->
112
+ element shouldBe LocalDate .ofEpochDay(iBatch(i).toLong() * 30 )
113
+ }
114
+
115
+ val datetimeCol = exampleFrame[" date64" ] as DataColumn <LocalDateTime ?>
116
+ datetimeCol.type() shouldBe typeOf<LocalDateTime ?>()
117
+ datetimeCol.forEachIndexed { i, element ->
118
+ element shouldBe LocalDateTime .ofEpochSecond(iBatch(i).toLong() * 60 * 60 * 24 * 30 , 0 , ZoneOffset .UTC )
119
+ }
95
120
96
121
val timeSecCol = exampleFrame[" time32_seconds" ]
97
122
val timeMilliCol = exampleFrame[" time32_milli" ]
0 commit comments