Skip to content

Commit

Permalink
Fix package of FileNamesSuite
Browse files Browse the repository at this point in the history
  • Loading branch information
ebyhr committed Oct 19, 2024
1 parent d3ed277 commit c007486
Showing 1 changed file with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,46 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.delta.kernel

import scala.collection.JavaConverters._
package io.delta.kernel.internal.util

import io.delta.kernel.internal.fs.Path
import io.delta.kernel.internal.util.FileNames
import io.delta.kernel.internal.util.FileNames._
import org.scalatest.funsuite.AnyFunSuite

import scala.collection.JavaConverters._

class FileNamesSuite extends AnyFunSuite {

test("isCheckpointFile") {
assert(FileNames.isCheckpointFile("/a/123.checkpoint.parquet"))
assert(FileNames.isCheckpointFile("/a/123.checkpoint.0000000001.0000000087.parquet"))
assert(FileNames.isCheckpointFile("/a/000000010.checkpoint.80a083e8-7026.json"))
assert(FileNames.isCheckpointFile("/a/000000010.checkpoint.80a083e8-7026.parquet"))
assert(!FileNames.isCheckpointFile("/a/123.json"))
assert(!FileNames.isCommitFile("/a/123.checkpoint.3.json"))
assert(isCheckpointFile("/a/123.checkpoint.parquet"))
assert(isCheckpointFile("/a/123.checkpoint.0000000001.0000000087.parquet"))
assert(isCheckpointFile("/a/000000010.checkpoint.80a083e8-7026.json"))
assert(isCheckpointFile("/a/000000010.checkpoint.80a083e8-7026.parquet"))
assert(!isCheckpointFile("/a/123.json"))
assert(!isCommitFile("/a/123.checkpoint.3.json"))
}

test("checkpointVersion") {
assert(FileNames.checkpointVersion(new Path("/a/123.checkpoint.parquet")) == 123)
assert(FileNames.checkpointVersion(new Path("/a/0.checkpoint.parquet")) == 0)
assert(FileNames.checkpointVersion(
assert(checkpointVersion(new Path("/a/123.checkpoint.parquet")) == 123)
assert(checkpointVersion(new Path("/a/0.checkpoint.parquet")) == 0)
assert(checkpointVersion(
new Path("/a/00000000000000000151.checkpoint.parquet")) == 151)
assert(FileNames.checkpointVersion(
assert(checkpointVersion(
new Path("/a/999.checkpoint.0000000090.0000000099.parquet")) == 999)
assert(FileNames.checkpointVersion("/a/000000010.checkpoint.80a083e8-7026.json") == 10)
assert(checkpointVersion("/a/000000010.checkpoint.80a083e8-7026.json") == 10)
}

test("listingPrefix") {
assert(FileNames.listingPrefix(new Path("/a"), 1234) == "/a/00000000000000001234.")
assert(listingPrefix(new Path("/a"), 1234) == "/a/00000000000000001234.")
}

test("checkpointFileWithParts") {
assert(FileNames.checkpointFileWithParts(new Path("/a"), 1, 1).asScala == Seq(
assert(checkpointFileWithParts(new Path("/a"), 1, 1).asScala == Seq(
new Path("/a/00000000000000000001.checkpoint.0000000001.0000000001.parquet")))
assert(FileNames.checkpointFileWithParts(new Path("/a"), 1, 2).asScala == Seq(
assert(checkpointFileWithParts(new Path("/a"), 1, 2).asScala == Seq(
new Path("/a/00000000000000000001.checkpoint.0000000001.0000000002.parquet"),
new Path("/a/00000000000000000001.checkpoint.0000000002.0000000002.parquet")))
assert(FileNames.checkpointFileWithParts(new Path("/a"), 1, 5).asScala == Seq(
assert(checkpointFileWithParts(new Path("/a"), 1, 5).asScala == Seq(
new Path("/a/00000000000000000001.checkpoint.0000000001.0000000005.parquet"),
new Path("/a/00000000000000000001.checkpoint.0000000002.0000000005.parquet"),
new Path("/a/00000000000000000001.checkpoint.0000000003.0000000005.parquet"),
Expand Down

0 comments on commit c007486

Please sign in to comment.