-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Add support for searching and marshalling the new Timestamp column type. #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
eacfeaf
96594f3
a291254
ec360b8
42ee025
2ba6894
2204ef5
4ea87b2
781bbc1
9066182
8bb62b3
021d8eb
9215375
5445fb7
8f673c6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -580,6 +580,10 @@ TEST_F(ClpConnectorTest, test4IrTimestampNoPushdown) { | |
| TEST_F(ClpConnectorTest, test4IrTimestampPushdown) { | ||
| // Only the second event meet the condition, the first event is a date string | ||
| // which is not supported yet so the value will be NULL. | ||
| // This test can not use the `timestamp()` literal, since the integer | ||
| // timestamps are in microsecond precision, and we currently assume all IR | ||
| // timestamps are millisecond precision when comparing against timestamp | ||
| // literals. | ||
|
Comment on lines
+583
to
+586
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IR timestamp literal precision mismatch still implies incorrect filtering risk Line 583-Line 586 documents that IR integer timestamps are microseconds, while 🤖 Prompt for AI Agents
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Arguably the issue is more with the existing test than the pushdown logic. Nominally, timestamps are in millisecond precision for existing kv-ir, though technically this isn't guaranteed. Medium-term we'll fix for the kv-ir format like we did for the archive format by updating the format to support a timestamp encoding with well-defined precision. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Looking forward to seeing that format update when you tackle it! 👍 🐰✨ |
||
| const std::shared_ptr<std::string> kqlQuery = | ||
| std::make_shared<std::string>("(timestamp < 1756003005000000)"); | ||
| auto plan = | ||
|
|
@@ -661,11 +665,9 @@ TEST_F(ClpConnectorTest, test5FloatTimestampNoPushdown) { | |
|
|
||
| TEST_F(ClpConnectorTest, test5FloatTimestampPushdown) { | ||
| // Test filtering rows with a timestamp parsed from a date string and floats | ||
| // in various formats. Because KQL doesn’t automatically interpret the unit of | ||
| // the timestamp, the returned result differs slightly from the one without | ||
| // pushdown. | ||
| // in various formats. | ||
| const std::shared_ptr<std::string> kqlQuery = std::make_shared<std::string>( | ||
| "(timestamp < 1746003005.127 and timestamp >= 1746003005.124)"); | ||
| R"(timestamp < timestamp("1746003070000", "\L") and timestamp >= timestamp("1746003005124", "\L"))"); | ||
| auto plan = | ||
| PlanBuilder(pool_.get()) | ||
| .startTableScan() | ||
|
|
@@ -695,12 +697,67 @@ TEST_F(ClpConnectorTest, test5FloatTimestampPushdown) { | |
| {Timestamp(1746003005, 124000000), | ||
| Timestamp(1746003005, 124100000), | ||
| Timestamp(1746003005, 125000000), | ||
| Timestamp(1746003005, 126000000)}), | ||
| Timestamp(1746003005, 126000000), | ||
| Timestamp(1746003005, 127000000), | ||
| Timestamp(1746003060, 0), | ||
| Timestamp(1746003065, 0)}), | ||
| makeFlatVector<double>( | ||
| {1.234567891234500E9, | ||
| {1.2345678912345E9, | ||
| 1E16, | ||
| 1.234567891234567E9, | ||
| 1.234567891234567E9})}); | ||
| 1.234567891234567E9, | ||
| -1.234567891234567E-9, | ||
| 1234567891.234567, | ||
| -1234567891.234567})}); | ||
| test::assertEqualVectors(expected, output); | ||
| } | ||
|
|
||
| TEST_F(ClpConnectorTest, test5NewTimestampFormatFloatTimestampPushdown) { | ||
| // Test filtering rows with a timestamp parsed from a date string and floats | ||
| // in various formats. | ||
| const std::shared_ptr<std::string> kqlQuery = std::make_shared<std::string>( | ||
| R"(timestamp < timestamp("1746003070000", "\L") and timestamp >= timestamp("1746003005124", "\L"))"); | ||
| auto plan = | ||
| PlanBuilder(pool_.get()) | ||
| .startTableScan() | ||
| .outputType(ROW({"timestamp", "floatValue"}, {TIMESTAMP(), DOUBLE()})) | ||
| .tableHandle( | ||
| std::make_shared<ClpTableHandle>(kClpConnectorId, "test_5")) | ||
| .assignments( | ||
| {{"timestamp", | ||
| std::make_shared<ClpColumnHandle>( | ||
| "timestamp", "timestamp", TIMESTAMP())}, | ||
| {"floatValue", | ||
| std::make_shared<ClpColumnHandle>( | ||
| "floatValue", "floatValue", DOUBLE())}}) | ||
| .endTableScan() | ||
| .orderBy({"\"timestamp\" ASC"}, false) | ||
| .planNode(); | ||
|
|
||
| auto output = getResults( | ||
| plan, | ||
| {makeClpSplit( | ||
| getExampleFilePath("test_5.v0.5.0.clps"), | ||
| ClpConnectorSplit::SplitType::kArchive, | ||
| kqlQuery)}); | ||
| auto expected = makeRowVector( | ||
| {// timestamp | ||
| makeFlatVector<Timestamp>( | ||
| {Timestamp(1746003005, 124000000), | ||
| Timestamp(1746003005, 124100000), | ||
| Timestamp(1746003005, 125000000), | ||
| Timestamp(1746003005, 126000000), | ||
| Timestamp(1746003005, 127000001), | ||
| Timestamp(1746003060, 0), | ||
| Timestamp(1746003065, 0)}), | ||
| makeFlatVector<double>( | ||
| {1.2345678912345E9, | ||
| 1E16, | ||
| 1.234567891234567E9, | ||
| 1.234567891234567E9, | ||
| -1.234567891234567E-9, | ||
| 1234567891.234567, | ||
| -1234567891.234567})}); | ||
| test::assertEqualVectors(expected, output); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.