[ 
https://issues.apache.org/jira/browse/ARROW-18243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17634398#comment-17634398
 ] 

Dewey Dunnington commented on ARROW-18243:
------------------------------------------

Minimal reprex to fire the incorrect unit (I'm using a print method after 
checking {{std::dynamic_pointer_cast()}} instead of the sanitizer which seems 
to work for this):

{code:R}
library(arrow, warn.conflicts = FALSE)
#> Some features are not enabled in this build of Arrow. Run `arrow_info()` for 
more information.
library(dplyr, warn.conflicts = FALSE)

plan <- record_batch(x = Sys.time()) |> 
  mutate(y = round_date(x, "week", week_start = 2)) 

plan
#> RecordBatch (query)
#> x: timestamp[us, tz=UTC]
#> y: timestamp[us, tz=UTC] (add_checked(round_temporal(subtract_checked(x, 
86400), {multiple=1, unit=WEEK, week_starts_monday=true, 
ceil_is_strictly_greater=true, calendar_based_origin=true}), 86400))
#> 
#> See $.data for the source Arrow object

plan |> collect()
#> # A tibble: 1 × 2
#>   x                   y                  
#>   <dttm>              <dttm>             
#> 1 2022-11-15 15:07:01 2022-11-15 00:00:00
{code}


> [R] Sanitizer nightly failure pointing to mixup between TimestampType and 
> DurationType
> --------------------------------------------------------------------------------------
>
>                 Key: ARROW-18243
>                 URL: https://issues.apache.org/jira/browse/ARROW-18243
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Dewey Dunnington
>            Assignee: Dewey Dunnington
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> From the test-ubuntu-18.04-r-sanitizer nightly failure:
> https://dev.azure.com/ursacomputing/crossbow/_build/results?buildId=38932&view=logs&j=0da5d1d9-276d-5173-c4c4-9d4d4ed14fdb&t=d9b15392-e4ce-5e4c-0c8c-b69645229181&l=10690
> (Output of the error:)
> {noformat}
> 2022-11-03T05:18:46.2812479Z Start test: timestamp round/floor/ceil works for 
> week units (non-standard week_start)
> 2022-11-03T05:18:46.2813291Z array_to_vector.cpp:877:13: runtime error: 
> downcast of address 0x608000567830 which does not point to an object of type 
> 'TimestampType'
> 2022-11-03T05:18:46.2814019Z 0x608000567830: note: object is of type 
> 'arrow::DurationType'
> 2022-11-03T05:18:46.2814485Z  02 00 00 00  60 57 55 0e 41 7f 00 00  c0 da 3b 
> 00 30 60 00 00  00 00 00 00 00 00 00 00  30 78 56 00
> 2022-11-03T05:18:46.2814873Z               ^~~~~~~~~~~~~~~~~~~~~~~
> 2022-11-03T05:18:46.2815339Z               vptr for 'arrow::DurationType'
> 2022-11-03T05:18:46.2816306Z     #0 0x7f40fce08769 in 
> arrow::r::Converter_Time<long, 
> arrow::TimestampType>::TimeUnit_multiplier(std::shared_ptr<arrow::Array> 
> const&) const 
> (/usr/local/RDsan/lib/R/site-library/arrow/libs/arrow.so+0x1d46a769)
> 2022-11-03T05:18:46.2817843Z     #1 0x7f40fcdee301 in 
> arrow::r::Converter_Time<long, 
> arrow::TimestampType>::Ingest_some_nulls(SEXPREC*, 
> std::shared_ptr<arrow::Array> const&, long, long, unsigned long) const 
> (/usr/local/RDsan/lib/R/site-library/arrow/libs/arrow.so+0x1d450301)
> 2022-11-03T05:18:46.2819238Z     #2 0x7f40fcd41f20 in 
> arrow::r::Converter::ScheduleConvertTasks(arrow::r::RTasks&, 
> std::shared_ptr<arrow::r::Converter>)::{lambda()#1}::operator()() const 
> /tmp/RtmpAivWT4/R.INSTALL165111fb12d5/arrow/src/array_to_vector.cpp:88
> 2022-11-03T05:18:46.2820996Z     #3 0x7f40fcde8223 in 
> arrow::internal::FnOnce<arrow::Status 
> ()>::FnImpl<arrow::r::Converter::ScheduleConvertTasks(arrow::r::RTasks&, 
> std::shared_ptr<arrow::r::Converter>)::{lambda()#1}>::invoke() 
> (/usr/local/RDsan/lib/R/site-library/arrow/libs/arrow.so+0x1d44a223)
> 2022-11-03T05:18:46.2822336Z     #4 0x7f4102999ebb in 
> arrow::internal::FnOnce<arrow::Status ()>::operator()() && 
> /arrow/cpp/src/arrow/util/functional.h:140
> 2022-11-03T05:18:46.2823083Z     #5 0x7f4102999ebb in operator() 
> /arrow/cpp/src/arrow/util/task_group.cc:113
> 2022-11-03T05:18:46.2823546Z     #6 0x7f4102999ebb in invoke 
> /arrow/cpp/src/arrow/util/functional.h:152
> 2022-11-03T05:18:46.2824071Z     #7 0x7f41029e1084 in 
> arrow::internal::FnOnce<void ()>::operator()() && 
> /arrow/cpp/src/arrow/util/functional.h:140
> 2022-11-03T05:18:46.2824793Z     #8 0x7f41029e1084 in WorkerLoop 
> /arrow/cpp/src/arrow/util/thread_pool.cc:243
> 2022-11-03T05:18:46.2825437Z     #9 0x7f41029e1084 in operator() 
> /arrow/cpp/src/arrow/util/thread_pool.cc:414
> 2022-11-03T05:18:46.2826065Z     #10 0x7f41029e1084 in __invoke_impl<void, 
> arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > 
> /usr/include/c++/10/bits/invoke.h:60
> 2022-11-03T05:18:46.2827016Z     #11 0x7f41029e1084 in 
> __invoke<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> 
> > /usr/include/c++/10/bits/invoke.h:95
> 2022-11-03T05:18:46.2827623Z     #12 0x7f41029e1084 in _M_invoke<0> 
> /usr/include/c++/10/thread:264
> 2022-11-03T05:18:46.2828039Z     #13 0x7f41029e1084 in operator() 
> /usr/include/c++/10/thread:271
> 2022-11-03T05:18:46.2828622Z     #14 0x7f41029e1084 in _M_run 
> /usr/include/c++/10/thread:215
> 2022-11-03T05:18:46.2829426Z     #15 0x7f4136e502b2  
> (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xdc2b2)
> 2022-11-03T05:18:46.2830356Z     #16 0x7f41377acb42 in start_thread 
> nptl/pthread_create.c:442
> 2022-11-03T05:18:46.2831959Z     #17 0x7f413783dbb3 in __clone 
> (/usr/lib/x86_64-linux-gnu/libc.so.6+0x125bb3)
> 2022-11-03T05:18:46.2832205Z 
> 2022-11-03T05:18:46.2833205Z array_to_vector.cpp:877:63: runtime error: 
> member call on address 0x608000127bb0 which does not point to an object of 
> type 'TimestampType'
> 2022-11-03T05:18:46.2834542Z 0x608000127bb0: note: object is of type 
> 'arrow::DurationType'
> 2022-11-03T05:18:46.2835169Z  02 00 00 00  60 57 55 0e 41 7f 00 00  e0 de 3b 
> 00 30 60 00 00  00 00 00 00 00 00 00 00  b0 7b 12 00
> 2022-11-03T05:18:46.2835942Z               ^~~~~~~~~~~~~~~~~~~~~~~
> 2022-11-03T05:18:46.2836696Z               vptr for 'arrow::DurationType'
> 2022-11-03T05:18:46.2838086Z     #0 0x7f40fce0884c in 
> arrow::r::Converter_Time<long, 
> arrow::TimestampType>::TimeUnit_multiplier(std::shared_ptr<arrow::Array> 
> const&) const 
> (/usr/local/RDsan/lib/R/site-library/arrow/libs/arrow.so+0x1d46a84c)
> 2022-11-03T05:18:46.2839650Z     #1 0x7f40fcdee301 in 
> arrow::r::Converter_Time<long, 
> arrow::TimestampType>::Ingest_some_nulls(SEXPREC*, 
> std::shared_ptr<arrow::Array> const&, long, long, unsigned long) const 
> (/usr/local/RDsan/lib/R/site-library/arrow/libs/arrow.so+0x1d450301)
> 2022-11-03T05:18:46.2840745Z     #2 0x7f40fcd41f20 in 
> arrow::r::Converter::ScheduleConvertTasks(arrow::r::RTasks&, 
> std::shared_ptr<arrow::r::Converter>)::{lambda()#1}::operator()() const 
> /tmp/RtmpAivWT4/R.INSTALL165111fb12d5/arrow/src/array_to_vector.cpp:88
> 2022-11-03T05:18:46.2842185Z     #3 0x7f40fcde8223 in 
> arrow::internal::FnOnce<arrow::Status 
> ()>::FnImpl<arrow::r::Converter::ScheduleConvertTasks(arrow::r::RTasks&, 
> std::shared_ptr<arrow::r::Converter>)::{lambda()#1}>::invoke() 
> (/usr/local/RDsan/lib/R/site-library/arrow/libs/arrow.so+0x1d44a223)
> 2022-11-03T05:18:46.2843361Z     #4 0x7f4102999ebb in 
> arrow::internal::FnOnce<arrow::Status ()>::operator()() && 
> /arrow/cpp/src/arrow/util/functional.h:140
> 2022-11-03T05:18:46.2843925Z     #5 0x7f4102999ebb in operator() 
> /arrow/cpp/src/arrow/util/task_group.cc:113
> 2022-11-03T05:18:46.2844374Z     #6 0x7f4102999ebb in invoke 
> /arrow/cpp/src/arrow/util/functional.h:152
> 2022-11-03T05:18:46.2845044Z     #7 0x7f41029e1084 in 
> arrow::internal::FnOnce<void ()>::operator()() && 
> /arrow/cpp/src/arrow/util/functional.h:140
> 2022-11-03T05:18:46.2845566Z     #8 0x7f41029e1084 in WorkerLoop 
> /arrow/cpp/src/arrow/util/thread_pool.cc:243
> 2022-11-03T05:18:46.2846011Z     #9 0x7f41029e1084 in operator() 
> /arrow/cpp/src/arrow/util/thread_pool.cc:414
> 2022-11-03T05:18:46.2847000Z     #10 0x7f41029e1084 in __invoke_impl<void, 
> arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > 
> /usr/include/c++/10/bits/invoke.h:60
> 2022-11-03T05:18:46.2847759Z     #11 0x7f41029e1084 in 
> __invoke<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> 
> > /usr/include/c++/10/bits/invoke.h:95
> 2022-11-03T05:18:46.2848541Z     #12 0x7f41029e1084 in _M_invoke<0> 
> /usr/include/c++/10/thread:264
> 2022-11-03T05:18:46.2849977Z     #13 0x7f41029e1084 in operator() 
> /usr/include/c++/10/thread:271
> 2022-11-03T05:18:46.2850524Z     #14 0x7f41029e1084 in _M_run 
> /usr/include/c++/10/thread:215
> 2022-11-03T05:18:46.2851414Z     #15 0x7f4136e502b2  
> (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xdc2b2)
> 2022-11-03T05:18:46.2851989Z     #16 0x7f41377acb42 in start_thread 
> nptl/pthread_create.c:442
> 2022-11-03T05:18:46.2853276Z     #17 0x7f413783dbb3 in __clone 
> (/usr/lib/x86_64-linux-gnu/libc.so.6+0x125bb3)
> 2022-11-03T05:18:46.2853498Z 
> 2022-11-03T05:18:46.2854540Z 
> /tmp/RtmpAivWT4/R.INSTALL165111fb12d5/arrow/libarrow/arrow-10.0.0.9000/include/arrow/type.h:1380:40:
>  runtime error: member access within address 0x608000567830 which does not 
> point to an object of type 'TimestampType'
> 2022-11-03T05:18:46.2855390Z 0x608000567830: note: object is of type 
> 'arrow::DurationType'
> 2022-11-03T05:18:46.2855850Z  02 00 00 00  60 57 55 0e 41 7f 00 00  c0 da 3b 
> 00 30 60 00 00  00 00 00 00 00 00 00 00  30 78 56 00
> 2022-11-03T05:18:46.2857165Z               ^~~~~~~~~~~~~~~~~~~~~~~
> 2022-11-03T05:18:46.2857943Z               vptr for 'arrow::DurationType'
> 2022-11-03T05:18:46.2858805Z     #0 0x7f40fcd3fa5f in 
> arrow::TimestampType::unit() const 
> /tmp/RtmpAivWT4/R.INSTALL165111fb12d5/arrow/libarrow/arrow-10.0.0.9000/include/arrow/type.h:1380
> 2022-11-03T05:18:46.2860244Z     #1 0x7f40fce08854 in 
> arrow::r::Converter_Time<long, 
> arrow::TimestampType>::TimeUnit_multiplier(std::shared_ptr<arrow::Array> 
> const&) const 
> (/usr/local/RDsan/lib/R/site-library/arrow/libs/arrow.so+0x1d46a854)
> 2022-11-03T05:18:46.2862369Z     #2 0x7f40fcdee301 in 
> arrow::r::Converter_Time<long, 
> arrow::TimestampType>::Ingest_some_nulls(SEXPREC*, 
> std::shared_ptr<arrow::Array> const&, long, long, unsigned long) const 
> (/usr/local/RDsan/lib/R/site-library/arrow/libs/arrow.so+0x1d450301)
> 2022-11-03T05:18:46.2863658Z     #3 0x7f40fcd41f20 in 
> arrow::r::Converter::ScheduleConvertTasks(arrow::r::RTasks&, 
> std::shared_ptr<arrow::r::Converter>)::{lambda()#1}::operator()() const 
> /tmp/RtmpAivWT4/R.INSTALL165111fb12d5/arrow/src/array_to_vector.cpp:88
> 2022-11-03T05:18:46.2865496Z     #4 0x7f40fcde8223 in 
> arrow::internal::FnOnce<arrow::Status 
> ()>::FnImpl<arrow::r::Converter::ScheduleConvertTasks(arrow::r::RTasks&, 
> std::shared_ptr<arrow::r::Converter>)::{lambda()#1}>::invoke() 
> (/usr/local/RDsan/lib/R/site-library/arrow/libs/arrow.so+0x1d44a223)
> 2022-11-03T05:18:46.2866438Z     #5 0x7f4102999ebb in 
> arrow::internal::FnOnce<arrow::Status ()>::operator()() && 
> /arrow/cpp/src/arrow/util/functional.h:140
> 2022-11-03T05:18:46.2866995Z     #6 0x7f4102999ebb in operator() 
> /arrow/cpp/src/arrow/util/task_group.cc:113
> 2022-11-03T05:18:46.2867603Z     #7 0x7f4102999ebb in invoke 
> /arrow/cpp/src/arrow/util/functional.h:152
> 2022-11-03T05:18:46.2868129Z     #8 0x7f41029e1084 in 
> arrow::internal::FnOnce<void ()>::operator()() && 
> /arrow/cpp/src/arrow/util/functional.h:140
> 2022-11-03T05:18:46.2868647Z     #9 0x7f41029e1084 in WorkerLoop 
> /arrow/cpp/src/arrow/util/thread_pool.cc:243
> 2022-11-03T05:18:46.2869301Z     #10 0x7f41029e1084 in operator() 
> /arrow/cpp/src/arrow/util/thread_pool.cc:414
> 2022-11-03T05:18:46.2869934Z     #11 0x7f41029e1084 in __invoke_impl<void, 
> arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> > 
> /usr/include/c++/10/bits/invoke.h:60
> 2022-11-03T05:18:46.2870696Z     #12 0x7f41029e1084 in 
> __invoke<arrow::internal::ThreadPool::LaunchWorkersUnlocked(int)::<lambda()> 
> > /usr/include/c++/10/bits/invoke.h:95
> 2022-11-03T05:18:46.2871611Z     #13 0x7f41029e1084 in _M_invoke<0> 
> /usr/include/c++/10/thread:264
> 2022-11-03T05:18:46.2872194Z     #14 0x7f41029e1084 in operator() 
> /usr/include/c++/10/thread:271
> 2022-11-03T05:18:46.2872766Z     #15 0x7f41029e1084 in _M_run 
> /usr/include/c++/10/thread:215
> 2022-11-03T05:18:46.2873413Z     #16 0x7f4136e502b2  
> (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xdc2b2)
> 2022-11-03T05:18:46.2873871Z     #17 0x7f41377acb42 in start_thread 
> nptl/pthread_create.c:442
> 2022-11-03T05:18:46.2874652Z     #18 0x7f413783dbb3 in __clone 
> (/usr/lib/x86_64-linux-gnu/libc.so.6+0x125bb3)
> 2022-11-03T05:18:46.2874870Z 
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to