-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add infer types parameter in DSL functions #579
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import org.jetbrains.kotlinx.dataframe.annotations.ColumnName | |
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema | ||
import org.jetbrains.kotlinx.dataframe.api.ExcessiveColumns | ||
import org.jetbrains.kotlinx.dataframe.api.GroupBy | ||
import org.jetbrains.kotlinx.dataframe.api.Infer | ||
import org.jetbrains.kotlinx.dataframe.api.ParserOptions | ||
import org.jetbrains.kotlinx.dataframe.api.add | ||
import org.jetbrains.kotlinx.dataframe.api.addAll | ||
|
@@ -182,6 +183,7 @@ import org.jetbrains.kotlinx.dataframe.size | |
import org.jetbrains.kotlinx.dataframe.type | ||
import org.jetbrains.kotlinx.dataframe.typeClass | ||
import org.junit.Test | ||
import java.lang.reflect.Type | ||
import java.math.BigDecimal | ||
import java.time.LocalDate | ||
import kotlin.reflect.jvm.jvmErasure | ||
|
@@ -919,6 +921,15 @@ class DataFrameTests : BaseTest() { | |
} | ||
} | ||
|
||
@Test | ||
fun `add several columns with type inference`() { | ||
val f: Any = 123 | ||
val df = typed.add { | ||
expr(infer = Infer.Type) { f } into "f" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually expected this to be done by default. If you need to manually specify to infer types, I think people will just not do it. And then, it will be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's consistent with |
||
} | ||
df["f"].type() shouldBe typeOf<Int>() | ||
} | ||
|
||
@Test | ||
fun `remove one column`() { | ||
val expected = listOf("name", "city", "weight") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, it's good it exists, but I think it should be done by default when using
expr