noirello commented on code in PR #1088:
URL: https://github.com/apache/orc/pull/1088#discussion_r852041432
##########
c++/test/TestTimestampStatistics.cc:
##########
@@ -57,4 +62,97 @@ namespace orc {
EXPECT_EQ("Data type: Timestamp\nValues: 12\nHas null: no\nMinimum:
1995-01-01 00:00:00.688\nLowerBound: 1995-01-01 00:00:00.688\nMaximum:
2037-01-01 00:00:00.0\nUpperBound: 2037-01-01 00:00:00.1\n",
stripeColStats->toString());
}
+ TEST(TestTimestampStatistics, testTimezoneUTC) {
+ MemoryOutputStream memStream(DEFAULT_MEM_STREAM_SIZE);
+ MemoryPool *pool = getDefaultPool();
+ std::unique_ptr<Type>
type(Type::buildTypeFromString("struct<col:timestamp>"));
+ WriterOptions wOptions;
+ wOptions.setMemoryPool(pool);
+ std::unique_ptr<Writer> writer = createWriter(*type, &memStream, wOptions);
+ std::unique_ptr<ColumnVectorBatch> batch = writer->createRowBatch(1024);
+ StructVectorBatch *root = dynamic_cast<StructVectorBatch *>(batch.get());
+ TimestampVectorBatch *col = dynamic_cast<orc::TimestampVectorBatch
*>(root->fields[0]);
+
+ int64_t expectedMinMillis = 1650133963321; // 2022-04-16T18:32:43.321+00:00
+ int64_t expectedMaxMillis = 1650133964321; // 2022-04-16T18:32:44.321+00:00
+
+ col->data[0] = expectedMinMillis / 1000;
+ col->nanoseconds[0] = expectedMinMillis % 1000 * 1000000;
+ col->data[1] = expectedMaxMillis / 1000;
+ col->nanoseconds[1] = expectedMaxMillis % 1000 * 1000000;
+ col->numElements = 2;
+ root->numElements = 2;
+
+ writer->add(*batch);
+ writer->close();
+
+ std::unique_ptr<InputStream> inStream(new MemoryInputStream(
+ memStream.getData(), memStream.getLength()));
+ ReaderOptions rOptions;
+ rOptions.setMemoryPool(*pool);
+ std::unique_ptr<Reader> reader = createReader(std::move(inStream),
rOptions);
+
+ std::unique_ptr<StripeStatistics> stripeStats =
reader->getStripeStatistics(0);
+ const TimestampColumnStatistics* stripeColStats =
+ reinterpret_cast<const
TimestampColumnStatistics*>(stripeStats->getColumnStatistics(1));
+
+
Review Comment:
It's 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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]