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

Method TestScanWithBOM

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

Source from the content-addressed store, hash-verified

160class JsonScanMixin {
161 public:
162 void TestScanWithBOM() {
163 auto source = ToFileSource(
164 "\xef\xbb\xbf{\"ab\":0,\"cd\":\"foo\"}\n{\"ab\":1,\"cd\":\"bar\"}\n");
165 auto fragment = this_->MakeFragment(*source);
166 auto dataset_schema = schema({field("ab", int64()), field("cd", utf8())});
167 this_->SetSchema(dataset_schema->fields());
168 this_->SetJsonOptions();
169
170 int64_t num_rows = 0;
171 for (auto maybe_batch : this_->Batches(fragment)) {
172 ASSERT_OK_AND_ASSIGN(auto batch, maybe_batch);
173 AssertSchemaEqual(dataset_schema, batch->schema());
174 num_rows += batch->num_rows();
175 }
176
177 ASSERT_EQ(num_rows, 2);
178 }
179
180 void TestScanWithCustomParseOptions() {
181 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