Skip to content

Commit e29991c

Browse files
committed
renamed guessColumnType -> createColumnGuessingType to better reflect what it does
1 parent a7e4874 commit e29991c

File tree

8 files changed

+19
-21
lines changed

8 files changed

+19
-21
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnGroupImpl
2020
import org.jetbrains.kotlinx.dataframe.impl.columns.FrameColumnImpl
2121
import org.jetbrains.kotlinx.dataframe.impl.columns.ValueColumnImpl
2222
import org.jetbrains.kotlinx.dataframe.impl.columns.addPath
23-
import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType
23+
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnGuessingType
2424
import org.jetbrains.kotlinx.dataframe.impl.columns.toColumnKind
2525
import org.jetbrains.kotlinx.dataframe.impl.getValuesType
2626
import org.jetbrains.kotlinx.dataframe.impl.splitByIndices
@@ -98,7 +98,7 @@ public interface DataColumn<out T> : BaseColumn<T> {
9898
name: String,
9999
values: List<T>,
100100
nullable: Boolean? = null,
101-
): DataColumn<T> = guessColumnType(name, values, nullable = nullable)
101+
): DataColumn<T> = createColumnGuessingType(name, values, nullable = nullable)
102102

103103
public fun <T> create(
104104
name: String,

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/inferType.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import org.jetbrains.kotlinx.dataframe.DataColumn
66
import org.jetbrains.kotlinx.dataframe.DataFrame
77
import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
88
import org.jetbrains.kotlinx.dataframe.columns.toColumnSet
9-
import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType
9+
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnGuessingType
1010
import org.jetbrains.kotlinx.dataframe.type
1111
import kotlin.reflect.KProperty
1212

13-
public fun AnyCol.inferType(): DataColumn<*> = guessColumnType(name, toList(), type, true)
13+
public fun AnyCol.inferType(): DataColumn<*> = createColumnGuessingType(name, toList(), type, true)
1414

1515
// region DataFrame
1616

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import org.jetbrains.kotlinx.dataframe.impl.ColumnNameGenerator
1313
import org.jetbrains.kotlinx.dataframe.impl.api.createDataFrameImpl
1414
import org.jetbrains.kotlinx.dataframe.impl.asList
1515
import org.jetbrains.kotlinx.dataframe.impl.columnName
16-
import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType
16+
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnGuessingType
1717
import org.jetbrains.kotlinx.dataframe.index
1818
import kotlin.reflect.KCallable
1919
import kotlin.reflect.KClass
@@ -121,12 +121,12 @@ public fun <T> Iterable<Pair<ColumnPath, AnyBaseCol>>.toDataFrameFromPairs(): Da
121121
@JvmName("toDataFrameColumnPathAnyNullable")
122122
public fun Iterable<Pair<ColumnPath, Iterable<Any?>>>.toDataFrameFromPairs(): AnyFrame =
123123
map {
124-
it.first to guessColumnType(it.first.last(), it.second.asList())
124+
it.first to createColumnGuessingType(it.first.last(), it.second.asList())
125125
}.toDataFrameFromPairs<Unit>()
126126

127127
public fun Iterable<Pair<String, Iterable<Any?>>>.toDataFrameFromPairs(): AnyFrame =
128128
map {
129-
ColumnPath(it.first) to guessColumnType(it.first, it.second.asList())
129+
ColumnPath(it.first) to createColumnGuessingType(it.first, it.second.asList())
130130
}.toDataFrameFromPairs<Unit>()
131131

132132
public interface TraversePropertiesDsl {

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/ColumnDataCollector.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.jetbrains.kotlinx.dataframe.DataFrame
77
import org.jetbrains.kotlinx.dataframe.DataRow
88
import org.jetbrains.kotlinx.dataframe.api.concat
99
import org.jetbrains.kotlinx.dataframe.api.toDataFrame
10-
import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType
10+
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnGuessingType
1111
import kotlin.reflect.KClass
1212
import kotlin.reflect.KType
1313
import kotlin.reflect.full.isSubclassOf
@@ -54,7 +54,7 @@ internal abstract class DataCollectorBase<T>(initCapacity: Int) : DataCollector<
5454
internal open class ColumnDataCollector(initCapacity: Int = 0, val typeOf: (KClass<*>) -> KType) :
5555
DataCollectorBase<Any?>(initCapacity) {
5656

57-
override fun toColumn(name: String) = guessColumnType(name, values)
57+
override fun toColumn(name: String) = createColumnGuessingType(name, values)
5858
}
5959

6060
internal class TypedColumnDataCollector<T>(initCapacity: Int = 0, val type: KType, val checkTypes: Boolean = true) :

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/aggregation/getColumns.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.jetbrains.kotlinx.dataframe.aggregation.NamedValue
77
import org.jetbrains.kotlinx.dataframe.api.filter
88
import org.jetbrains.kotlinx.dataframe.api.isComparable
99
import org.jetbrains.kotlinx.dataframe.api.isNumber
10-
import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType
10+
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnGuessingType
1111

1212
internal inline fun <T> Aggregatable<T>.remainingColumns(
1313
crossinline predicate: (AnyCol) -> Boolean,
@@ -19,7 +19,7 @@ internal fun <T> Aggregatable<T>.comparableColumns() =
1919
internal fun <T> Aggregatable<T>.numberColumns() = remainingColumns { it.isNumber() } as ColumnsSelector<T, Number?>
2020

2121
internal fun NamedValue.toColumnWithPath() =
22-
path to guessColumnType(
22+
path to createColumnGuessingType(
2323
name = path.last(),
2424
values = listOf(value),
2525
suggestedType = type,

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/concat.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import org.jetbrains.kotlinx.dataframe.api.dataFrameOf
99
import org.jetbrains.kotlinx.dataframe.api.emptyDataFrame
1010
import org.jetbrains.kotlinx.dataframe.api.isColumnGroup
1111
import org.jetbrains.kotlinx.dataframe.hasNulls
12-
import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType
12+
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnGuessingType
1313
import org.jetbrains.kotlinx.dataframe.impl.commonType
1414
import org.jetbrains.kotlinx.dataframe.impl.getListType
1515
import org.jetbrains.kotlinx.dataframe.impl.guessValueType
@@ -73,7 +73,7 @@ internal fun <T> concatImpl(name: String, columns: List<DataColumn<T>?>, columnS
7373
} else {
7474
getListType(baseType.withNullability(listOfNullable))
7575
}
76-
return guessColumnType(
76+
return createColumnGuessingType(
7777
name = name,
7878
values = list,
7979
suggestedType = tartypeOf,

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/columns/constructors.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ internal fun <T, R> ColumnsContainer<T>.newColumnWithActualType(
8787
expression: AddExpression<T, R>,
8888
): DataColumn<R> {
8989
val (_, values) = computeValues(this as DataFrame<T>, expression)
90-
return guessColumnType(name, values)
90+
return createColumnGuessingType(name, values)
9191
}
9292

9393
internal fun <T, R> computeValues(df: DataFrame<T>, expression: AddExpression<T, R>): Pair<Boolean, List<R>> {
@@ -129,7 +129,7 @@ internal fun <T> createColumn(values: Iterable<T>, suggestedType: KType, guessTy
129129
).asDataColumn().cast()
130130

131131
guessType ->
132-
guessColumnType(
132+
createColumnGuessingType(
133133
name = "",
134134
values = values.asList(),
135135
suggestedType = suggestedType,
@@ -217,10 +217,8 @@ internal fun Array<out String>.toNumberColumns() = toColumnsSetOf<Number>()
217217

218218
// endregion
219219

220-
internal fun <T> guessColumnType(name: String, values: List<T>) = guessColumnType(name, values, null)
221-
222220
@PublishedApi
223-
internal fun <T> guessColumnType(
221+
internal fun <T> createColumnGuessingType(
224222
name: String,
225223
values: List<T>,
226224
suggestedType: KType? = null,

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/common.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import com.github.kittinunf.fuel.httpGet
44
import org.jetbrains.kotlinx.dataframe.AnyFrame
55
import org.jetbrains.kotlinx.dataframe.DataFrame
66
import org.jetbrains.kotlinx.dataframe.api.toDataFrame
7-
import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType
7+
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnGuessingType
88
import java.io.File
99
import java.io.IOException
1010
import java.io.InputStream
@@ -33,7 +33,7 @@ public fun <T> List<List<T>>.toDataFrame(containsColumns: Boolean = false): AnyF
3333
if (it.isEmpty()) return@mapNotNull null
3434
val name = it[0].toString()
3535
val values = it.drop(1)
36-
guessColumnType(name, values)
36+
createColumnGuessingType(name, values)
3737
}.toDataFrame()
3838
}
3939

@@ -50,7 +50,7 @@ public fun <T> List<List<T>>.toDataFrame(containsColumns: Boolean = false): AnyF
5050
row[colIndex]
5151
}
5252
}
53-
guessColumnType(name, values)
53+
createColumnGuessingType(name, values)
5454
}.toDataFrame()
5555
}
5656
}

0 commit comments

Comments
 (0)