Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cpp/src/arrow/dataset/partition_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ TEST_F(TestPartitioning, DiscoverSchema) {
// fall back to string if any segment for field alpha is not parseable as int
AssertInspect({"/0/1", "/hello/1"}, {Str("alpha"), Int("beta")});

// If there are too many digits fall back to string
AssertInspect({"/3760212050/1"}, {Str("alpha"), Int("beta")});

// missing segment for beta doesn't cause an error or fallback
AssertInspect({"/0/1", "/hello"}, {Str("alpha"), Int("beta")});
}
Expand All @@ -168,6 +171,9 @@ TEST_F(TestPartitioning, DictionaryInference) {
// type is still int32 if possible
AssertInspect({"/0/1"}, {DictInt("alpha"), DictInt("beta")});

// If there are too many digits fall back to string
AssertInspect({"/3760212050/1"}, {DictStr("alpha"), DictInt("beta")});

// successful dictionary inference
AssertInspect({"/a/0"}, {DictStr("alpha"), DictInt("beta")});
AssertInspect({"/a/0", "/a/1"}, {DictStr("alpha"), DictInt("beta")});
Expand Down Expand Up @@ -256,6 +262,9 @@ TEST_F(TestPartitioning, DiscoverHiveSchema) {
// (...so ensure your partitions are ordered the same for all paths)
AssertInspect({"/alpha=0/beta=1", "/beta=2/alpha=3"}, {Int("alpha"), Int("beta")});

// If there are too many digits fall back to string
AssertInspect({"/alpha=3760212050"}, {Str("alpha")});

// missing path segments will not cause an error
AssertInspect({"/alpha=0/beta=1", "/beta=2/alpha=3", "/gamma=what"},
{Int("alpha"), Int("beta"), Str("gamma")});
Expand All @@ -269,6 +278,9 @@ TEST_F(TestPartitioning, HiveDictionaryInference) {
// type is still int32 if possible
AssertInspect({"/alpha=0/beta=1"}, {DictInt("alpha"), DictInt("beta")});

// If there are too many digits fall back to string
AssertInspect({"/alpha=3760212050"}, {DictStr("alpha")});

// successful dictionary inference
AssertInspect({"/alpha=a/beta=0"}, {DictStr("alpha"), DictInt("beta")});
AssertInspect({"/alpha=a/beta=0", "/alpha=a/1"}, {DictStr("alpha"), DictInt("beta")});
Expand Down