Skip to content
Snippets Groups Projects
  1. Jul 11, 2016
    • Felix Cheung's avatar
      [SPARK-16144][SPARKR] update R API doc for mllib · 7f38b9d5
      Felix Cheung authored
      ## What changes were proposed in this pull request?
      
      From SPARK-16140/PR #13921 - the issue is we left write.ml doc empty:
      ![image](https://cloud.githubusercontent.com/assets/8969467/16481934/856dd0ea-3e62-11e6-9474-e4d57d1ca001.png)
      
      Here's what I meant as the fix:
      ![image](https://cloud.githubusercontent.com/assets/8969467/16481943/911f02ec-3e62-11e6-9d68-17363a9f5628.png)
      
      ![image](https://cloud.githubusercontent.com/assets/8969467/16481950/9bc057aa-3e62-11e6-8127-54870701c4b1.png)
      
      I didn't realize there was already a JIRA on this. mengxr yanboliang
      
      ## How was this patch tested?
      
      check doc generated.
      
      Author: Felix Cheung <felixcheung_m@hotmail.com>
      
      Closes #13993 from felixcheung/rmllibdoc.
      7f38b9d5
    • Yanbo Liang's avatar
      [SPARKR][DOC] SparkR ML user guides update for 2.0 · 2ad031be
      Yanbo Liang authored
      ## What changes were proposed in this pull request?
      * Update SparkR ML section to make them consistent with SparkR API docs.
      * Since #13972 adds labelling support for the ```include_example``` Jekyll plugin, so that we can split the single ```ml.R``` example file into multiple line blocks with different labels, and include them in different algorithms/models in the generated HTML page.
      
      ## How was this patch tested?
      Only docs update, manually check the generated docs.
      
      Author: Yanbo Liang <ybliang8@gmail.com>
      
      Closes #14011 from yanboliang/r-user-guide-update.
      2ad031be
    • Dongjoon Hyun's avatar
      [SPARK-16458][SQL] SessionCatalog should support `listColumns` for temporary tables · 840853ed
      Dongjoon Hyun authored
      ## What changes were proposed in this pull request?
      
      Temporary tables are used frequently, but `spark.catalog.listColumns` does not support those tables. This PR make `SessionCatalog` supports temporary table column listing.
      
      **Before**
      ```scala
      scala> spark.range(10).createOrReplaceTempView("t1")
      
      scala> spark.catalog.listTables().collect()
      res1: Array[org.apache.spark.sql.catalog.Table] = Array(Table[name=`t1`, tableType=`TEMPORARY`, isTemporary=`true`])
      
      scala> spark.catalog.listColumns("t1").collect()
      org.apache.spark.sql.AnalysisException: Table `t1` does not exist in database `default`.;
      ```
      
      **After**
      ```
      scala> spark.catalog.listColumns("t1").collect()
      res2: Array[org.apache.spark.sql.catalog.Column] = Array(Column[name='id', description='id', dataType='bigint', nullable='false', isPartition='false', isBucket='false'])
      ```
      ## How was this patch tested?
      
      Pass the Jenkins tests including a new testcase.
      
      Author: Dongjoon Hyun <dongjoon@apache.org>
      
      Closes #14114 from dongjoon-hyun/SPARK-16458.
      840853ed
    • Reynold Xin's avatar
      [SPARK-16477] Bump master version to 2.1.0-SNAPSHOT · ffcb6e05
      Reynold Xin authored
      ## What changes were proposed in this pull request?
      After SPARK-16476 (committed earlier today as #14128), we can finally bump the version number.
      
      ## How was this patch tested?
      N/A
      
      Author: Reynold Xin <rxin@databricks.com>
      
      Closes #14130 from rxin/SPARK-16477.
      ffcb6e05
    • Dongjoon Hyun's avatar
      [SPARK-16459][SQL] Prevent dropping current database · 7ac79da0
      Dongjoon Hyun authored
      ## What changes were proposed in this pull request?
      
      This PR prevents dropping the current database to avoid errors like the followings.
      
      ```scala
      scala> sql("create database delete_db")
      scala> sql("use delete_db")
      scala> sql("drop database delete_db")
      scala> sql("create table t as select 1")
      org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException: Database `delete_db` not found;
      ```
      
      ## How was this patch tested?
      
      Pass the Jenkins tests including an updated testcase.
      
      Author: Dongjoon Hyun <dongjoon@apache.org>
      
      Closes #14115 from dongjoon-hyun/SPARK-16459.
      7ac79da0
    • Xin Ren's avatar
      [SPARK-16381][SQL][SPARKR] Update SQL examples and programming guide for R language binding · 9cb1eb7a
      Xin Ren authored
      https://issues.apache.org/jira/browse/SPARK-16381
      
      ## What changes were proposed in this pull request?
      
      Update SQL examples and programming guide for R language binding.
      
      Here I just follow example https://github.com/apache/spark/compare/master...liancheng:example-snippet-extraction, created a separate R file to store all the example code.
      
      ## How was this patch tested?
      
      Manual test on my local machine.
      Screenshot as below:
      
      ![screen shot 2016-07-06 at 4 52 25 pm](https://cloud.githubusercontent.com/assets/3925641/16638180/13925a58-439a-11e6-8d57-8451a63dcae9.png)
      
      Author: Xin Ren <iamshrek@126.com>
      
      Closes #14082 from keypointt/SPARK-16381.
      9cb1eb7a
    • gatorsmile's avatar
      [SPARK-16355][SPARK-16354][SQL] Fix Bugs When LIMIT/TABLESAMPLE is Non-foldable, Zero or Negative · e2262789
      gatorsmile authored
      #### What changes were proposed in this pull request?
      **Issue 1:** When a query containing LIMIT/TABLESAMPLE 0, the statistics could be zero. Results are correct but it could cause a huge performance regression. For example,
      ```Scala
      Seq(("one", 1), ("two", 2), ("three", 3), ("four", 4)).toDF("k", "v")
        .createOrReplaceTempView("test")
      val df1 = spark.table("test")
      val df2 = spark.table("test").limit(0)
      val df = df1.join(df2, Seq("k"), "left")
      ```
      The statistics of both `df` and `df2` are zero. The statistics values should never be zero; otherwise `sizeInBytes` of `BinaryNode` will also be zero (product of children). This PR is to increase it to `1` when the num of rows is equal to 0.
      
      **Issue 2:** When a query containing negative LIMIT/TABLESAMPLE, we should issue exceptions. Negative values could break the implementation assumption of multiple parts. For example, statistics calculation.  Below is the example query.
      ```SQL
      SELECT * FROM testData TABLESAMPLE (-1 rows)
      SELECT * FROM testData LIMIT -1
      ```
      This PR is to issue an appropriate exception in this case.
      
      **Issue 3:** Spark SQL follows the restriction of LIMIT clause in Hive. The argument to the LIMIT clause must evaluate to a constant value. It can be a numeric literal, or another kind of numeric expression involving operators, casts, and function return values. You cannot refer to a column or use a subquery. Currently, we do not detect whether the expression in LIMIT clause is foldable or not. If non-foldable, we might issue a strange error message. For example,
      ```SQL
      SELECT * FROM testData LIMIT rand() > 0.2
      ```
      Then, a misleading error message is issued, like
      ```
      assertion failed: No plan for GlobalLimit (_nondeterministic#203 > 0.2)
      +- Project [key#11, value#12, rand(-1441968339187861415) AS _nondeterministic#203]
         +- LocalLimit (_nondeterministic#202 > 0.2)
            +- Project [key#11, value#12, rand(-1308350387169017676) AS _nondeterministic#202]
               +- LogicalRDD [key#11, value#12]
      
      java.lang.AssertionError: assertion failed: No plan for GlobalLimit (_nondeterministic#203 > 0.2)
      +- Project [key#11, value#12, rand(-1441968339187861415) AS _nondeterministic#203]
         +- LocalLimit (_nondeterministic#202 > 0.2)
            +- Project [key#11, value#12, rand(-1308350387169017676) AS _nondeterministic#202]
               +- LogicalRDD [key#11, value#12]
      ```
      This PR detects it and then issues a meaningful error message.
      
      #### How was this patch tested?
      Added test cases.
      
      Author: gatorsmile <gatorsmile@gmail.com>
      
      Closes #14034 from gatorsmile/limit.
      e2262789
    • petermaxlee's avatar
      [SPARK-16318][SQL] Implement all remaining xpath functions · 82f08744
      petermaxlee authored
      ## What changes were proposed in this pull request?
      This patch implements all remaining xpath functions that Hive supports and not natively supported in Spark: xpath_int, xpath_short, xpath_long, xpath_float, xpath_double, xpath_string, and xpath.
      
      ## How was this patch tested?
      Added unit tests and end-to-end tests.
      
      Author: petermaxlee <petermaxlee@gmail.com>
      
      Closes #13991 from petermaxlee/SPARK-16318.
      82f08744
    • Reynold Xin's avatar
      [SPARK-16476] Restructure MimaExcludes for easier union excludes · 52b5bb0b
      Reynold Xin authored
      ## What changes were proposed in this pull request?
      It is currently fairly difficult to have proper mima excludes when we cut a version branch. I'm proposing a small change to take the exclude list out of the exclude function, and put it in a variable so we can easily union excludes.
      
      After this change, we can bump pom.xml version to 2.1.0-SNAPSHOT, without bumping the diff base version. Note that I also deleted all the exclude rules for version 1.x, to cut down the size of the file.
      
      ## How was this patch tested?
      N/A - this is a build infra change.
      
      Author: Reynold Xin <rxin@databricks.com>
      
      Closes #14128 from rxin/SPARK-16476.
      52b5bb0b
  2. Jul 10, 2016
  3. Jul 09, 2016
    • gatorsmile's avatar
      [SPARK-16401][SQL] Data Source API: Enable Extending RelationProvider and... · 7374e518
      gatorsmile authored
      [SPARK-16401][SQL] Data Source API: Enable Extending RelationProvider and CreatableRelationProvider without Extending SchemaRelationProvider
      
      #### What changes were proposed in this pull request?
      When users try to implement a data source API with extending only `RelationProvider` and `CreatableRelationProvider`, they will hit an error when resolving the relation.
      ```Scala
      spark.read
      .format("org.apache.spark.sql.test.DefaultSourceWithoutUserSpecifiedSchema")
        .load()
        .write.
      format("org.apache.spark.sql.test.DefaultSourceWithoutUserSpecifiedSchema")
        .save()
      ```
      
      The error they hit is like
      ```
      org.apache.spark.sql.test.DefaultSourceWithoutUserSpecifiedSchema does not allow user-specified schemas.;
      org.apache.spark.sql.AnalysisException: org.apache.spark.sql.test.DefaultSourceWithoutUserSpecifiedSchema does not allow user-specified schemas.;
      	at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:319)
      	at org.apache.spark.sql.execution.datasources.DataSource.write(DataSource.scala:494)
      	at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:211)
      ```
      
      Actually, the bug fix is simple. [`DataSource.createRelation(sparkSession.sqlContext, mode, options, data)`](https://github.com/gatorsmile/spark/blob/dd644f8117e889cebd6caca58702a7c7e3d88bef/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/DataSource.scala#L429) already returns a BaseRelation. We should not assign schema to `userSpecifiedSchema`. That schema assignment only makes sense for the data sources that extend `FileFormat`.
      
      #### How was this patch tested?
      Added a test case.
      
      Author: gatorsmile <gatorsmile@gmail.com>
      
      Closes #14075 from gatorsmile/dataSource.
      7374e518
  4. Jul 08, 2016
    • Michael Gummelt's avatar
      [SPARK-11857][MESOS] Deprecate fine grained · b1db26ac
      Michael Gummelt authored
      ## What changes were proposed in this pull request?
      
      Documentation changes to indicate that fine-grained mode is now deprecated.  No code changes were made, and all fine-grained mode instructions were left in place.  We can remove all of that once the deprecation cycle completes (Does Spark have a standard deprecation cycle?  One major version?)
      
      Blocked on https://github.com/apache/spark/pull/14059
      
      ## How was this patch tested?
      
      Viewed in Github
      
      Author: Michael Gummelt <mgummelt@mesosphere.io>
      
      Closes #14078 from mgummelt/deprecate-fine-grained.
      b1db26ac
    • Eric Liang's avatar
      [SPARK-16432] Empty blocks fail to serialize due to assert in ChunkedByteBuffer · d8b06f18
      Eric Liang authored
      ## What changes were proposed in this pull request?
      
      It's possible to also change the callers to not pass in empty chunks, but it seems cleaner to just allow `ChunkedByteBuffer` to handle empty arrays. cc JoshRosen
      
      ## How was this patch tested?
      
      Unit tests, also checked that the original reproduction case in https://github.com/apache/spark/pull/11748#issuecomment-230760283 is resolved.
      
      Author: Eric Liang <ekl@databricks.com>
      
      Closes #14099 from ericl/spark-16432.
      d8b06f18
    • Sean Owen's avatar
      [SPARK-16376][WEBUI][SPARK WEB UI][APP-ID] HTTP ERROR 500 when using rest api... · 6cef0183
      Sean Owen authored
      [SPARK-16376][WEBUI][SPARK WEB UI][APP-ID] HTTP ERROR 500 when using rest api "/applications//jobs" if array "stageIds" is empty
      
      ## What changes were proposed in this pull request?
      
      Avoid error finding max of empty Seq when stageIds is empty. It does fix the immediate problem; I don't know if it results in meaningful output, but not an error at least.
      
      ## How was this patch tested?
      
      Jenkins tests
      
      Author: Sean Owen <sowen@cloudera.com>
      
      Closes #14105 from srowen/SPARK-16376.
      6cef0183
    • cody koeninger's avatar
      [SPARK-13569][STREAMING][KAFKA] pattern based topic subscription · fd6e8f0e
      cody koeninger authored
      ## What changes were proposed in this pull request?
      Allow for kafka topic subscriptions based on a regex pattern.
      
      ## How was this patch tested?
      Unit tests, manual tests
      
      Author: cody koeninger <cody@koeninger.org>
      
      Closes #14026 from koeninger/SPARK-13569.
      fd6e8f0e
    • Dongjoon Hyun's avatar
      [SPARK-16387][SQL] JDBC Writer should use dialect to quote field names. · 3b22291b
      Dongjoon Hyun authored
      ## What changes were proposed in this pull request?
      
      Currently, JDBC Writer uses dialects to get datatypes, but doesn't to quote field names. This PR uses dialects to quote the field names, too.
      
      **Reported Error Scenario (MySQL case)**
      ```scala
      scala> val url="jdbc:mysql://localhost:3306/temp"
      scala> val prop = new java.util.Properties
      scala> prop.setProperty("user","root")
      scala> spark.createDataset(Seq("a","b","c")).toDF("order")
      scala> df.write.mode("overwrite").jdbc(url, "temptable", prop)
      ...MySQLSyntaxErrorException: ... near 'order TEXT )
      ```
      
      ## How was this patch tested?
      
      Pass the Jenkins tests and manually do the above case.
      
      Author: Dongjoon Hyun <dongjoon@apache.org>
      
      Closes #14107 from dongjoon-hyun/SPARK-16387.
      3b22291b
    • Yin Huai's avatar
      [SPARK-16453][BUILD] release-build.sh is missing hive-thriftserver for scala 2.10 · 60ba436b
      Yin Huai authored
      ## What changes were proposed in this pull request?
      This PR adds hive-thriftserver profile to scala 2.10 build created by release-build.sh.
      
      Author: Yin Huai <yhuai@databricks.com>
      
      Closes #14108 from yhuai/SPARK-16453.
      60ba436b
    • wujian's avatar
      [SPARK-16281][SQL] Implement parse_url SQL function · f5fef691
      wujian authored
      ## What changes were proposed in this pull request?
      
      This PR adds parse_url SQL functions in order to remove Hive fallback.
      
      A new implementation of #13999
      
      ## How was this patch tested?
      
      Pass the exist tests including new testcases.
      
      Author: wujian <jan.chou.wu@gmail.com>
      
      Closes #14008 from janplus/SPARK-16281.
      f5fef691
    • Dongjoon Hyun's avatar
      [SPARK-16429][SQL] Include `StringType` columns in `describe()` · 142df483
      Dongjoon Hyun authored
      ## What changes were proposed in this pull request?
      
      Currently, Spark `describe` supports `StringType`. However, `describe()` returns a dataset for only all numeric columns. This PR aims to include `StringType` columns in `describe()`, `describe` without argument.
      
      **Background**
      ```scala
      scala> spark.read.json("examples/src/main/resources/people.json").describe("age", "name").show()
      +-------+------------------+-------+
      |summary|               age|   name|
      +-------+------------------+-------+
      |  count|                 2|      3|
      |   mean|              24.5|   null|
      | stddev|7.7781745930520225|   null|
      |    min|                19|   Andy|
      |    max|                30|Michael|
      +-------+------------------+-------+
      ```
      
      **Before**
      ```scala
      scala> spark.read.json("examples/src/main/resources/people.json").describe().show()
      +-------+------------------+
      |summary|               age|
      +-------+------------------+
      |  count|                 2|
      |   mean|              24.5|
      | stddev|7.7781745930520225|
      |    min|                19|
      |    max|                30|
      +-------+------------------+
      ```
      
      **After**
      ```scala
      scala> spark.read.json("examples/src/main/resources/people.json").describe().show()
      +-------+------------------+-------+
      |summary|               age|   name|
      +-------+------------------+-------+
      |  count|                 2|      3|
      |   mean|              24.5|   null|
      | stddev|7.7781745930520225|   null|
      |    min|                19|   Andy|
      |    max|                30|Michael|
      +-------+------------------+-------+
      ```
      
      ## How was this patch tested?
      
      Pass the Jenkins with a update testcase.
      
      Author: Dongjoon Hyun <dongjoon@apache.org>
      
      Closes #14095 from dongjoon-hyun/SPARK-16429.
      142df483
    • Ryan Blue's avatar
      [SPARK-16420] Ensure compression streams are closed. · 67e085ef
      Ryan Blue authored
      ## What changes were proposed in this pull request?
      
      This uses the try/finally pattern to ensure streams are closed after use. `UnsafeShuffleWriter` wasn't closing compression streams, causing them to leak resources until garbage collected. This was causing a problem with codecs that use off-heap memory.
      
      ## How was this patch tested?
      
      Current tests are sufficient. This should not change behavior.
      
      Author: Ryan Blue <blue@apache.org>
      
      Closes #14093 from rdblue/SPARK-16420-unsafe-shuffle-writer-leak.
      67e085ef
    • Jurriaan Pruis's avatar
      [SPARK-13638][SQL] Add quoteAll option to CSV DataFrameWriter · 38cf8f2a
      Jurriaan Pruis authored
      ## What changes were proposed in this pull request?
      
      Adds an quoteAll option for writing CSV which will quote all fields.
      See https://issues.apache.org/jira/browse/SPARK-13638
      
      ## How was this patch tested?
      
      Added a test to verify the output columns are quoted for all fields in the Dataframe
      
      Author: Jurriaan Pruis <email@jurriaanpruis.nl>
      
      Closes #13374 from jurriaan/csv-quote-all.
      38cf8f2a
    • Xusen Yin's avatar
      [SPARK-16369][MLLIB] tallSkinnyQR of RowMatrix should aware of empty partition · 255d74fe
      Xusen Yin authored
      ## What changes were proposed in this pull request?
      
      tallSkinnyQR of RowMatrix should aware of empty partition, which could cause exception from Breeze qr decomposition.
      
      See the [archived dev mail](https://mail-archives.apache.org/mod_mbox/spark-dev/201510.mbox/%3CCAF7ADNrycvPL3qX-VZJhq4OYmiUUhoscut_tkOm63Cm18iK1tQmail.gmail.com%3E) for more details.
      
      ## How was this patch tested?
      
      Scala unit test.
      
      Author: Xusen Yin <yinxusen@gmail.com>
      
      Closes #14049 from yinxusen/SPARK-16369.
      255d74fe
    • Dongjoon Hyun's avatar
      [SPARK-16285][SQL] Implement sentences SQL functions · a54438cb
      Dongjoon Hyun authored
      ## What changes were proposed in this pull request?
      
      This PR implements `sentences` SQL function.
      
      ## How was this patch tested?
      
      Pass the Jenkins tests with a new testcase.
      
      Author: Dongjoon Hyun <dongjoon@apache.org>
      
      Closes #14004 from dongjoon-hyun/SPARK_16285.
      a54438cb
    • petermaxlee's avatar
      [SPARK-16436][SQL] checkEvaluation should support NaN · 8228b063
      petermaxlee authored
      ## What changes were proposed in this pull request?
      This small patch modifies ExpressionEvalHelper. checkEvaluation to support comparing NaN values for floating point comparisons.
      
      ## How was this patch tested?
      This is a test harness change.
      
      Author: petermaxlee <petermaxlee@gmail.com>
      
      Closes #14103 from petermaxlee/SPARK-16436.
      8228b063
    • Dongjoon Hyun's avatar
      [SPARK-16052][SQL] Improve `CollapseRepartition` optimizer for Repartition/RepartitionBy · dff73bfa
      Dongjoon Hyun authored
      ## What changes were proposed in this pull request?
      
      This PR improves `CollapseRepartition` to optimize the adjacent combinations of **Repartition** and **RepartitionBy**. Also, this PR adds a testsuite for this optimizer.
      
      **Target Scenario**
      ```scala
      scala> val dsView1 = spark.range(8).repartition(8, $"id")
      scala> dsView1.createOrReplaceTempView("dsView1")
      scala> sql("select id from dsView1 distribute by id").explain(true)
      ```
      
      **Before**
      ```scala
      scala> sql("select id from dsView1 distribute by id").explain(true)
      == Parsed Logical Plan ==
      'RepartitionByExpression ['id]
      +- 'Project ['id]
         +- 'UnresolvedRelation `dsView1`
      
      == Analyzed Logical Plan ==
      id: bigint
      RepartitionByExpression [id#0L]
      +- Project [id#0L]
         +- SubqueryAlias dsview1
            +- RepartitionByExpression [id#0L], 8
               +- Range (0, 8, splits=8)
      
      == Optimized Logical Plan ==
      RepartitionByExpression [id#0L]
      +- RepartitionByExpression [id#0L], 8
         +- Range (0, 8, splits=8)
      
      == Physical Plan ==
      Exchange hashpartitioning(id#0L, 200)
      +- Exchange hashpartitioning(id#0L, 8)
         +- *Range (0, 8, splits=8)
      ```
      
      **After**
      ```scala
      scala> sql("select id from dsView1 distribute by id").explain(true)
      == Parsed Logical Plan ==
      'RepartitionByExpression ['id]
      +- 'Project ['id]
         +- 'UnresolvedRelation `dsView1`
      
      == Analyzed Logical Plan ==
      id: bigint
      RepartitionByExpression [id#0L]
      +- Project [id#0L]
         +- SubqueryAlias dsview1
            +- RepartitionByExpression [id#0L], 8
               +- Range (0, 8, splits=8)
      
      == Optimized Logical Plan ==
      RepartitionByExpression [id#0L]
      +- Range (0, 8, splits=8)
      
      == Physical Plan ==
      Exchange hashpartitioning(id#0L, 200)
      +- *Range (0, 8, splits=8)
      ```
      
      ## How was this patch tested?
      
      Pass the Jenkins tests (including a new testsuite).
      
      Author: Dongjoon Hyun <dongjoon@apache.org>
      
      Closes #13765 from dongjoon-hyun/SPARK-16052.
      dff73bfa
    • Tathagata Das's avatar
      [SPARK-16430][SQL][STREAMING] Add option maxFilesPerTrigger · 5bce4580
      Tathagata Das authored
      ## What changes were proposed in this pull request?
      
      An option that limits the file stream source to read 1 file at a time enables rate limiting. It has the additional convenience that a static set of files can be used like a stream for testing as this will allows those files to be considered one at a time.
      
      This PR adds option `maxFilesPerTrigger`.
      
      ## How was this patch tested?
      
      New unit test
      
      Author: Tathagata Das <tathagata.das1565@gmail.com>
      
      Closes #14094 from tdas/SPARK-16430.
      5bce4580
  5. Jul 07, 2016
    • Dongjoon Hyun's avatar
      [SPARK-16425][R] `describe()` should not fail with non-numeric columns · 6aa7d09f
      Dongjoon Hyun authored
      ## What changes were proposed in this pull request?
      
      This PR prevents ERRORs when `summary(df)` is called for `SparkDataFrame` with not-numeric columns. This failure happens only in `SparkR`.
      
      **Before**
      ```r
      > df <- createDataFrame(faithful)
      > df <- withColumn(df, "boolean", df$waiting==79)
      > summary(df)
      16/07/07 14:15:16 ERROR RBackendHandler: describe on 34 failed
      Error in invokeJava(isStatic = FALSE, objId$id, methodName, ...) :
        org.apache.spark.sql.AnalysisException: cannot resolve 'avg(`boolean`)' due to data type mismatch: function average requires numeric types, not BooleanType;
      ```
      
      **After**
      ```r
      > df <- createDataFrame(faithful)
      > df <- withColumn(df, "boolean", df$waiting==79)
      > summary(df)
      SparkDataFrame[summary:string, eruptions:string, waiting:string]
      ```
      
      ## How was this patch tested?
      
      Pass the Jenkins with a updated testcase.
      
      Author: Dongjoon Hyun <dongjoon@apache.org>
      
      Closes #14096 from dongjoon-hyun/SPARK-16425.
      6aa7d09f
    • Felix Cheung's avatar
      [SPARK-16310][SPARKR] R na.string-like default for csv source · f4767bcc
      Felix Cheung authored
      ## What changes were proposed in this pull request?
      
      Apply default "NA" as null string for R, like R read.csv na.string parameter.
      
      https://stat.ethz.ch/R-manual/R-devel/library/utils/html/read.table.html
      na.strings = "NA"
      
      An user passing a csv file with NA value should get the same behavior with SparkR read.df(... source = "csv")
      
      (couldn't open JIRA, will do that later)
      
      ## How was this patch tested?
      
      unit tests
      
      shivaram
      
      Author: Felix Cheung <felixcheung_m@hotmail.com>
      
      Closes #13984 from felixcheung/rcsvnastring.
      f4767bcc
    • Daoyuan Wang's avatar
      [SPARK-16415][SQL] fix catalog string error · 28710b42
      Daoyuan Wang authored
      ## What changes were proposed in this pull request?
      
      In #13537 we truncate `simpleString` if it is a long `StructType`. But sometimes we need `catalogString` to reconstruct `TypeInfo`, for example in description of [SPARK-16415 ](https://issues.apache.org/jira/browse/SPARK-16415). So we need to keep the implementation of `catalogString` not affected by our truncate.
      
      ## How was this patch tested?
      
      added a test case.
      
      Author: Daoyuan Wang <daoyuan.wang@intel.com>
      
      Closes #14089 from adrian-wang/catalogstring.
      28710b42
    • Liwei Lin's avatar
      [SPARK-16350][SQL] Fix support for incremental planning in wirteStream.foreach() · 0f7175de
      Liwei Lin authored
      ## What changes were proposed in this pull request?
      
      There are cases where `complete` output mode does not output updated aggregated value; for details please refer to [SPARK-16350](https://issues.apache.org/jira/browse/SPARK-16350).
      
      The cause is that, as we do `data.as[T].foreachPartition { iter => ... }` in `ForeachSink.addBatch()`, `foreachPartition()` does not support incremental planning for now.
      
      This patches makes `foreachPartition()` support incremental planning in `ForeachSink`, by making a special version of `Dataset` with its `rdd()` method supporting incremental planning.
      
      ## How was this patch tested?
      
      Added a unit test which failed before the change
      
      Author: Liwei Lin <lwlin7@gmail.com>
      
      Closes #14030 from lw-lin/fix-foreach-complete.
      0f7175de
    • Dongjoon Hyun's avatar
      [SPARK-16174][SQL] Improve `OptimizeIn` optimizer to remove literal repetitions · a04cab8f
      Dongjoon Hyun authored
      ## What changes were proposed in this pull request?
      
      This PR improves `OptimizeIn` optimizer to remove the literal repetitions from SQL `IN` predicates. This optimizer prevents user mistakes and also can optimize some queries like [TPCDS-36](https://github.com/apache/spark/blob/master/sql/core/src/test/resources/tpcds/q36.sql#L19).
      
      **Before**
      ```scala
      scala> sql("select state from (select explode(array('CA','TN')) state) where state in ('TN','TN','TN','TN','TN','TN','TN')").explain
      == Physical Plan ==
      *Filter state#6 IN (TN,TN,TN,TN,TN,TN,TN)
      +- Generate explode([CA,TN]), false, false, [state#6]
         +- Scan OneRowRelation[]
      ```
      
      **After**
      ```scala
      scala> sql("select state from (select explode(array('CA','TN')) state) where state in ('TN','TN','TN','TN','TN','TN','TN')").explain
      == Physical Plan ==
      *Filter state#6 IN (TN)
      +- Generate explode([CA,TN]), false, false, [state#6]
         +- Scan OneRowRelation[]
      ```
      
      ## How was this patch tested?
      
      Pass the Jenkins tests (including a new testcase).
      
      Author: Dongjoon Hyun <dongjoon@apache.org>
      
      Closes #13876 from dongjoon-hyun/SPARK-16174.
      a04cab8f
    • MechCoder's avatar
      [SPARK-16399][PYSPARK] Force PYSPARK_PYTHON to python · 6343f665
      MechCoder authored
      ## What changes were proposed in this pull request?
      
      I would like to change
      
      ```bash
      if hash python2.7 2>/dev/null; then
        # Attempt to use Python 2.7, if installed:
        DEFAULT_PYTHON="python2.7"
      else
        DEFAULT_PYTHON="python"
      fi
      ```
      
      to just ```DEFAULT_PYTHON="python"```
      
      I'm not sure if it is a great assumption that python2.7 is used by default, when python points to something else.
      
      ## How was this patch tested?
      
      (Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
      
      (If this patch involves UI changes, please attach a screenshot; otherwise, remove this)
      
      Author: MechCoder <mks542@nyu.edu>
      
      Closes #14016 from MechCoder/followup.
      6343f665
    • Xusen Yin's avatar
      [SPARK-16372][MLLIB] Retag RDD to tallSkinnyQR of RowMatrix · 4c6f00d0
      Xusen Yin authored
      ## What changes were proposed in this pull request?
      
      The following Java code because of type erasing:
      
      ```Java
      JavaRDD<Vector> rows = jsc.parallelize(...);
      RowMatrix mat = new RowMatrix(rows.rdd());
      QRDecomposition<RowMatrix, Matrix> result = mat.tallSkinnyQR(true);
      ```
      
      We should use retag to restore the type to prevent the following exception:
      
      ```Java
      java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Lorg.apache.spark.mllib.linalg.Vector;
      ```
      
      ## How was this patch tested?
      
      Java unit test
      
      Author: Xusen Yin <yinxusen@gmail.com>
      
      Closes #14051 from yinxusen/SPARK-16372.
      4c6f00d0
    • Reynold Xin's avatar
      [SPARK-16400][SQL] Remove InSet filter pushdown from Parquet · 986b2514
      Reynold Xin authored
      ## What changes were proposed in this pull request?
      This patch removes InSet filter pushdown from Parquet data source, since row-based pushdown is not beneficial to Spark and brings extra complexity to the code base.
      
      ## How was this patch tested?
      N/A
      
      Author: Reynold Xin <rxin@databricks.com>
      
      Closes #14076 from rxin/SPARK-16400.
      986b2514
    • gatorsmile's avatar
      [SPARK-16368][SQL] Fix Strange Errors When Creating View With Unmatched Column Num · ab05db0b
      gatorsmile authored
      #### What changes were proposed in this pull request?
      When creating a view, a common user error is the number of columns produced by the `SELECT` clause does not match the number of column names specified by `CREATE VIEW`.
      
      For example, given Table `t1` only has 3 columns
      ```SQL
      create view v1(col2, col4, col3, col5) as select * from t1
      ```
      Currently, Spark SQL reports the following error:
      ```
      requirement failed
      java.lang.IllegalArgumentException: requirement failed
      	at scala.Predef$.require(Predef.scala:212)
      	at org.apache.spark.sql.execution.command.CreateViewCommand.run(views.scala:90)
      ```
      
      This error message is very confusing. This PR is to detect the error and issue a meaningful error message.
      
      #### How was this patch tested?
      Added test cases
      
      Author: gatorsmile <gatorsmile@gmail.com>
      
      Closes #14047 from gatorsmile/viewMismatchedColumns.
      ab05db0b
    • Tom Magrino's avatar
      [SPARK-15885][WEB UI] Provide links to executor logs from stage details page in UI · ce3ea969
      Tom Magrino authored
      ## What changes were proposed in this pull request?
      
      This moves over old PR https://github.com/apache/spark/pull/13664 to target master rather than branch-1.6.
      
      Added links to logs (or an indication that there are no logs) for entries which list an executor in the stage details page of the UI.
      
      This helps streamline the workflow where a user views a stage details page and determines that they would like to see the associated executor log for further examination.  Previously, a user would have to cross reference the executor id listed on the stage details page with the corresponding entry on the executors tab.
      
      Link to the JIRA: https://issues.apache.org/jira/browse/SPARK-15885
      
      ## How was this patch tested?
      
      Ran existing unit tests.
      Ran test queries on a platform which did not record executor logs and again on a platform which did record executor logs and verified that the new table column was empty and links to the logs (which were verified as linking to the appropriate files), respectively.
      
      Attached is a screenshot of the UI page with no links, with the new columns highlighted.  Additional screenshot of these columns with the populated links.
      
      Without links:
      ![updated without logs](https://cloud.githubusercontent.com/assets/1450821/16059721/2b69dbaa-3239-11e6-9eed-e539764ca159.png)
      
      With links:
      ![updated with logs](https://cloud.githubusercontent.com/assets/1450821/16059725/32c6e316-3239-11e6-90bd-2553f43f7779.png)
      
      This contribution is my original work and I license the work to the project under the Apache Spark project's open source license.
      
      Author: Tom Magrino <tmagrino@fb.com>
      
      Closes #13861 from tmagrino/uilogstweak.
      ce3ea969
    • Shixiong Zhu's avatar
      [SPARK-16021][TEST-MAVEN] Fix the maven build · 4b5a72c7
      Shixiong Zhu authored
      ## What changes were proposed in this pull request?
      
      Fixed the maven build for #13983
      
      ## How was this patch tested?
      
      The existing tests.
      
      Author: Shixiong Zhu <shixiong@databricks.com>
      
      Closes #14084 from zsxwing/fix-maven.
      4b5a72c7
    • MasterDDT's avatar
      [SPARK-16398][CORE] Make cancelJob and cancelStage APIs public · 69f53914
      MasterDDT authored
      ## What changes were proposed in this pull request?
      
      Make SparkContext `cancelJob` and `cancelStage` APIs public. This allows applications to use `SparkListener` to do their own management of jobs via events, but without using the REST API.
      
      ## How was this patch tested?
      
      Existing tests (dev/run-tests)
      
      Author: MasterDDT <miteshp@live.com>
      
      Closes #14072 from MasterDDT/SPARK-16398.
      69f53914
  6. Jul 06, 2016
    • gatorsmile's avatar
      [SPARK-16374][SQL] Remove Alias from MetastoreRelation and SimpleCatalogRelation · 42279bff
      gatorsmile authored
      #### What changes were proposed in this pull request?
      Different from the other leaf nodes, `MetastoreRelation` and `SimpleCatalogRelation` have a pre-defined `alias`, which is used to change the qualifier of the node. However, based on the existing alias handling, alias should be put in `SubqueryAlias`.
      
      This PR is to separate alias handling from `MetastoreRelation` and `SimpleCatalogRelation` to make it consistent with the other nodes. It simplifies the signature and conversion to a `BaseRelation`.
      
      For example, below is an example query for `MetastoreRelation`,  which is converted to a `LogicalRelation`:
      ```SQL
      SELECT tmp.a + 1 FROM test_parquet_ctas tmp WHERE tmp.a > 2
      ```
      
      Before changes, the analyzed plan is
      ```
      == Analyzed Logical Plan ==
      (a + 1): int
      Project [(a#951 + 1) AS (a + 1)#952]
      +- Filter (a#951 > 2)
         +- SubqueryAlias tmp
            +- Relation[a#951] parquet
      ```
      After changes, the analyzed plan becomes
      ```
      == Analyzed Logical Plan ==
      (a + 1): int
      Project [(a#951 + 1) AS (a + 1)#952]
      +- Filter (a#951 > 2)
         +- SubqueryAlias tmp
            +- SubqueryAlias test_parquet_ctas
               +- Relation[a#951] parquet
      ```
      
      **Note: the optimized plans are the same.**
      
      For `SimpleCatalogRelation`, the existing code always generates two Subqueries. Thus, no change is needed.
      
      #### How was this patch tested?
      Added test cases.
      
      Author: gatorsmile <gatorsmile@gmail.com>
      
      Closes #14053 from gatorsmile/removeAliasFromMetastoreRelation.
      42279bff
    • hyukjinkwon's avatar
      [SPARK-14839][SQL] Support for other types for `tableProperty` rule in SQL syntax · 34283de1
      hyukjinkwon authored
      ## What changes were proposed in this pull request?
      
      Currently, Scala API supports to take options with the types, `String`, `Long`, `Double` and `Boolean` and Python API also supports other types.
      
      This PR corrects `tableProperty` rule to support other types (string, boolean, double and integer) so that support the options for data sources in a consistent way. This will affect other rules such as DBPROPERTIES and TBLPROPERTIES (allowing other types as values).
      
      Also, `TODO add bucketing and partitioning.` was removed because it was resolved in https://github.com/apache/spark/commit/24bea000476cdd0b43be5160a76bc5b170ef0b42
      
      ## How was this patch tested?
      
      Unit test in `MetastoreDataSourcesSuite.scala`.
      
      Author: hyukjinkwon <gurwls223@gmail.com>
      
      Closes #13517 from HyukjinKwon/SPARK-14839.
      34283de1
Loading