Skip to content
Snippets Groups Projects
  1. May 17, 2017
  2. May 16, 2017
    • Liang-Chi Hsieh's avatar
      [SPARK-20690][SQL] Subqueries in FROM should have alias names · 7463a88b
      Liang-Chi Hsieh authored
      ## What changes were proposed in this pull request?
      
      We add missing attributes into Filter in Analyzer. But we shouldn't do it through subqueries like this:
      
          select 1 from  (select 1 from onerow t1 LIMIT 1) where  t1.c1=1
      
      This query works in current codebase. However, the outside where clause shouldn't be able to refer `t1.c1` attribute.
      
      The root cause is we allow subqueries in FROM have no alias names previously, it is confusing and isn't supported by various databases such as MySQL, Postgres, Oracle. We shouldn't support it too.
      
      ## How was this patch tested?
      
      Jenkins tests.
      
      Please review http://spark.apache.org/contributing.html before opening a pull request.
      
      Author: Liang-Chi Hsieh <viirya@gmail.com>
      
      Closes #17935 from viirya/SPARK-20690.
      7463a88b
    • Herman van Hovell's avatar
      [SQL][TRIVIAL] Lower parser log level to debug · 69bb7715
      Herman van Hovell authored
      ## What changes were proposed in this pull request?
      Currently the parser logs the query it is parsing at `info` level. This is too high, this PR lowers the log level to `debug`.
      
      ## How was this patch tested?
      Existing tests.
      
      Author: Herman van Hovell <hvanhovell@databricks.com>
      
      Closes #18006 from hvanhovell/lower_parser_log_level.
      69bb7715
    • Yash Sharma's avatar
      [SPARK-20140][DSTREAM] Remove hardcoded kinesis retry wait and max retries · 38f4e869
      Yash Sharma authored
      ## What changes were proposed in this pull request?
      
      The pull requests proposes to remove the hardcoded values for Amazon Kinesis - MIN_RETRY_WAIT_TIME_MS, MAX_RETRIES.
      
      This change is critical for kinesis checkpoint recovery when the kinesis backed rdd is huge.
      Following happens in a typical kinesis recovery :
      - kinesis throttles large number of requests while recovering
      - retries in case of throttling are not able to recover due to the small wait period
      - kinesis throttles per second, the wait period should be configurable for recovery
      
      The patch picks the spark kinesis configs from:
      - spark.streaming.kinesis.retry.wait.time
      - spark.streaming.kinesis.retry.max.attempts
      
      Jira : https://issues.apache.org/jira/browse/SPARK-20140
      
      ## How was this patch tested?
      
      Modified the KinesisBackedBlockRDDSuite.scala to run kinesis tests with the modified configurations. Wasn't able to test the patch with actual throttling.
      
      Author: Yash Sharma <ysharma@atlassian.com>
      
      Closes #17467 from yssharma/ysharma/spark-kinesis-retries.
      38f4e869
    • Kazuaki Ishizaki's avatar
      [SPARK-19372][SQL] Fix throwing a Java exception at df.fliter() due to 64KB bytecode size limit · 6f62e9d9
      Kazuaki Ishizaki authored
      ## What changes were proposed in this pull request?
      
      When an expression for `df.filter()` has many nodes (e.g. 400), the size of Java bytecode for the generated Java code is more than 64KB. It produces an Java exception. As a result, the execution fails.
      This PR continues to execute by calling `Expression.eval()` disabling code generation if an exception has been caught.
      
      ## How was this patch tested?
      
      Add a test suite into `DataFrameSuite`
      
      Author: Kazuaki Ishizaki <ishizaki@jp.ibm.com>
      
      Closes #17087 from kiszk/SPARK-19372.
      6f62e9d9
    • Shixiong Zhu's avatar
      [SPARK-20529][CORE] Allow worker and master work with a proxy server · 9150bca4
      Shixiong Zhu authored
      ## What changes were proposed in this pull request?
      
      In the current codes, when worker connects to master, master will send its address to the worker. Then worker will save this address and use it to reconnect in case of failure. However, sometimes, this address is not correct. If there is a proxy between master and worker, the address master sent is not the address of proxy.
      
      In this PR, the master address used by the worker will be sent to the master, then master just replies this address back, worker will use this address to reconnect in case of failure. In other words, the worker will use the config master address set in the worker side if possible rather than the master address set in the master side.
      
      There is still one potential issue though. When a master is restarted or takes over leadership, the work will use the address sent from the master to connect. If there is still a proxy between  master and worker, the address may be wrong. However, there is no way to figure it out just in the worker.
      
      ## How was this patch tested?
      
      The new added unit test.
      
      Author: Shixiong Zhu <shixiong@databricks.com>
      
      Closes #17821 from zsxwing/SPARK-20529.
      9150bca4
    • Nick Pentreath's avatar
      [SPARK-20677][MLLIB][ML] Follow-up to ALS recommend-all performance PRs · 25b4f41d
      Nick Pentreath authored
      Small clean ups from #17742 and #17845.
      
      ## How was this patch tested?
      
      Existing unit tests.
      
      Author: Nick Pentreath <nickp@za.ibm.com>
      
      Closes #17919 from MLnick/SPARK-20677-als-perf-followup.
      25b4f41d
    • Nick Pentreath's avatar
      [SPARK-20553][ML][PYSPARK] Update ALS examples with recommend-all methods · 6af7b43b
      Nick Pentreath authored
      Update ALS examples illustrating use of "recommendForAllX" methods.
      
      ## How was this patch tested?
      Built and ran examples locally
      
      Author: Nick Pentreath <nickp@za.ibm.com>
      
      Closes #17950 from MLnick/SPARK-20553-update-als-examples.
      6af7b43b
  3. May 15, 2017
    • Yanbo Liang's avatar
      [SPARK-20501][ML] ML 2.2 QA: New Scala APIs, docs · dbe81633
      Yanbo Liang authored
      ## What changes were proposed in this pull request?
      Review new Scala APIs introduced in 2.2.
      
      ## How was this patch tested?
      Existing tests.
      
      Author: Yanbo Liang <ybliang8@gmail.com>
      
      Closes #17934 from yanboliang/spark-20501.
      dbe81633
    • Yanbo Liang's avatar
      [SPARK-20707][ML] ML deprecated APIs should be removed in major release. · d4022d49
      Yanbo Liang authored
      ## What changes were proposed in this pull request?
      Before 2.2, MLlib keep to remove APIs deprecated in last feature/minor release. But from Spark 2.2, we decide to remove deprecated APIs in a major release, so we need to change corresponding annotations to tell users those will be removed in 3.0.
      Meanwhile, this fixed bugs in ML documents. The original ML docs can't show deprecated annotations in ```MLWriter``` and ```MLReader``` related class, we correct it in this PR.
      
      Before:
      ![image](https://cloud.githubusercontent.com/assets/1962026/25939889/f8c55f20-3666-11e7-9fa2-0605bfb3ed06.png)
      
      After:
      ![image](https://cloud.githubusercontent.com/assets/1962026/25939870/e9b0d5be-3666-11e7-9765-5e04885e4b32.png)
      
      ## How was this patch tested?
      Existing tests.
      
      Author: Yanbo Liang <ybliang8@gmail.com>
      
      Closes #17946 from yanboliang/spark-20707.
      d4022d49
    • Takuya UESHIN's avatar
      [SPARK-20588][SQL] Cache TimeZone instances. · c8c878a4
      Takuya UESHIN authored
      ## What changes were proposed in this pull request?
      
      Because the method `TimeZone.getTimeZone(String ID)` is synchronized on the TimeZone class, concurrent call of this method will become a bottleneck.
      This especially happens when casting from string value containing timezone info to timestamp value, which uses `DateTimeUtils.stringToTimestamp()` and gets TimeZone instance on the site.
      
      This pr makes a cache of the generated TimeZone instances to avoid the synchronization.
      
      ## How was this patch tested?
      
      Existing tests.
      
      Author: Takuya UESHIN <ueshin@databricks.com>
      
      Closes #17933 from ueshin/issues/SPARK-20588.
      c8c878a4
    • Dongjoon Hyun's avatar
      [SPARK-20735][SQL][TEST] Enable cross join in TPCDSQueryBenchmark · bbd163d5
      Dongjoon Hyun authored
      ## What changes were proposed in this pull request?
      
      Since [SPARK-17298](https://issues.apache.org/jira/browse/SPARK-17298), some queries (q28, q61, q77, q88, q90) in the test suites fail with a message "_Use the CROSS JOIN syntax to allow cartesian products between these relations_".
      
      This benchmark is used as a reference model for Spark TPC-DS, so this PR aims to enable the correct configuration in `TPCDSQueryBenchmark.scala`.
      
      ## How was this patch tested?
      
      Manual. (Run TPCDSQueryBenchmark)
      
      Author: Dongjoon Hyun <dongjoon@apache.org>
      
      Closes #17977 from dongjoon-hyun/SPARK-20735.
      bbd163d5
    • Tathagata Das's avatar
      [SPARK-20717][SS] Minor tweaks to the MapGroupsWithState behavior · 499ba2cb
      Tathagata Das authored
      ## What changes were proposed in this pull request?
      
      Timeout and state data are two independent entities and should be settable independently. Therefore, in the same call of the user-defined function, one should be able to set the timeout before initializing the state and also after removing the state. Whether timeouts can be set or not, should not depend on the current state, and vice versa.
      
      However, a limitation of the current implementation is that state cannot be null while timeout is set. This is checked lazily after the function call has completed.
      
      ## How was this patch tested?
      - Updated existing unit tests that test the behavior of GroupState.setTimeout*** wrt to the current state
      - Added new tests that verify the disallowed cases where state is undefined but timeout is set.
      
      Author: Tathagata Das <tathagata.das1565@gmail.com>
      
      Closes #17957 from tdas/SPARK-20717.
      499ba2cb
    • Tejas Patil's avatar
      [SPARK-17729][SQL] Enable creating hive bucketed tables · d2416925
      Tejas Patil authored
      ## What changes were proposed in this pull request?
      
      Hive allows inserting data to bucketed table without guaranteeing bucketed and sorted-ness based on these two configs : `hive.enforce.bucketing` and `hive.enforce.sorting`.
      
      What does this PR achieve ?
      - Spark will disallow users from writing outputs to hive bucketed tables by default (given that output won't adhere with Hive's semantics).
      - IF user still wants to write to hive bucketed table, the only resort is to use `hive.enforce.bucketing=false` and `hive.enforce.sorting=false` which means user does NOT care about bucketing guarantees.
      
      Changes done in this PR:
      - Extract table's bucketing information in `HiveClientImpl`
      - While writing table info to metastore, `HiveClientImpl` now populates the bucketing information in the hive `Table` object
      - `InsertIntoHiveTable` allows inserts to bucketed table only if both `hive.enforce.bucketing` and `hive.enforce.sorting` are `false`
      
      Ability to create bucketed tables will enable adding test cases to Spark while I add more changes related to hive bucketing support. Design doc for hive hive bucketing support : https://docs.google.com/document/d/1a8IDh23RAkrkg9YYAeO51F4aGO8-xAlupKwdshve2fc/edit#
      
      ## How was this patch tested?
      - Added test for creating bucketed and sorted table.
      - Added test to ensure that INSERTs fail if strict bucket / sort is enforced
      - Added test to ensure that INSERTs can go through if strict bucket / sort is NOT enforced
      - Added test to validate that bucketing information shows up in output of DESC FORMATTED
      - Added test to ensure that `SHOW CREATE TABLE` works for hive bucketed tables
      
      Author: Tejas Patil <tejasp@fb.com>
      
      Closes #17644 from tejasapatil/SPARK-17729_create_bucketed_table.
      d2416925
    • Tathagata Das's avatar
      [SPARK-20716][SS] StateStore.abort() should not throw exceptions · 271175e2
      Tathagata Das authored
      ## What changes were proposed in this pull request?
      
      StateStore.abort() should do a best effort attempt to clean up temporary resources. It should not throw errors, especially because its called in a TaskCompletionListener, because this error could hide previous real errors in the task.
      
      ## How was this patch tested?
      No unit test.
      
      Author: Tathagata Das <tathagata.das1565@gmail.com>
      
      Closes #17958 from tdas/SPARK-20716.
      271175e2
    • Wenchen Fan's avatar
      [SPARK-12837][SPARK-20666][CORE][FOLLOWUP] getting name should not fail if... · e1aaab1e
      Wenchen Fan authored
      [SPARK-12837][SPARK-20666][CORE][FOLLOWUP] getting name should not fail if accumulator is garbage collected
      
      ## What changes were proposed in this pull request?
      
      After https://github.com/apache/spark/pull/17596 , we do not send internal accumulator name to executor side anymore, and always look up the accumulator name in `AccumulatorContext`.
      
      This cause a regression if the accumulator is already garbage collected, this PR fixes this by still sending accumulator name for `SQLMetrics`.
      
      ## How was this patch tested?
      
      N/A
      
      Author: Wenchen Fan <wenchen@databricks.com>
      
      Closes #17931 from cloud-fan/bug.
      e1aaab1e
    • Zheng RuiFeng's avatar
      [SPARK-20669][ML] LoR.family and LDA.optimizer should be case insensitive · 9970aa09
      Zheng RuiFeng authored
      ## What changes were proposed in this pull request?
      make param `family` in LoR and `optimizer` in LDA case insensitive
      
      ## How was this patch tested?
      updated tests
      
      yanboliang
      
      Author: Zheng RuiFeng <ruifengz@foxmail.com>
      
      Closes #17910 from zhengruifeng/lr_family_lowercase.
      9970aa09
    • Takeshi Yamamuro's avatar
      [SPARK-20730][SQL] Add an optimizer rule to combine nested Concat · b0888d1a
      Takeshi Yamamuro authored
      ## What changes were proposed in this pull request?
      This pr added a new Optimizer rule to combine nested Concat. The master supports a pipeline operator '||' to concatenate strings in #17711 (This pr is follow-up). Since the parser currently generates nested Concat expressions, the optimizer needs to combine the nested expressions.
      
      ## How was this patch tested?
      Added tests in `CombineConcatSuite` and `SQLQueryTestSuite`.
      
      Author: Takeshi Yamamuro <yamamuro@apache.org>
      
      Closes #17970 from maropu/SPARK-20730.
      b0888d1a
    • guoxiaolong's avatar
      [SPARK-20720][WEB-UI] Executor Summary' should show the exact number, 'Removed... · 8da6e8b1
      guoxiaolong authored
      [SPARK-20720][WEB-UI] Executor Summary' should show the exact number, 'Removed Executors' should display the specific number, in the Application Page
      
      ## What changes were proposed in this pull request?
      
      When the number of spark worker executors is large, if the specific number is displayed, will better help us to analyze and observe by spark ui.
      
      Although this is a small improvement, but it is indeed very valuable.
      
      After fix:
      ![executor1](https://cloud.githubusercontent.com/assets/26266482/25986597/2d8e4386-3723-11e7-9c24-e5bff17c26e2.png)
      
      ## How was this patch tested?
      
      manual tests
      
      Please review http://spark.apache.org/contributing.html before opening a pull request.
      
      Author: guoxiaolong <guo.xiaolong1@zte.com.cn>
      Author: 郭小龙 10207633 <guo.xiaolong1@zte.com.cn>
      Author: guoxiaolongzte <guo.xiaolong1@zte.com.cn>
      
      Closes #17961 from guoxiaolongzte/SPARK-20720.
      8da6e8b1
    • guoxiaolong's avatar
      [SPARK-20705][WEB-UI] The sort function can not be used in the master page... · 99d57999
      guoxiaolong authored
      [SPARK-20705][WEB-UI] The sort function can not be used in the master page when you use Firefox or Google Chrome.
      
      ## What changes were proposed in this pull request?
      When you open the master page, when you use Firefox or Google Chrom, the console of Firefox or Google Chrome is wrong. But The IE  is no problem.
      e.g.
      ![error](https://cloud.githubusercontent.com/assets/26266482/25946143/74467a5c-367c-11e7-8f9f-d3585b1aea88.png)
      
      My Firefox version is 48.0.2.
      My Google Chrome version  is 49.0.2623.75 m.
      
      ## How was this patch tested?
      
      manual tests
      
      Please review http://spark.apache.org/contributing.html before opening a pull request.
      
      Author: guoxiaolong <guo.xiaolong1@zte.com.cn>
      Author: 郭小龙 10207633 <guo.xiaolong1@zte.com.cn>
      Author: guoxiaolongzte <guo.xiaolong1@zte.com.cn>
      
      Closes #17952 from guoxiaolongzte/SPARK-20705.
      99d57999
  4. May 14, 2017
  5. May 13, 2017
    • Wenchen Fan's avatar
      [SPARK-20725][SQL] partial aggregate should behave correctly for sameResult · 1283c3d1
      Wenchen Fan authored
      ## What changes were proposed in this pull request?
      
      For aggregate function with `PartialMerge` or `Final` mode, the input is aggregate buffers instead of the actual children expressions. So the actual children expressions won't affect the result, we should normalize the expr id for them.
      
      ## How was this patch tested?
      
      a new regression test
      
      Author: Wenchen Fan <wenchen@databricks.com>
      
      Closes #17964 from cloud-fan/tmp.
      1283c3d1
    • hyukjinkwon's avatar
      [SPARK-18772][SQL] Avoid unnecessary conversion try for special floats in JSON · 3f98375d
      hyukjinkwon authored
      ## What changes were proposed in this pull request?
      
      This PR is based on  https://github.com/apache/spark/pull/16199 and extracts the valid change from https://github.com/apache/spark/pull/9759 to resolve SPARK-18772
      
      This avoids additional conversion try with `toFloat` and `toDouble`.
      
      For avoiding additional conversions, please refer the codes below:
      
      **Before**
      
      ```scala
      scala> import org.apache.spark.sql.types._
      import org.apache.spark.sql.types._
      
      scala> spark.read.schema(StructType(Seq(StructField("a", DoubleType)))).option("mode", "FAILFAST").json(Seq("""{"a": "nan"}""").toDS).show()
      17/05/12 11:30:41 ERROR Executor: Exception in task 0.0 in stage 2.0 (TID 2)
      java.lang.NumberFormatException: For input string: "nan"
      ...
      ```
      
      **After**
      
      ```scala
      scala> import org.apache.spark.sql.types._
      import org.apache.spark.sql.types._
      
      scala> spark.read.schema(StructType(Seq(StructField("a", DoubleType)))).option("mode", "FAILFAST").json(Seq("""{"a": "nan"}""").toDS).show()
      17/05/12 11:44:30 ERROR Executor: Exception in task 0.0 in stage 0.0 (TID 0)
      java.lang.RuntimeException: Cannot parse nan as DoubleType.
      ...
      ```
      
      ## How was this patch tested?
      
      Unit tests added in `JsonSuite`.
      
      Closes #16199
      
      Author: hyukjinkwon <gurwls223@gmail.com>
      Author: Nathan Howell <nhowell@godaddy.com>
      
      Closes #17956 from HyukjinKwon/SPARK-18772.
      3f98375d
  6. May 12, 2017
    • Xiao Li's avatar
      [SPARK-20719][SQL] Support LIMIT ALL · b84ff7eb
      Xiao Li authored
      ### What changes were proposed in this pull request?
      `LIMIT ALL` is the same as omitting the `LIMIT` clause. It is supported by both PrestgreSQL and Presto. This PR is to support it by adding it in the parser.
      
      ### How was this patch tested?
      Added a test case
      
      Author: Xiao Li <gatorsmile@gmail.com>
      
      Closes #17960 from gatorsmile/LimitAll.
      b84ff7eb
    • zuotingbing's avatar
      [SPARK-20594][SQL] The staging directory should be a child directory starts... · e3d2022e
      zuotingbing authored
      [SPARK-20594][SQL] The staging directory should be a child directory starts with "." to avoid being deleted if we set hive.exec.stagingdir under the table directory.
      
      JIRA Issue: https://issues.apache.org/jira/browse/SPARK-20594
      
      ## What changes were proposed in this pull request?
      
      The staging directory should be a child directory starts with "." to avoid being deleted before moving staging directory to table directory if we set hive.exec.stagingdir under the table directory.
      
      ## How was this patch tested?
      
      Added unit tests
      
      Author: zuotingbing <zuo.tingbing9@zte.com.cn>
      
      Closes #17858 from zuotingbing/spark-stagingdir.
      e3d2022e
    • Tathagata Das's avatar
      [SPARK-20714][SS] Fix match error when watermark is set with timeout = no... · 0d3a6319
      Tathagata Das authored
      [SPARK-20714][SS] Fix match error when watermark is set with timeout = no timeout / processing timeout
      
      ## What changes were proposed in this pull request?
      
      When watermark is set, and timeout conf is NoTimeout or ProcessingTimeTimeout (both do not need the watermark), the query fails at runtime with the following exception.
      ```
      MatchException: Some(org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificPredicate1a9b798e) (of class scala.Some)
          org.apache.spark.sql.execution.streaming.FlatMapGroupsWithStateExec$$anonfun$doExecute$1.apply(FlatMapGroupsWithStateExec.scala:120)
          org.apache.spark.sql.execution.streaming.FlatMapGroupsWithStateExec$$anonfun$doExecute$1.apply(FlatMapGroupsWithStateExec.scala:116)
          org.apache.spark.sql.execution.streaming.state.package$StateStoreOps$$anonfun$1.apply(package.scala:70)
          org.apache.spark.sql.execution.streaming.state.package$StateStoreOps$$anonfun$1.apply(package.scala:65)
          org.apache.spark.sql.execution.streaming.state.StateStoreRDD.compute(StateStoreRDD.scala:64)
      ```
      
      The match did not correctly handle cases where watermark was defined by the timeout was different from EventTimeTimeout.
      
      ## How was this patch tested?
      New unit tests.
      
      Author: Tathagata Das <tathagata.das1565@gmail.com>
      
      Closes #17954 from tdas/SPARK-20714.
      0d3a6319
    • Shixiong Zhu's avatar
      [SPARK-20702][CORE] TaskContextImpl.markTaskCompleted should not hide the original error · 7d6ff391
      Shixiong Zhu authored
      ## What changes were proposed in this pull request?
      
      This PR adds an `error` parameter to `TaskContextImpl.markTaskCompleted` to propagate the original error.
      
      It also fixes an issue that `TaskCompletionListenerException.getMessage` doesn't include `previousError`.
      
      ## How was this patch tested?
      
      New unit tests.
      
      Author: Shixiong Zhu <shixiong@databricks.com>
      
      Closes #17942 from zsxwing/SPARK-20702.
      7d6ff391
    • Takeshi Yamamuro's avatar
      [SPARK-19951][SQL] Add string concatenate operator || to Spark SQL · b526f70c
      Takeshi Yamamuro authored
      ## What changes were proposed in this pull request?
      This pr added code to support `||` for string concatenation. This string operation is supported in PostgreSQL and MySQL.
      
      ## How was this patch tested?
      Added tests in `SparkSqlParserSuite`
      
      Author: Takeshi Yamamuro <yamamuro@apache.org>
      
      Closes #17711 from maropu/SPARK-19951.
      b526f70c
    • Takeshi Yamamuro's avatar
      [SPARK-20710][SQL] Support aliases in CUBE/ROLLUP/GROUPING SETS · 92ea7fd7
      Takeshi Yamamuro authored
      ## What changes were proposed in this pull request?
      This pr added  `Analyzer` code for supporting aliases in CUBE/ROLLUP/GROUPING SETS (This is follow-up of #17191).
      
      ## How was this patch tested?
      Added tests in `SQLQueryTestSuite`.
      
      Author: Takeshi Yamamuro <yamamuro@apache.org>
      
      Closes #17948 from maropu/SPARK-20710.
      92ea7fd7
    • wangzhenhua's avatar
      [SPARK-20718][SQL][FOLLOWUP] Fix canonicalization for HiveTableScanExec · 54b4f2ad
      wangzhenhua authored
      ## What changes were proposed in this pull request?
      
      Fix canonicalization for different filter orders in `HiveTableScanExec`.
      
      ## How was this patch tested?
      
      Added a new test case.
      
      Author: wangzhenhua <wangzhenhua@huawei.com>
      
      Closes #17962 from wzhfy/canonicalizeHiveTableScanExec.
      54b4f2ad
    • Ryan Blue's avatar
      [SPARK-17424] Fix unsound substitution bug in ScalaReflection. · b2369339
      Ryan Blue authored
      ## What changes were proposed in this pull request?
      
      This method gets a type's primary constructor and fills in type parameters with concrete types. For example, `MapPartitions[T, U] -> MapPartitions[Int, String]`. This Substitution fails when the actual type args are empty because they are still unknown. Instead, when there are no resolved types to subsitute, this returns the original args with unresolved type parameters.
      ## How was this patch tested?
      
      This doesn't affect substitutions where the type args are determined. This fixes our case where the actual type args are empty and our job runs successfully.
      
      Author: Ryan Blue <blue@apache.org>
      
      Closes #15062 from rdblue/SPARK-17424-fix-unsound-reflect-substitution.
      b2369339
    • Sean Owen's avatar
      [SPARK-20554][BUILD] Remove usage of scala.language.reflectiveCalls · fc8a2b6e
      Sean Owen authored
      ## What changes were proposed in this pull request?
      
      Remove uses of scala.language.reflectiveCalls that are either unnecessary or probably resulting in more complex code. This turned out to be less significant than I thought, but, still worth a touch-up.
      
      ## How was this patch tested?
      
      Existing tests.
      
      Author: Sean Owen <sowen@cloudera.com>
      
      Closes #17949 from srowen/SPARK-20554.
      fc8a2b6e
    • hyukjinkwon's avatar
      [SPARK-20639][SQL] Add single argument support for to_timestamp in SQL with... · 720708cc
      hyukjinkwon authored
      [SPARK-20639][SQL] Add single argument support for to_timestamp in SQL with documentation improvement
      
      ## What changes were proposed in this pull request?
      
      This PR proposes three things as below:
      
      - Use casting rules to a timestamp in `to_timestamp` by default (it was `yyyy-MM-dd HH:mm:ss`).
      
      - Support single argument for `to_timestamp` similarly with APIs in other languages.
      
        For example, the one below works
      
        ```
        import org.apache.spark.sql.functions._
        Seq("2016-12-31 00:12:00.00").toDF("a").select(to_timestamp(col("a"))).show()
        ```
      
        prints
      
        ```
        +----------------------------------------+
        |to_timestamp(`a`, 'yyyy-MM-dd HH:mm:ss')|
        +----------------------------------------+
        |                     2016-12-31 00:12:00|
        +----------------------------------------+
        ```
      
        whereas this does not work in SQL.
      
        **Before**
      
        ```
        spark-sql> SELECT to_timestamp('2016-12-31 00:12:00');
        Error in query: Invalid number of arguments for function to_timestamp; line 1 pos 7
        ```
      
        **After**
      
        ```
        spark-sql> SELECT to_timestamp('2016-12-31 00:12:00');
        2016-12-31 00:12:00
        ```
      
      - Related document improvement for SQL function descriptions and other API descriptions accordingly.
      
        **Before**
      
        ```
        spark-sql> DESCRIBE FUNCTION extended to_date;
        ...
        Usage: to_date(date_str, fmt) - Parses the `left` expression with the `fmt` expression. Returns null with invalid input.
        Extended Usage:
            Examples:
              > SELECT to_date('2016-12-31', 'yyyy-MM-dd');
               2016-12-31
        ```
      
        ```
        spark-sql> DESCRIBE FUNCTION extended to_timestamp;
        ...
        Usage: to_timestamp(timestamp, fmt) - Parses the `left` expression with the `format` expression to a timestamp. Returns null with invalid input.
        Extended Usage:
            Examples:
              > SELECT to_timestamp('2016-12-31', 'yyyy-MM-dd');
               2016-12-31 00:00:00.0
        ```
      
        **After**
      
        ```
        spark-sql> DESCRIBE FUNCTION extended to_date;
        ...
        Usage:
            to_date(date_str[, fmt]) - Parses the `date_str` expression with the `fmt` expression to
              a date. Returns null with invalid input. By default, it follows casting rules to a date if
              the `fmt` is omitted.
      
        Extended Usage:
            Examples:
              > SELECT to_date('2009-07-30 04:17:52');
               2009-07-30
              > SELECT to_date('2016-12-31', 'yyyy-MM-dd');
               2016-12-31
        ```
      
        ```
        spark-sql> DESCRIBE FUNCTION extended to_timestamp;
        ...
         Usage:
            to_timestamp(timestamp[, fmt]) - Parses the `timestamp` expression with the `fmt` expression to
              a timestamp. Returns null with invalid input. By default, it follows casting rules to
              a timestamp if the `fmt` is omitted.
      
        Extended Usage:
            Examples:
              > SELECT to_timestamp('2016-12-31 00:12:00');
               2016-12-31 00:12:00
              > SELECT to_timestamp('2016-12-31', 'yyyy-MM-dd');
               2016-12-31 00:00:00
        ```
      
      ## How was this patch tested?
      
      Added tests in `datetime.sql`.
      
      Author: hyukjinkwon <gurwls223@gmail.com>
      
      Closes #17901 from HyukjinKwon/to_timestamp_arg.
      720708cc
    • Wayne Zhang's avatar
      [SPARK-20619][ML] StringIndexer supports multiple ways to order label · af40bb11
      Wayne Zhang authored
      ## What changes were proposed in this pull request?
      
      StringIndexer maps labels to numbers according to the descending order of label frequency. Other types of ordering (e.g., alphabetical) may be needed in feature ETL.  For example, the ordering will affect the result in one-hot encoding and RFormula.
      
      This PR proposes to support other ordering methods and we add a parameter `stringOrderType` that supports the following four options:
      - 'frequencyDesc': descending order by label frequency (most frequent label assigned 0)
      - 'frequencyAsc': ascending order by label frequency (least frequent label assigned 0)
      - 'alphabetDesc': descending alphabetical order
      - 'alphabetAsc': ascending alphabetical order
      
      The default is still descending order of label frequency, so there should be no impact to existing programs.
      
      ## How was this patch tested?
      new test
      
      Author: Wayne Zhang <actuaryzhang@uber.com>
      
      Closes #17879 from actuaryzhang/stringIndexer.
      af40bb11
    • Felix Cheung's avatar
      [SPARK-20704][SPARKR] change CRAN test to run single thread · 888b84ab
      Felix Cheung authored
      ## What changes were proposed in this pull request?
      
      - [x] need to test by running R CMD check --as-cran
      - [x] sanity check vignettes
      
      ## How was this patch tested?
      
      Jenkins
      
      Author: Felix Cheung <felixcheung_m@hotmail.com>
      
      Closes #17945 from felixcheung/rchangesforpackage.
      888b84ab
    • wangzhenhua's avatar
      [SPARK-20718][SQL] FileSourceScanExec with different filter orders should be... · c8da5356
      wangzhenhua authored
      [SPARK-20718][SQL] FileSourceScanExec with different filter orders should be the same after canonicalization
      
      ## What changes were proposed in this pull request?
      
      Since `constraints` in `QueryPlan` is a set, the order of filters can differ. Usually this is ok because of canonicalization. However, in `FileSourceScanExec`, its data filters and partition filters are sequences, and their orders are not canonicalized. So `def sameResult` returns different results for different orders of data/partition filters. This leads to, e.g. different decision for `ReuseExchange`, and thus results in unstable performance.
      
      ## How was this patch tested?
      
      Added a new test for `FileSourceScanExec.sameResult`.
      
      Author: wangzhenhua <wangzhenhua@huawei.com>
      
      Closes #17959 from wzhfy/canonicalizeFileSourceScanExec.
      c8da5356
Loading