Skip to content
Snippets Groups Projects
  1. Aug 30, 2016
    • frreiss's avatar
      [SPARK-17303] Added spark-warehouse to dev/.rat-excludes · 8fb445d9
      frreiss authored
      ## What changes were proposed in this pull request?
      
      Excludes the `spark-warehouse` directory from the Apache RAT checks that src/run-tests performs. `spark-warehouse` is created by some of the Spark SQL tests, as well as by `bin/spark-sql`.
      
      ## How was this patch tested?
      
      Ran src/run-tests twice. The second time, the script failed because the first iteration
      Made the change in this PR.
      Ran src/run-tests a third time; RAT checks succeeded.
      
      Author: frreiss <frreiss@us.ibm.com>
      
      Closes #14870 from frreiss/fred-17303.
      8fb445d9
  2. Aug 29, 2016
    • Josh Rosen's avatar
      [SPARK-17301][SQL] Remove unused classTag field from AtomicType base class · 48b459dd
      Josh Rosen authored
      There's an unused `classTag` val in the AtomicType base class which is causing unnecessary slowness in deserialization because it needs to grab ScalaReflectionLock and create a new runtime reflection mirror. Removing this unused code gives a small but measurable performance boost in SQL task deserialization.
      
      Author: Josh Rosen <joshrosen@databricks.com>
      
      Closes #14869 from JoshRosen/remove-unused-classtag.
      48b459dd
    • Shivaram Venkataraman's avatar
      [SPARK-16581][SPARKR] Make JVM backend calling functions public · 736a7911
      Shivaram Venkataraman authored
      ## What changes were proposed in this pull request?
      
      This change exposes a public API in SparkR to create objects, call methods on the Spark driver JVM
      
      ## How was this patch tested?
      
      (Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
      
      Unit tests, CRAN checks
      
      Author: Shivaram Venkataraman <shivaram@cs.berkeley.edu>
      
      Closes #14775 from shivaram/sparkr-java-api.
      736a7911
    • Davies Liu's avatar
      [SPARK-17063] [SQL] Improve performance of MSCK REPAIR TABLE with Hive metastore · 48caec25
      Davies Liu authored
      ## What changes were proposed in this pull request?
      
      This PR split the the single `createPartitions()` call into smaller batches, which could prevent Hive metastore from OOM (caused by millions of partitions).
      
      It will also try to gather all the fast stats (number of files and total size of all files) in parallel to avoid the bottle neck of listing the files in metastore sequential, which is controlled by spark.sql.gatherFastStats (enabled by default).
      
      ## How was this patch tested?
      
      Tested locally with 10000 partitions and 100 files with embedded metastore, without gathering fast stats in parallel, adding partitions took 153 seconds, after enable that, gathering the fast stats took about 34 seconds, adding these partitions took 25 seconds (most of the time spent in object store), 59 seconds in total, 2.5X faster (with larger cluster, gathering will much faster).
      
      Author: Davies Liu <davies@databricks.com>
      
      Closes #14607 from davies/repair_batch.
      48caec25
    • Junyang Qian's avatar
      [SPARKR][MINOR] Fix LDA doc · 6a0fda2c
      Junyang Qian authored
      ## What changes were proposed in this pull request?
      
      This PR tries to fix the name of the `SparkDataFrame` used in the example. Also, it gives a reference url of an example data file so that users can play with.
      
      ## How was this patch tested?
      
      Manual test.
      
      Author: Junyang Qian <junyangq@databricks.com>
      
      Closes #14853 from junyangq/SPARKR-FixLDADoc.
      6a0fda2c
    • Seigneurin, Alexis (CONT)'s avatar
      fixed a typo · 08913ce0
      Seigneurin, Alexis (CONT) authored
      idempotant -> idempotent
      
      Author: Seigneurin, Alexis (CONT) <Alexis.Seigneurin@capitalone.com>
      
      Closes #14833 from aseigneurin/fix-typo.
      08913ce0
    • Sean Owen's avatar
      [BUILD] Closes some stale PRs. · 1a48c004
      Sean Owen authored
      ## What changes were proposed in this pull request?
      
      Closes #10995
      Closes #13658
      Closes #14505
      Closes #14536
      Closes #12753
      Closes #14449
      Closes #12694
      Closes #12695
      Closes #14810
      Closes #10572
      
      ## How was this patch tested?
      
      N/A
      
      Author: Sean Owen <sowen@cloudera.com>
      
      Closes #14849 from srowen/CloseStalePRs.
      1a48c004
  3. Aug 28, 2016
    • Tejas Patil's avatar
      [SPARK-17271][SQL] Planner adds un-necessary Sort even if child ordering is... · 095862a3
      Tejas Patil authored
      [SPARK-17271][SQL] Planner adds un-necessary Sort even if child ordering is semantically same as required ordering
      
      ## What changes were proposed in this pull request?
      
      Jira : https://issues.apache.org/jira/browse/SPARK-17271
      
      Planner is adding un-needed SORT operation due to bug in the way comparison for `SortOrder` is done at https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/EnsureRequirements.scala#L253
      `SortOrder` needs to be compared semantically because `Expression` within two `SortOrder` can be "semantically equal" but not literally equal objects.
      
      eg. In case of `sql("SELECT * FROM table1 a JOIN table2 b ON a.col1=b.col1")`
      
      Expression in required SortOrder:
      ```
            AttributeReference(
              name = "col1",
              dataType = LongType,
              nullable = false
            ) (exprId = exprId,
              qualifier = Some("a")
            )
      ```
      
      Expression in child SortOrder:
      ```
            AttributeReference(
              name = "col1",
              dataType = LongType,
              nullable = false
            ) (exprId = exprId)
      ```
      
      Notice that the output column has a qualifier but the child attribute does not but the inherent expression is the same and hence in this case we can say that the child satisfies the required sort order.
      
      This PR includes following changes:
      - Added a `semanticEquals` method to `SortOrder` so that it can compare underlying child expressions semantically (and not using default Object.equals)
      - Fixed `EnsureRequirements` to use semantic comparison of SortOrder
      
      ## How was this patch tested?
      
      - Added a test case to `PlannerSuite`. Ran rest tests in `PlannerSuite`
      
      Author: Tejas Patil <tejasp@fb.com>
      
      Closes #14841 from tejasapatil/SPARK-17271_sort_order_equals_bug.
      095862a3
  4. Aug 27, 2016
  5. Aug 26, 2016
    • Reynold Xin's avatar
      [SPARK-17270][SQL] Move object optimization rules into its own file · cc0caa69
      Reynold Xin authored
      ## What changes were proposed in this pull request?
      As part of breaking Optimizer.scala apart, this patch moves various Dataset object optimization rules into a single file. I'm submitting separate pull requests so we can more easily merge this in branch-2.0 to simplify optimizer backports.
      
      ## How was this patch tested?
      This should be covered by existing tests.
      
      Author: Reynold Xin <rxin@databricks.com>
      
      Closes #14839 from rxin/SPARK-17270.
      cc0caa69
    • Yin Huai's avatar
      [SPARK-17266][TEST] Add empty strings to the regressionTests of PrefixComparatorsSuite · a6bca3ad
      Yin Huai authored
      ## What changes were proposed in this pull request?
      This PR adds a regression test to PrefixComparatorsSuite's "String prefix comparator" because this test failed on jenkins once (https://amplab.cs.berkeley.edu/jenkins/job/spark-master-test-sbt-hadoop-2.4/1620/testReport/junit/org.apache.spark.util.collection.unsafe.sort/PrefixComparatorsSuite/String_prefix_comparator/).
      
      I could not reproduce it locally. But, let's this test case in the regressionTests.
      
      Author: Yin Huai <yhuai@databricks.com>
      
      Closes #14837 from yhuai/SPARK-17266.
      a6bca3ad
    • Sameer Agarwal's avatar
      [SPARK-17244] Catalyst should not pushdown non-deterministic join conditions · 540e9128
      Sameer Agarwal authored
      ## What changes were proposed in this pull request?
      
      Given that non-deterministic expressions can be stateful, pushing them down the query plan during the optimization phase can cause incorrect behavior. This patch fixes that issue by explicitly disabling that.
      
      ## How was this patch tested?
      
      A new test in `FilterPushdownSuite` that checks catalyst behavior for both deterministic and non-deterministic join conditions.
      
      Author: Sameer Agarwal <sameerag@cs.berkeley.edu>
      
      Closes #14815 from sameeragarwal/constraint-inputfile.
      540e9128
    • petermaxlee's avatar
      [SPARK-17235][SQL] Support purging of old logs in MetadataLog · f64a1ddd
      petermaxlee authored
      ## What changes were proposed in this pull request?
      This patch adds a purge interface to MetadataLog, and an implementation in HDFSMetadataLog. The purge function is currently unused, but I will use it to purge old execution and file source logs in follow-up patches. These changes are required in a production structured streaming job that runs for a long period of time.
      
      ## How was this patch tested?
      Added a unit test case in HDFSMetadataLogSuite.
      
      Author: petermaxlee <petermaxlee@gmail.com>
      
      Closes #14802 from petermaxlee/SPARK-17235.
      f64a1ddd
    • Herman van Hovell's avatar
      [SPARK-17246][SQL] Add BigDecimal literal · a11d10f1
      Herman van Hovell authored
      ## What changes were proposed in this pull request?
      This PR adds parser support for `BigDecimal` literals. If you append the suffix `BD` to a valid number then this will be interpreted as a `BigDecimal`, for example `12.0E10BD` will interpreted into a BigDecimal with scale -9 and precision 3. This is useful in situations where you need exact values.
      
      ## How was this patch tested?
      Added tests to `ExpressionParserSuite`, `ExpressionSQLBuilderSuite` and `SQLQueryTestSuite`.
      
      Author: Herman van Hovell <hvanhovell@databricks.com>
      
      Closes #14819 from hvanhovell/SPARK-17246.
      a11d10f1
    • Michael Gummelt's avatar
      [SPARK-16967] move mesos to module · 8e5475be
      Michael Gummelt authored
      ## What changes were proposed in this pull request?
      
      Move Mesos code into a mvn module
      
      ## How was this patch tested?
      
      unit tests
      manually submitting a client mode and cluster mode job
      spark/mesos integration test suite
      
      Author: Michael Gummelt <mgummelt@mesosphere.io>
      
      Closes #14637 from mgummelt/mesos-module.
      8e5475be
    • Peng, Meng's avatar
      [SPARK-17207][MLLIB] fix comparing Vector bug in TestingUtils · c0949dc9
      Peng, Meng authored
      ## What changes were proposed in this pull request?
      
      fix comparing Vector bug in TestingUtils.
      There is the same bug for Matrix comparing. How to check the length of Matrix should be discussed first.
      
      ## 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: Peng, Meng <peng.meng@intel.com>
      
      Closes #14785 from mpjlu/testUtils.
      c0949dc9
    • petermaxlee's avatar
      [SPARK-17165][SQL] FileStreamSource should not track the list of seen files indefinitely · 9812f7d5
      petermaxlee authored
      ## What changes were proposed in this pull request?
      Before this change, FileStreamSource uses an in-memory hash set to track the list of files processed by the engine. The list can grow indefinitely, leading to OOM or overflow of the hash set.
      
      This patch introduces a new user-defined option called "maxFileAge", default to 24 hours. If a file is older than this age, FileStreamSource will purge it from the in-memory map that was used to track the list of files that have been processed.
      
      ## How was this patch tested?
      Added unit tests for the underlying utility, and also added an end-to-end test to validate the purge in FileStreamSourceSuite. Also verified the new test cases would fail when the timeout was set to a very large number.
      
      Author: petermaxlee <petermaxlee@gmail.com>
      
      Closes #14728 from petermaxlee/SPARK-17165.
      9812f7d5
    • gatorsmile's avatar
      [SPARK-17250][SQL] Remove HiveClient and setCurrentDatabase from HiveSessionCatalog · 261c55dd
      gatorsmile authored
      ### What changes were proposed in this pull request?
      This is the first step to remove `HiveClient` from `HiveSessionState`. In the metastore interaction, we always use the fully qualified table name when accessing/operating a table. That means, we always specify the database. Thus, it is not necessary to use `HiveClient` to change the active database in Hive metastore.
      
      In `HiveSessionCatalog `, `setCurrentDatabase` is the only function that uses `HiveClient`. Thus, we can remove it after removing `setCurrentDatabase`
      
      ### How was this patch tested?
      The existing test cases.
      
      Author: gatorsmile <gatorsmile@gmail.com>
      
      Closes #14821 from gatorsmile/setCurrentDB.
      261c55dd
    • gatorsmile's avatar
      [SPARK-17192][SQL] Issue Exception when Users Specify the Partitioning Columns... · fd4ba3f6
      gatorsmile authored
      [SPARK-17192][SQL] Issue Exception when Users Specify the Partitioning Columns without a Given Schema
      
      ### What changes were proposed in this pull request?
      Address the comments by yhuai in the original PR: https://github.com/apache/spark/pull/14207
      
      First, issue an exception instead of logging a warning when users specify the partitioning columns without a given schema.
      
      Second, refactor the codes a little.
      
      ### How was this patch tested?
      Fixed the test cases.
      
      Author: gatorsmile <gatorsmile@gmail.com>
      
      Closes #14572 from gatorsmile/followup16552.
      fd4ba3f6
    • Junyang Qian's avatar
      [SPARKR][MINOR] Fix example of spark.naiveBayes · 18832162
      Junyang Qian authored
      ## What changes were proposed in this pull request?
      
      The original example doesn't work because the features are not categorical. This PR fixes this by changing to another dataset.
      
      ## How was this patch tested?
      
      Manual test.
      
      Author: Junyang Qian <junyangq@databricks.com>
      
      Closes #14820 from junyangq/SPARK-FixNaiveBayes.
      18832162
    • Wenchen Fan's avatar
      [SPARK-17187][SQL][FOLLOW-UP] improve document of TypedImperativeAggregate · 970ab8f6
      Wenchen Fan authored
      ## What changes were proposed in this pull request?
      
      improve the document to make it easier to understand and also mention window operator.
      
      ## How was this patch tested?
      
      N/A
      
      Author: Wenchen Fan <wenchen@databricks.com>
      
      Closes #14822 from cloud-fan/object-agg.
      970ab8f6
    • Wenchen Fan's avatar
      [SPARK-17260][MINOR] move CreateTables to HiveStrategies · 28ab1792
      Wenchen Fan authored
      ## What changes were proposed in this pull request?
      
      `CreateTables` rule turns a general `CreateTable` plan to `CreateHiveTableAsSelectCommand` for hive serde table. However, this rule is logically a planner strategy, we should move it to `HiveStrategies`, to be consistent with other DDL commands.
      
      ## How was this patch tested?
      
      existing tests.
      
      Author: Wenchen Fan <wenchen@databricks.com>
      
      Closes #14825 from cloud-fan/ctas.
      28ab1792
    • hyukjinkwon's avatar
      [SPARK-16216][SQL][FOLLOWUP] Enable timestamp type tests for JSON and verify... · 6063d596
      hyukjinkwon authored
      [SPARK-16216][SQL][FOLLOWUP] Enable timestamp type tests for JSON and verify all unsupported types in CSV
      
      ## What changes were proposed in this pull request?
      
      This PR enables the tests for `TimestampType` for JSON and unifies the logics for verifying schema when writing in CSV.
      
      In more details, this PR,
      
      - Enables the tests for `TimestampType` for JSON and
      
        This was disabled due to an issue in `DatatypeConverter.parseDateTime` which parses dates incorrectly, for example as below:
      
        ```scala
         val d = javax.xml.bind.DatatypeConverter.parseDateTime("0900-01-01T00:00:00.000").getTime
        println(d.toString)
        ```
        ```
        Fri Dec 28 00:00:00 KST 899
        ```
      
        However, since we use `FastDateFormat`, it seems we are safe now.
      
        ```scala
        val d = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("0900-01-01T00:00:00.000")
        println(d)
        ```
        ```
        Tue Jan 01 00:00:00 PST 900
        ```
      
      - Verifies all unsupported types in CSV
      
        There is a separate logics to verify the schemas in `CSVFileFormat`. This is actually not quite correct enough because we don't support `NullType` and `CalanderIntervalType` as well `StructType`, `ArrayType`, `MapType`. So, this PR adds both types.
      
      ## How was this patch tested?
      
      Tests in `JsonHadoopFsRelation` and `CSVSuite`
      
      Author: hyukjinkwon <gurwls223@gmail.com>
      
      Closes #14829 from HyukjinKwon/SPARK-16216-followup.
      6063d596
  6. Aug 25, 2016
    • Shixiong Zhu's avatar
      [SPARK-17242][DOCUMENT] Update links of external dstream projects · 341e0e77
      Shixiong Zhu authored
      ## What changes were proposed in this pull request?
      
      Updated links of external dstream projects.
      
      ## How was this patch tested?
      
      Just document changes.
      
      Author: Shixiong Zhu <shixiong@databricks.com>
      
      Closes #14814 from zsxwing/dstream-link.
      341e0e77
    • hyukjinkwon's avatar
      [SPARK-17212][SQL] TypeCoercion supports widening conversion between DateType and TimestampType · b964a172
      hyukjinkwon authored
      ## What changes were proposed in this pull request?
      
      Currently, type-widening does not work between `TimestampType` and `DateType`.
      
      This applies to `SetOperation`, `Union`, `In`, `CaseWhen`, `Greatest`,  `Leatest`, `CreateArray`, `CreateMap`, `Coalesce`, `NullIf`, `IfNull`, `Nvl` and `Nvl2`, .
      
      This PR adds the support for widening `DateType` to `TimestampType` for them.
      
      For a simple example,
      
      **Before**
      
      ```scala
      Seq(Tuple2(new Timestamp(0), new Date(0))).toDF("a", "b").selectExpr("greatest(a, b)").show()
      ```
      
      shows below:
      
      ```
      cannot resolve 'greatest(`a`, `b`)' due to data type mismatch: The expressions should all have the same type, got GREATEST(timestamp, date)
      ```
      
      or union as below:
      
      ```scala
      val a = Seq(Tuple1(new Timestamp(0))).toDF()
      val b = Seq(Tuple1(new Date(0))).toDF()
      a.union(b).show()
      ```
      
      shows below:
      
      ```
      Union can only be performed on tables with the compatible column types. DateType <> TimestampType at the first column of the second table;
      ```
      
      **After**
      
      ```scala
      Seq(Tuple2(new Timestamp(0), new Date(0))).toDF("a", "b").selectExpr("greatest(a, b)").show()
      ```
      
      shows below:
      
      ```
      +----------------------------------------------------+
      |greatest(CAST(a AS TIMESTAMP), CAST(b AS TIMESTAMP))|
      +----------------------------------------------------+
      |                                1969-12-31 16:00:...|
      +----------------------------------------------------+
      ```
      
      or union as below:
      
      ```scala
      val a = Seq(Tuple1(new Timestamp(0))).toDF()
      val b = Seq(Tuple1(new Date(0))).toDF()
      a.union(b).show()
      ```
      
      shows below:
      
      ```
      +--------------------+
      |                  _1|
      +--------------------+
      |1969-12-31 16:00:...|
      |1969-12-31 00:00:...|
      +--------------------+
      ```
      
      ## How was this patch tested?
      
      Unit tests in `TypeCoercionSuite`.
      
      Author: hyukjinkwon <gurwls223@gmail.com>
      Author: HyukjinKwon <gurwls223@gmail.com>
      
      Closes #14786 from HyukjinKwon/SPARK-17212.
      b964a172
    • Sean Zhong's avatar
      [SPARK-17187][SQL] Supports using arbitrary Java object as internal aggregation buffer object · d96d1515
      Sean Zhong authored
      ## What changes were proposed in this pull request?
      
      This PR introduces an abstract class `TypedImperativeAggregate` so that an aggregation function of TypedImperativeAggregate can use  **arbitrary** user-defined Java object as intermediate aggregation buffer object.
      
      **This has advantages like:**
      1. It now can support larger category of aggregation functions. For example, it will be much easier to implement aggregation function `percentile_approx`, which has a complex aggregation buffer definition.
      2. It can be used to avoid doing serialization/de-serialization for every call of `update` or `merge` when converting domain specific aggregation object to internal Spark-Sql storage format.
      3. It is easier to integrate with other existing monoid libraries like algebird, and supports more aggregation functions with high performance.
      
      Please see `org.apache.spark.sql.TypedImperativeAggregateSuite.TypedMaxAggregate` to find an example of how to defined a `TypedImperativeAggregate` aggregation function.
      Please see Java doc of `TypedImperativeAggregate` and Jira ticket SPARK-17187 for more information.
      
      ## How was this patch tested?
      
      Unit tests.
      
      Author: Sean Zhong <seanzhong@databricks.com>
      Author: Yin Huai <yhuai@databricks.com>
      
      Closes #14753 from clockfly/object_aggregation_buffer_try_2.
      d96d1515
    • Marcelo Vanzin's avatar
      [SPARK-17240][CORE] Make SparkConf serializable again. · 9b5a1d1d
      Marcelo Vanzin authored
      Make the config reader transient, and initialize it lazily so that
      serialization works with both java and kryo (and hopefully any other
      custom serializer).
      
      Added unit test to make sure SparkConf remains serializable and the
      reader works with both built-in serializers.
      
      Author: Marcelo Vanzin <vanzin@cloudera.com>
      
      Closes #14813 from vanzin/SPARK-17240.
      9b5a1d1d
    • Josh Rosen's avatar
      [SPARK-17205] Literal.sql should handle Infinity and NaN · 3e4c7db4
      Josh Rosen authored
      This patch updates `Literal.sql` to properly generate SQL for `NaN` and `Infinity` float and double literals: these special values need to be handled differently from regular values, since simply appending a suffix to the value's `toString()` representation will not work for these values.
      
      Author: Josh Rosen <joshrosen@databricks.com>
      
      Closes #14777 from JoshRosen/SPARK-17205.
      3e4c7db4
    • Josh Rosen's avatar
      [SPARK-17229][SQL] PostgresDialect shouldn't widen float and short types during reads · a133057c
      Josh Rosen authored
      ## What changes were proposed in this pull request?
      
      When reading float4 and smallint columns from PostgreSQL, Spark's `PostgresDialect` widens these types to Decimal and Integer rather than using the narrower Float and Short types. According to https://www.postgresql.org/docs/7.1/static/datatype.html#DATATYPE-TABLE, Postgres maps the `smallint` type to a signed two-byte integer and the `real` / `float4` types to single precision floating point numbers.
      
      This patch fixes this by adding more special-cases to `getCatalystType`, similar to what was done for the Derby JDBC dialect. I also fixed a similar problem in the write path which causes Spark to create integer columns in Postgres for what should have been ShortType columns.
      
      ## How was this patch tested?
      
      New test cases in `PostgresIntegrationSuite` (which I ran manually because Jenkins can't run it right now).
      
      Author: Josh Rosen <joshrosen@databricks.com>
      
      Closes #14796 from JoshRosen/postgres-jdbc-type-fixes.
      a133057c
    • wm624@hotmail.com's avatar
      [SPARKR][BUILD] ignore cran-check.out under R folder · 9958ac0c
      wm624@hotmail.com authored
      ## What changes were proposed in this pull request?
      
      (Please fill in changes proposed in this fix)
      R add cran check which will generate the cran-check.out. This file should be ignored in git.
      
      ## How was this patch tested?
      
      (Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
      Manual test it. Run clean test and git status to make sure the file is not included in git.
      
      Author: wm624@hotmail.com <wm624@hotmail.com>
      
      Closes #14774 from wangmiao1981/ignore.
      9958ac0c
    • Michael Allman's avatar
      [SPARK-17231][CORE] Avoid building debug or trace log messages unless the... · f2093107
      Michael Allman authored
      [SPARK-17231][CORE] Avoid building debug or trace log messages unless the respective log level is enabled
      
      (This PR addresses https://issues.apache.org/jira/browse/SPARK-17231)
      
      ## What changes were proposed in this pull request?
      
      While debugging the performance of a large GraphX connected components computation, we found several places in the `network-common` and `network-shuffle` code bases where trace or debug log messages are constructed even if the respective log level is disabled. According to YourKit, these constructions were creating substantial churn in the eden region. Refactoring the respective code to avoid these unnecessary constructions except where necessary led to a modest but measurable reduction in our job's task time, GC time and the ratio thereof.
      
      ## How was this patch tested?
      
      We computed the connected components of a graph with about 2.6 billion vertices and 1.7 billion edges four times. We used four different EC2 clusters each with 8 r3.8xl worker nodes. Two test runs used Spark master. Two used Spark master + this PR. The results from the first test run, master and master+PR:
      ![master](https://cloud.githubusercontent.com/assets/833693/17951634/7471cbca-6a18-11e6-9c26-78afe9319685.jpg)
      ![logging_perf_improvements](https://cloud.githubusercontent.com/assets/833693/17951632/7467844e-6a18-11e6-9a0e-053dc7650413.jpg)
      
      The results from the second test run, master and master+PR:
      ![master 2](https://cloud.githubusercontent.com/assets/833693/17951633/746dd6aa-6a18-11e6-8e27-606680b3f105.jpg)
      ![logging_perf_improvements 2](https://cloud.githubusercontent.com/assets/833693/17951631/74488710-6a18-11e6-8a32-08692f373386.jpg)
      
      Though modest, I believe these results are significant.
      
      Author: Michael Allman <michael@videoamp.com>
      
      Closes #14798 from mallman/spark-17231-logging_perf_improvements.
      f2093107
    • gatorsmile's avatar
      [SPARK-16991][SPARK-17099][SPARK-17120][SQL] Fix Outer Join Elimination when... · d2ae6399
      gatorsmile authored
      [SPARK-16991][SPARK-17099][SPARK-17120][SQL] Fix Outer Join Elimination when Filter's isNotNull Constraints Unable to Filter Out All Null-supplying Rows
      
      ### What changes were proposed in this pull request?
      This PR is to fix an incorrect outer join elimination when filter's `isNotNull` constraints is unable to filter out all null-supplying rows. For example, `isnotnull(coalesce(b#227, c#238))`.
      
      Users can hit this error when they try to use `using/natural outer join`, which is converted to a normal outer join with a `coalesce` expression on the `using columns`. For example,
      ```Scala
          val a = Seq((1, 2), (2, 3)).toDF("a", "b")
          val b = Seq((2, 5), (3, 4)).toDF("a", "c")
          val c = Seq((3, 1)).toDF("a", "d")
          val ab = a.join(b, Seq("a"), "fullouter")
          ab.join(c, "a").explain(true)
      ```
      The dataframe `ab` is doing `using full-outer join`, which is converted to a normal outer join with a `coalesce` expression. Constraints inference generates a `Filter` with constraints `isnotnull(coalesce(b#227, c#238))`. Then, it triggers a wrong outer join elimination and generates a wrong result.
      ```
      Project [a#251, b#227, c#237, d#247]
      +- Join Inner, (a#251 = a#246)
         :- Project [coalesce(a#226, a#236) AS a#251, b#227, c#237]
         :  +- Join FullOuter, (a#226 = a#236)
         :     :- Project [_1#223 AS a#226, _2#224 AS b#227]
         :     :  +- LocalRelation [_1#223, _2#224]
         :     +- Project [_1#233 AS a#236, _2#234 AS c#237]
         :        +- LocalRelation [_1#233, _2#234]
         +- Project [_1#243 AS a#246, _2#244 AS d#247]
            +- LocalRelation [_1#243, _2#244]
      
      == Optimized Logical Plan ==
      Project [a#251, b#227, c#237, d#247]
      +- Join Inner, (a#251 = a#246)
         :- Project [coalesce(a#226, a#236) AS a#251, b#227, c#237]
         :  +- Filter isnotnull(coalesce(a#226, a#236))
         :     +- Join FullOuter, (a#226 = a#236)
         :        :- LocalRelation [a#226, b#227]
         :        +- LocalRelation [a#236, c#237]
         +- LocalRelation [a#246, d#247]
      ```
      
      **A note to the `Committer`**, please also give the credit to dongjoon-hyun who submitted another PR for fixing this issue. https://github.com/apache/spark/pull/14580
      
      ### How was this patch tested?
      Added test cases
      
      Author: gatorsmile <gatorsmile@gmail.com>
      
      Closes #14661 from gatorsmile/fixOuterJoinElimination.
      d2ae6399
    • Takeshi YAMAMURO's avatar
      [SPARK-12978][SQL] Skip unnecessary final group-by when input data already... · 2b0cc4e0
      Takeshi YAMAMURO authored
      [SPARK-12978][SQL] Skip unnecessary final group-by when input data already clustered with group-by keys
      
      This ticket targets the optimization to skip an unnecessary group-by operation below;
      
      Without opt.:
      ```
      == Physical Plan ==
      TungstenAggregate(key=[col0#159], functions=[(sum(col1#160),mode=Final,isDistinct=false),(avg(col2#161),mode=Final,isDistinct=false)], output=[col0#159,sum(col1)#177,avg(col2)#178])
      +- TungstenAggregate(key=[col0#159], functions=[(sum(col1#160),mode=Partial,isDistinct=false),(avg(col2#161),mode=Partial,isDistinct=false)], output=[col0#159,sum#200,sum#201,count#202L])
         +- TungstenExchange hashpartitioning(col0#159,200), None
            +- InMemoryColumnarTableScan [col0#159,col1#160,col2#161], InMemoryRelation [col0#159,col1#160,col2#161], true, 10000, StorageLevel(true, true, false, true, 1), ConvertToUnsafe, None
      ```
      
      With opt.:
      ```
      == Physical Plan ==
      TungstenAggregate(key=[col0#159], functions=[(sum(col1#160),mode=Complete,isDistinct=false),(avg(col2#161),mode=Final,isDistinct=false)], output=[col0#159,sum(col1)#177,avg(col2)#178])
      +- TungstenExchange hashpartitioning(col0#159,200), None
        +- InMemoryColumnarTableScan [col0#159,col1#160,col2#161], InMemoryRelation [col0#159,col1#160,col2#161], true, 10000, StorageLevel(true, true, false, true, 1), ConvertToUnsafe, None
      ```
      
      Author: Takeshi YAMAMURO <linguin.m.s@gmail.com>
      
      Closes #10896 from maropu/SkipGroupbySpike.
      2b0cc4e0
Loading