MCPcopy Create free account
hub / github.com/apache/arrow / TestScanWithBOM

Method TestScanWithBOM

cpp/src/arrow/dataset/file_json_test.cc:170–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168class JsonScanMixin {
169 public:
170 void TestScanWithBOM() {
171 auto source = ToFileSource(
172 "\xef\xbb\xbf{\"ab\":0,\"cd\":\"foo\"}\n{\"ab\":1,\"cd\":\"bar\"}\n");
173 auto fragment = this_->MakeFragment(*source);
174 auto dataset_schema = schema({field("ab", int64()), field("cd", utf8())});
175 this_->SetSchema(dataset_schema->fields());
176 this_->SetJsonOptions();
177
178 int64_t num_rows = 0;
179 for (auto maybe_batch : this_->Batches(fragment)) {
180 ASSERT_OK_AND_ASSIGN(auto batch, maybe_batch);
181 AssertSchemaEqual(dataset_schema, batch->schema());
182 num_rows += batch->num_rows();
183 }
184
185 ASSERT_EQ(num_rows, 2);
186 }
187
188 void TestScanWithCustomParseOptions() {
189 auto source = ToFileSource("{\n\"i\":0\n}\n{\n\"i\":1\n}");

Callers

nothing calls this directly

Calls 10

ToFileSourceFunction · 0.85
schemaFunction · 0.50
fieldFunction · 0.50
MakeFragmentMethod · 0.45
SetSchemaMethod · 0.45
fieldsMethod · 0.45
SetJsonOptionsMethod · 0.45
BatchesMethod · 0.45
schemaMethod · 0.45
num_rowsMethod · 0.45

Tested by

no test coverage detected