Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-8566

[R] error when writing POSIXct to spark

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.17.0
    • 1.0.0
    • R
    • None
    • #> R version 3.6.3 (2020-02-29)
      #> Platform: x86_64-apple-darwin15.6.0 (64-bit)
      #> Running under: macOS Mojave 10.14.6
      sparklyr::spark_version(sc)
      #> [1] '2.4.5'

    Description

      {{monospaced text``` r
      library(DBI)
      library(sparklyr)
      library(arrow)
      #>
      #> Attaching package: 'arrow'
      #> The following object is masked from 'package:utils':
      #>
      #> timestamp
      sc <- spark_connect(master = "local")
      sparklyr::spark_version(sc)
      #> [1] '2.4.5'
      x <- data.frame(y = Sys.time())
      dbWriteTable(sc, "test_posixct", x)
      #> Error: org.apache.spark.SparkException: Job aborted.
      #> at org.apache.spark.sql.execution.datasources.FileFormatWriter$.write(FileFormatWriter.scala:198)
      #> at org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelationCommand.run(InsertIntoHadoopFsRelationCommand.scala:159)
      #> at org.apache.spark.sql.execution.datasources.DataSource.writeAndRead(DataSource.scala:503)
      #> at org.apache.spark.sql.execution.command.CreateDataSourceTableAsSelectCommand.saveDataIntoTable(createDataSourceTables.scala:217)
      #> at org.apache.spark.sql.execution.command.CreateDataSourceTableAsSelectCommand.run(createDataSourceTables.scala:176)
      #> at org.apache.spark.sql.execution.command.DataWritingCommandExec.sideEffectResult$lzycompute(commands.scala:104)
      #> at org.apache.spark.sql.execution.command.DataWritingCommandExec.sideEffectResult(commands.scala:102)
      #> at org.apache.spark.sql.execution.command.DataWritingCommandExec.doExecute(commands.scala:122)
      #> at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:131)
      #> at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:127)
      #> at org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:155)
      #> at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
      #> at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152)
      #> at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127)
      #> at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:83)
      #> at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:81)
      #> at org.apache.spark.sql.DataFrameWriter$$anonfun$runCommand$1.apply(DataFrameWriter.scala:676)
      #> at org.apache.spark.sql.DataFrameWriter$$anonfun$runCommand$1.apply(DataFrameWriter.scala:676)
      #> at org.apache.spark.sql.execution.SQLExecution$$anonfun$withNewExecutionId$1.apply(SQLExecution.scala:80)
      #> at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:127)
      #> at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:75)
      #> at org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:676)
      #> at org.apache.spark.sql.DataFrameWriter.createTable(DataFrameWriter.scala:474)
      #> at org.apache.spark.sql.DataFrameWriter.saveAsTable(DataFrameWriter.scala:453)
      #> at org.apache.spark.sql.DataFrameWriter.saveAsTable(DataFrameWriter.scala:409)
      #> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      #> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      #> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      #> at java.lang.reflect.Method.invoke(Method.java:498)
      #> at sparklyr.Invoke.invoke(invoke.scala:147)
      #> at sparklyr.StreamHandler.handleMethodCall(stream.scala:136)
      #> at sparklyr.StreamHandler.read(stream.scala:61)
      #> at sparklyr.BackendHandler$$anonfun$channelRead0$1.apply$mcV$sp(handler.scala:58)
      #> at scala.util.control.Breaks.breakable(Breaks.scala:38)
      #> at sparklyr.BackendHandler.channelRead0(handler.scala:38)
      #> at sparklyr.BackendHandler.channelRead0(handler.scala:14)
      #> at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
      #> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
      #> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
      #> at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
      #> at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
      #> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
      #> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
      #> at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
      #> at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:328)
      #> at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:302)
      #> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
      #> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
      #> at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
      #> at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422)
      #> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
      #> at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
      #> at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931)
      #> at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
      #> at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700)
      #> at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635)
      #> at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552)
      #> at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514)
      #> at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044)
      #> at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
      #> at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
      #> at java.lang.Thread.run(Thread.java:748)
      #> Caused by: org.apache.spark.SparkException: Job aborted due to stage failure: Task 0 in stage 1.0 failed 1 times, most recent failure: Lost task 0.0 in stage 1.0 (TID 1, localhost, executor driver): java.lang.UnsupportedOperationException
      #> at org.apache.spark.sql.vectorized.ArrowColumnVector.<init>(ArrowColumnVector.java:173)
      #> at sparklyr.ArrowConvertersImpl$$anon$1$$anonfun$1.apply(arrowconverters.scala:210)
      #> at sparklyr.ArrowConvertersImpl$$anon$1$$anonfun$1.apply(arrowconverters.scala:209)
      #> at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
      #> at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
      #> at scala.collection.Iterator$class.foreach(Iterator.scala:891)
      #> at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
      #> at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
      #> at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
      #> at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
      #> at scala.collection.AbstractTraversable.map(Traversable.scala:104)
      #> at sparklyr.ArrowConvertersImpl$$anon$1.nextBatch(arrowconverters.scala:209)
      #> at sparklyr.ArrowConvertersImpl$$anon$1.<init>(arrowconverters.scala:172)
      #> at sparklyr.ArrowConvertersImpl.fromPayloadIterator(arrowconverters.scala:170)
      #> at sparklyr.ArrowConvertersImpl.fromPayloadIterator(arrowconverters.scala:157)
      #> at sparklyr.ArrowConverters$$anonfun$3.apply(arrowconverters.scala:293)
      #> at sparklyr.ArrowConverters$$anonfun$3.apply(arrowconverters.scala:290)
      #> at org.apache.spark.rdd.RDD$$anonfun$mapPartitions$1$$anonfun$apply$23.apply(RDD.scala:823)
      #> at org.apache.spark.rdd.RDD$$anonfun$mapPartitions$1$$anonfun$apply$23.apply(RDD.scala:823)
      #> at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:52)
      #> at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:346)
      #> at org.apache.spark.rdd.RDD.iterator(RDD.scala:310)
      #> at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:52)
      #> at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:346)
      #> at org.apache.spark.rdd.RDD.iterator(RDD.scala:310)
      #> at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:90)
      #> at org.apache.spark.scheduler.Task.run(Task.scala:123)
      #> at org.apache.spark.executor.Executor$TaskRunner$$anonfun$10.apply(Executor.scala:408)
      #> at org.apache.spark.util.Utils$.tryWithSafeFinally(Utils.scala:1360)
      #> at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:414)
      #> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      #> at java.u
      sessionInfo()
      #> R version 3.6.3 (2020-02-29)
      #> Platform: x86_64-apple-darwin15.6.0 (64-bit)
      #> Running under: macOS Mojave 10.14.6
      #>
      #> Matrix products: default
      #> BLAS: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
      #> LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
      #>
      #> locale:
      #> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
      #>
      #> attached base packages:
      #> [1] stats graphics grDevices utils datasets methods base
      #>
      #> other attached packages:
      #> [1] arrow_0.17.0 sparklyr_1.2.0 DBI_1.1.0
      #>
      #> loaded via a namespace (and not attached):
      #> [1] Rcpp_1.0.4 compiler_3.6.3 pillar_1.4.3 dbplyr_1.4.3
      #> [5] highr_0.8 r2d3_0.2.3 base64enc_0.1-3 tools_3.6.3
      #> [9] bit_1.1-15.2 digest_0.6.25 jsonlite_1.6.1 evaluate_0.14
      #> [13] tibble_3.0.1 lifecycle_0.2.0 pkgconfig_2.0.3 rlang_0.4.5
      #> [17] rstudioapi_0.11 parallel_3.6.3 yaml_2.2.1 xfun_0.13
      #> [21] withr_2.2.0 httr_1.4.1 stringr_1.4.0 dplyr_0.8.5
      #> [25] knitr_1.28 askpass_1.1 generics_0.0.2 htmlwidgets_1.5.1
      #> [29] vctrs_0.2.4 rprojroot_1.3-2 bit64_0.9-7 tidyselect_1.0.0
      #> [33] glue_1.4.0 forge_0.2.0 R6_2.4.1 rmarkdown_2.1
      #> [37] purrr_0.3.4 magrittr_1.5 backports_1.1.6 htmltools_0.4.0
      #> [41] ellipsis_0.3.0 assertthat_0.2.1 config_0.3 stringi_1.4.6
      #> [45] openssl_1.4.1 crayon_1.3.4
      ```

      <sup>Created on 2020-04-23 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0)</sup>}}

      Attachments

        Activity

          People

            npr Neal Richardson
            zzcurt Curt Bergmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: