Skip to content

Commit

Permalink
solved binary compatibility issues and renamed notEmptyRow to largestRow
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolanrensen committed Oct 31, 2024
1 parent eb85027 commit b6fe681
Show file tree
Hide file tree
Showing 4 changed files with 161 additions and 9 deletions.
4 changes: 4 additions & 0 deletions core/api/core.api
Original file line number Diff line number Diff line change
Expand Up @@ -10867,3 +10867,7 @@ public abstract interface class org/jetbrains/kotlinx/dataframe/schema/DataFrame
public abstract fun getColumns ()Ljava/util/Map;
}

public final class org/jetbrains/kotlinx/dataframe/util/DeprecationMessagesKt {
public static final field DF_READ_EXCEL Ljava/lang/String;
}

Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ internal const val CREATE_COLUMN = "This function is just here for binary compat

internal const val GUESS_COLUMN_TYPE = "This function is just here for binary compatibility. $MESSAGE_0_16"

public const val DF_READ_EXCEL: String = "This function is just here for binary compatibility. $MESSAGE_0_16"
// endregion

// region WARNING in 0.16, ERROR in 0.17
Expand Down
24 changes: 18 additions & 6 deletions dataframe-excel/api/dataframe-excel.api
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,30 @@ public final class org/jetbrains/kotlinx/dataframe/io/WorkBookType : java/lang/E
}

public final class org/jetbrains/kotlinx/dataframe/io/XlsxKt {
public static final fun readExcel (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Lorg/apache/poi/ss/usermodel/Sheet;Ljava/lang/String;Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;ILjava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Lorg/apache/poi/ss/usermodel/Workbook;Ljava/lang/String;ILjava/lang/String;Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final synthetic fun readExcel (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Lorg/apache/poi/ss/usermodel/Sheet;Ljava/lang/String;Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;ILjava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Lorg/apache/poi/ss/usermodel/Sheet;Ljava/lang/String;Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;ILjava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;Z)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final synthetic fun readExcel (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Lorg/apache/poi/ss/usermodel/Workbook;Ljava/lang/String;ILjava/lang/String;Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Lorg/apache/poi/ss/usermodel/Workbook;Ljava/lang/String;ILjava/lang/String;Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;Z)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Lorg/apache/poi/ss/usermodel/Sheet;Ljava/lang/String;Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;ILjava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Lorg/apache/poi/ss/usermodel/Sheet;Ljava/lang/String;Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;ILjava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ZILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Lorg/apache/poi/ss/usermodel/Workbook;Ljava/lang/String;ILjava/lang/String;Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel-CWg63oo (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/io/File;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel-CWg63oo (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/io/InputStream;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel-CWg63oo (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel-CWg63oo (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/net/URL;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Lorg/apache/poi/ss/usermodel/Workbook;Ljava/lang/String;ILjava/lang/String;Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ZILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final synthetic fun readExcel-CWg63oo (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/io/File;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final synthetic fun readExcel-CWg63oo (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/io/InputStream;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final synthetic fun readExcel-CWg63oo (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final synthetic fun readExcel-CWg63oo (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/net/URL;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel-CWg63oo$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/io/File;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel-CWg63oo$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/io/InputStream;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel-CWg63oo$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel-CWg63oo$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/net/URL;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel-ssqQo1E (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/io/File;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;Z)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel-ssqQo1E (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/io/InputStream;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;Z)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel-ssqQo1E (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;Z)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun readExcel-ssqQo1E (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/net/URL;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;Z)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel-ssqQo1E$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/io/File;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ZILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel-ssqQo1E$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/io/InputStream;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ZILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel-ssqQo1E$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ZILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static synthetic fun readExcel-ssqQo1E$default (Lorg/jetbrains/kotlinx/dataframe/DataFrame$Companion;Ljava/net/URL;Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Lorg/jetbrains/kotlinx/dataframe/io/NameRepairStrategy;ZILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame;
public static final fun toFormattingOptions-lk1XfQA (Ljava/lang/String;Lorg/apache/poi/ss/usermodel/DataFormatter;)Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;
public static synthetic fun toFormattingOptions-lk1XfQA$default (Ljava/lang/String;Lorg/apache/poi/ss/usermodel/DataFormatter;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/io/FormattingOptions;
public static final fun writeExcel (Lorg/jetbrains/kotlinx/dataframe/DataFrame;Ljava/io/File;Lkotlin/jvm/functions/Function2;Ljava/lang/String;ZLorg/jetbrains/kotlinx/dataframe/io/WorkBookType;Z)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.jetbrains.kotlinx.dataframe.api.select
import org.jetbrains.kotlinx.dataframe.codeGen.AbstractDefaultReadMethod
import org.jetbrains.kotlinx.dataframe.codeGen.DefaultReadDfMethod
import org.jetbrains.kotlinx.dataframe.exceptions.DuplicateColumnNamesException
import org.jetbrains.kotlinx.dataframe.util.DF_READ_EXCEL
import java.io.File
import java.io.InputStream
import java.io.OutputStream
Expand Down Expand Up @@ -332,11 +333,11 @@ public fun DataFrame.Companion.readExcel(
}

else -> {
val notEmptyRow = sheet.rowIterator().asSequence().maxByOrNull { it.lastCellNum }
checkNotNull(notEmptyRow) {
val largestRow = sheet.rowIterator().asSequence().maxByOrNull { it.lastCellNum }
checkNotNull(largestRow) {
"There are no defined cells"
}
notEmptyRow.firstCellNum until notEmptyRow.lastCellNum
largestRow.firstCellNum until largestRow.lastCellNum
}
}

Expand Down Expand Up @@ -650,3 +651,137 @@ private fun Cell.setDate(date: JavaDate) {
calStart.time = date
this.setTime(calStart.toInstant().atZone(getUserTimeZone().toZoneId()).toLocalDateTime())
}

// region deprecated

/** For binary compatibility */
@Deprecated(DF_READ_EXCEL, level = DeprecationLevel.HIDDEN)
public fun DataFrame.Companion.readExcel(
url: URL,
sheetName: String? = null,
skipRows: Int = 0,
columns: String? = null,
stringColumns: StringColumns? = null,
rowsCount: Int? = null,
nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE,
): AnyFrame =
readExcel(
url = url,
sheetName = sheetName,
skipRows = skipRows,
columns = columns,
stringColumns = stringColumns,
rowsCount = rowsCount,
nameRepairStrategy = nameRepairStrategy,
firstRowIsHeader = true,
)

/** For binary compatibility */
@Deprecated(DF_READ_EXCEL, level = DeprecationLevel.HIDDEN)
public fun DataFrame.Companion.readExcel(
file: File,
sheetName: String? = null,
skipRows: Int = 0,
columns: String? = null,
stringColumns: StringColumns? = null,
rowsCount: Int? = null,
nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE,
): AnyFrame =
readExcel(
file = file,
sheetName = sheetName,
skipRows = skipRows,
columns = columns,
stringColumns = stringColumns,
rowsCount = rowsCount,
nameRepairStrategy = nameRepairStrategy,
firstRowIsHeader = true,
)

/** For binary compatibility */
@Deprecated(DF_READ_EXCEL, level = DeprecationLevel.HIDDEN)
public fun DataFrame.Companion.readExcel(
fileOrUrl: String,
sheetName: String? = null,
skipRows: Int = 0,
columns: String? = null,
stringColumns: StringColumns? = null,
rowsCount: Int? = null,
nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE,
): AnyFrame =
readExcel(
fileOrUrl = fileOrUrl,
sheetName = sheetName,
skipRows = skipRows,
columns = columns,
stringColumns = stringColumns,
rowsCount = rowsCount,
nameRepairStrategy = nameRepairStrategy,
firstRowIsHeader = true,
)

/** For binary compatibility */
@Deprecated(DF_READ_EXCEL, level = DeprecationLevel.HIDDEN)
public fun DataFrame.Companion.readExcel(
inputStream: InputStream,
sheetName: String? = null,
skipRows: Int = 0,
columns: String? = null,
stringColumns: StringColumns? = null,
rowsCount: Int? = null,
nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE,
): AnyFrame =
readExcel(
inputStream = inputStream,
sheetName = sheetName,
skipRows = skipRows,
columns = columns,
stringColumns = stringColumns,
rowsCount = rowsCount,
nameRepairStrategy = nameRepairStrategy,
firstRowIsHeader = true,
)

/** For binary compatibility */
@Deprecated(DF_READ_EXCEL, level = DeprecationLevel.HIDDEN)
public fun DataFrame.Companion.readExcel(
wb: Workbook,
sheetName: String? = null,
skipRows: Int = 0,
columns: String? = null,
formattingOptions: FormattingOptions? = null,
rowsCount: Int? = null,
nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE,
): AnyFrame =
readExcel(
wb = wb,
sheetName = sheetName,
skipRows = skipRows,
columns = columns,
formattingOptions = formattingOptions,
rowsCount = rowsCount,
nameRepairStrategy = nameRepairStrategy,
firstRowIsHeader = true,
)

/** For binary compatibility */
@Deprecated(DF_READ_EXCEL, level = DeprecationLevel.HIDDEN)
public fun DataFrame.Companion.readExcel(
sheet: Sheet,
columns: String? = null,
formattingOptions: FormattingOptions? = null,
skipRows: Int = 0,
rowsCount: Int? = null,
nameRepairStrategy: NameRepairStrategy = NameRepairStrategy.CHECK_UNIQUE,
): AnyFrame =
readExcel(
sheet = sheet,
columns = columns,
formattingOptions = formattingOptions,
skipRows = skipRows,
rowsCount = rowsCount,
nameRepairStrategy = nameRepairStrategy,
firstRowIsHeader = true,
)

// endregion

0 comments on commit b6fe681

Please sign in to comment.