') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); ARROW-14095: [C++] subtract(timestamp, duration) -> timestamp kernel by rok · Pull Request #12137 · apache/arrow · GitHub
Skip to content

ARROW-14095: [C++] subtract(timestamp, duration) -> timestamp kernel - #12137

Closed
rok wants to merge 3 commits into
apache:masterfrom
rok:ARROW-14095
Closed

ARROW-14095: [C++] subtract(timestamp, duration) -> timestamp kernel#12137
rok wants to merge 3 commits into
apache:masterfrom
rok:ARROW-14095

Conversation

@rok

@rokrok commented Jan 13, 2022

Copy link
Copy Markdown
Member

@github-actions

Copy link
Copy Markdown

@rok

rok commented Jan 13, 2022

Copy link
Copy Markdown
MemberAuthor

@lidavidm similar question about units as in #12124 - should we only cover matching time units (e.g. subtract(timestamp[s], duration[s]) -> timestamp[s]) or allow non-matching units too (e.g. subtract(timestamp[s], duration[ms]) -> timestamp[s])?

@jorisvandenbossche

jorisvandenbossche commented Jan 13, 2022

Copy link
Copy Markdown
Member

I would expect that for non-matching resolution in the input, we cast to the most detailed resolution. But, this doesn't necessarily need to have kernels for all combinations of resolutions. I think the casting step before calling the kernel ("DispatchBest") should take care of that (like add(int64, int32) -> int64 is not a registered kernel (only add(int64, int64) is), but still works).

The same is true for subtract(timestamp, timestamp) -> duration, which is for now only implemented for matching resolutions, and also the automatic casting doesn't seem to work yet for timestamps.

@rok

rok commented Jan 19, 2022

Copy link
Copy Markdown
MemberAuthor

@jorisvandenbossche heterogeneous time resolutions are now supported.

@jorisvandenbossche

Copy link
Copy Markdown
Member

This is now a test only change?

@rok

rok commented Jan 27, 2022

Copy link
Copy Markdown
MemberAuthor

@jorisvandenbossche It would appear test + doc only yes. ARROW-14095 added the subtract(timestamp, duration) kernel and dispatch best path to get from subtract(date, duration) -> subtract(timestamp, duration).

Comment threaddocs/source/cpp/compute.rst Outdated
| sign | Unary | Numeric | Int8/Float32/Float64 | \(2) |
+------------------+--------+----------------------------+----------------------------+-------+
| subtract | Binary | Numeric/Date/Duration | Numeric/Date/Duration | \(1) |
| subtract | Binary | Numeric/Timestamp/Duration | Numeric/Timestamp/Duration | \(1) |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporal instead of Timestamp?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed Numeric/Timestamp/Duration -> Numeric/Temporal

Comment threadcpp/src/arrow/compute/kernels/scalar_temporal_test.cc
auto seconds_3_tz = ArrayFromJSON(timestamp(TimeUnit::SECOND, "UTC"), R"([3, null])");
auto milliseconds_1k_tz =
ArrayFromJSON(timestamp(TimeUnit::MILLI, "UTC"), R"([1000, null])");
CheckScalarBinary(op, seconds_3, milliseconds_2k, milliseconds_1k);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nor here

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@ursabot

ursabot commented Jan 31, 2022

Copy link
Copy Markdown

Benchmark runs are scheduled for baseline = d8f8c09 and contender = d747326. d747326 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Finished ⬇️0.0% ⬆️0.0%] ursa-i9-9960x
[Finished ⬇️0.73% ⬆️0.73%] ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python. Runs only benchmarks with cloud = True
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@rok@jorisvandenbossche@ursabot@lidavidm