You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/07/12 06:58:55 UTC
[GitHub] [arrow] emkornfield opened a new pull request #7718: PARQUET-1882: Buffered Reads should allow for 0 length
emkornfield opened a new pull request #7718:
URL: https://github.com/apache/arrow/pull/7718
Also, there doessn't semm like a great reason to crash when non-zero.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] emkornfield commented on a change in pull request #7718: PARQUET-1882: [C++] Buffered Reads should allow for 0 length
Posted by GitBox <gi...@apache.org>.
emkornfield commented on a change in pull request #7718:
URL: https://github.com/apache/arrow/pull/7718#discussion_r453338166
##########
File path: cpp/src/parquet/file_serialize_test.cc
##########
@@ -398,6 +400,48 @@ TEST(TestBufferedRowGroupWriter, MultiPageDisabledDictionary) {
}
}
+TEST(Roundtrip, AllNulls) {
+ auto primitiveNode =
+ PrimitiveNode::Make("nulls", Repetition::OPTIONAL, nullptr, Type::INT32);
+ schema::NodeVector columns({primitiveNode});
+
+ auto rootNode = GroupNode::Make("root", Repetition::REQUIRED, columns, nullptr);
+
+ auto sink = CreateOutputStream();
+
+ auto fileWriter =
+ ParquetFileWriter::Open(sink, std::static_pointer_cast<GroupNode>(rootNode));
+ auto rowGroupWriter = fileWriter->AppendRowGroup();
+ auto columnWriter = static_cast<Int32Writer*>(rowGroupWriter->NextColumn());
+
+ int32_t values[3];
+ int16_t defLevels[] = {0, 0, 0};
+
+ columnWriter->WriteBatch(3, defLevels, nullptr, values);
+
+ columnWriter->Close();
+ rowGroupWriter->Close();
+ fileWriter->Close();
+
+ ReaderProperties props = default_reader_properties();
+ props.enable_buffered_stream();
+ PARQUET_ASSIGN_OR_THROW(auto buffer, sink->Finish());
+
+ auto source = std::make_shared<::arrow::io::BufferReader>(buffer);
+ auto file_reader = ParquetFileReader::Open(source);
+
+ auto fileReader = ParquetFileReader::Open(source, props);
+ auto rowGroupReader = fileReader->RowGroup(0);
+ auto columnReader = std::static_pointer_cast<Int32Reader>(rowGroupReader->Column(0));
+
+ int64_t valuesRead;
+ defLevels[0] = -1;
+ defLevels[1] = -1;
+ defLevels[2] = -1;
+ columnReader->ReadBatch(3, defLevels, nullptr, values, &valuesRead);
+ EXPECT_THAT(defLevels, ElementsAre(0, 0, 0));
Review comment:
yeah, sorry, more or less copied and pasted from JIRA
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] wesm closed pull request #7718: PARQUET-1882: [C++] Buffered Reads should allow for 0 length
Posted by GitBox <gi...@apache.org>.
wesm closed pull request #7718:
URL: https://github.com/apache/arrow/pull/7718
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] emkornfield commented on pull request #7718: PARQUET-1882: Buffered Reads should allow for 0 length
Posted by GitBox <gi...@apache.org>.
emkornfield commented on pull request #7718:
URL: https://github.com/apache/arrow/pull/7718#issuecomment-657183685
CC @pitrou
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] kiszk commented on pull request #7718: PARQUET-1882: Buffered Reads should allow for 0 length
Posted by GitBox <gi...@apache.org>.
kiszk commented on pull request #7718:
URL: https://github.com/apache/arrow/pull/7718#issuecomment-657184617
Looks good to me
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] emkornfield commented on a change in pull request #7718: PARQUET-1882: [C++] Buffered Reads should allow for 0 length
Posted by GitBox <gi...@apache.org>.
emkornfield commented on a change in pull request #7718:
URL: https://github.com/apache/arrow/pull/7718#discussion_r453338928
##########
File path: cpp/src/parquet/file_serialize_test.cc
##########
@@ -398,6 +400,48 @@ TEST(TestBufferedRowGroupWriter, MultiPageDisabledDictionary) {
}
}
+TEST(Roundtrip, AllNulls) {
+ auto primitiveNode =
+ PrimitiveNode::Make("nulls", Repetition::OPTIONAL, nullptr, Type::INT32);
+ schema::NodeVector columns({primitiveNode});
+
+ auto rootNode = GroupNode::Make("root", Repetition::REQUIRED, columns, nullptr);
+
+ auto sink = CreateOutputStream();
+
+ auto fileWriter =
+ ParquetFileWriter::Open(sink, std::static_pointer_cast<GroupNode>(rootNode));
+ auto rowGroupWriter = fileWriter->AppendRowGroup();
+ auto columnWriter = static_cast<Int32Writer*>(rowGroupWriter->NextColumn());
+
+ int32_t values[3];
+ int16_t defLevels[] = {0, 0, 0};
+
+ columnWriter->WriteBatch(3, defLevels, nullptr, values);
+
+ columnWriter->Close();
+ rowGroupWriter->Close();
+ fileWriter->Close();
+
+ ReaderProperties props = default_reader_properties();
+ props.enable_buffered_stream();
+ PARQUET_ASSIGN_OR_THROW(auto buffer, sink->Finish());
+
+ auto source = std::make_shared<::arrow::io::BufferReader>(buffer);
+ auto file_reader = ParquetFileReader::Open(source);
+
+ auto fileReader = ParquetFileReader::Open(source, props);
+ auto rowGroupReader = fileReader->RowGroup(0);
+ auto columnReader = std::static_pointer_cast<Int32Reader>(rowGroupReader->Column(0));
+
+ int64_t valuesRead;
+ defLevels[0] = -1;
+ defLevels[1] = -1;
+ defLevels[2] = -1;
+ columnReader->ReadBatch(3, defLevels, nullptr, values, &valuesRead);
+ EXPECT_THAT(defLevels, ElementsAre(0, 0, 0));
Review comment:
done.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] github-actions[bot] commented on pull request #7718: PARQUET-1882: Buffered Reads should allow for 0 length
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #7718:
URL: https://github.com/apache/arrow/pull/7718#issuecomment-657184083
https://issues.apache.org/jira/browse/PARQUET-1882
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow] wesm commented on a change in pull request #7718: PARQUET-1882: Buffered Reads should allow for 0 length
Posted by GitBox <gi...@apache.org>.
wesm commented on a change in pull request #7718:
URL: https://github.com/apache/arrow/pull/7718#discussion_r453335961
##########
File path: cpp/src/parquet/file_serialize_test.cc
##########
@@ -398,6 +400,48 @@ TEST(TestBufferedRowGroupWriter, MultiPageDisabledDictionary) {
}
}
+TEST(Roundtrip, AllNulls) {
+ auto primitiveNode =
+ PrimitiveNode::Make("nulls", Repetition::OPTIONAL, nullptr, Type::INT32);
+ schema::NodeVector columns({primitiveNode});
+
+ auto rootNode = GroupNode::Make("root", Repetition::REQUIRED, columns, nullptr);
+
+ auto sink = CreateOutputStream();
+
+ auto fileWriter =
+ ParquetFileWriter::Open(sink, std::static_pointer_cast<GroupNode>(rootNode));
+ auto rowGroupWriter = fileWriter->AppendRowGroup();
+ auto columnWriter = static_cast<Int32Writer*>(rowGroupWriter->NextColumn());
+
+ int32_t values[3];
+ int16_t defLevels[] = {0, 0, 0};
+
+ columnWriter->WriteBatch(3, defLevels, nullptr, values);
+
+ columnWriter->Close();
+ rowGroupWriter->Close();
+ fileWriter->Close();
+
+ ReaderProperties props = default_reader_properties();
+ props.enable_buffered_stream();
+ PARQUET_ASSIGN_OR_THROW(auto buffer, sink->Finish());
+
+ auto source = std::make_shared<::arrow::io::BufferReader>(buffer);
+ auto file_reader = ParquetFileReader::Open(source);
+
+ auto fileReader = ParquetFileReader::Open(source, props);
+ auto rowGroupReader = fileReader->RowGroup(0);
+ auto columnReader = std::static_pointer_cast<Int32Reader>(rowGroupReader->Column(0));
+
+ int64_t valuesRead;
+ defLevels[0] = -1;
+ defLevels[1] = -1;
+ defLevels[2] = -1;
+ columnReader->ReadBatch(3, defLevels, nullptr, values, &valuesRead);
+ EXPECT_THAT(defLevels, ElementsAre(0, 0, 0));
Review comment:
Should de-camel-case this test
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org