-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* v1 streaming read test * Update MaxNumRowsSuite.scala * Update MaxNumRowsSuite.scala * Update MaxRowsReadSuite.scala * fix issue with v2 data source when streaming excel * wip * fix spark 2.4 build * Update ExcelTable.scala * fix for TODO issue * review items * Update MaxRowsReadSuite.scala * Update src/main/scala/com/crealytics/spark/v2/excel/SheetData.scala Co-authored-by: Martin Mauch <[email protected]> * some review comments * try to centralise some code * Update ExcelTable.scala * continue refactor * license * update tests * compile issues * delete large file test Co-authored-by: Martin Mauch <[email protected]>
- Loading branch information
1 parent
7c96184
commit 4ceca4f
Showing
6 changed files
with
154 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/scala/com/crealytics/spark/v2/excel/SheetData.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2022 Martin Mauch (@nightscape) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.crealytics.spark.v2.excel | ||
|
||
import java.io.Closeable | ||
|
||
case class SheetData[T](rowIterator: Iterator[T], resourcesToClose: Seq[Closeable] = Seq.empty) extends Closeable { | ||
def modifyIterator(f: Iterator[T] => Iterator[T]): SheetData[T] = SheetData(f(rowIterator), resourcesToClose) | ||
def append(other: SheetData[T]): SheetData[T] = | ||
SheetData(rowIterator ++ other.rowIterator, resourcesToClose ++ other.resourcesToClose) | ||
override def close(): Unit = resourcesToClose.foreach(_.close()) | ||
} |