Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11658#discussion_r56274754
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/SQLBuilder.scala ---
    @@ -109,23 +128,6 @@ class SQLBuilder(logicalPlan: LogicalPlan, sqlContext: 
SQLContext) extends Loggi
         case Limit(limitExpr, child) =>
           s"${toSQL(child)} LIMIT ${limitExpr.sql}"
     
    -    case p: Sample if p.isTableSample =>
    -      val fraction = math.min(100, math.max(0, (p.upperBound - 
p.lowerBound) * 100))
    -      p.child match {
    -        case m: MetastoreRelation =>
    -          val aliasName = m.alias.getOrElse("")
    -          build(
    -            s"`${m.databaseName}`.`${m.tableName}`",
    -            "TABLESAMPLE(" + fraction + " PERCENT)",
    -            aliasName)
    -        case s: SubqueryAlias =>
    -          val aliasName = if (s.child.isInstanceOf[SubqueryAlias]) s.alias 
else ""
    -          val plan = if (s.child.isInstanceOf[SubqueryAlias]) s.child else 
s
    -          build(toSQL(plan), "TABLESAMPLE(" + fraction + " PERCENT)", 
aliasName)
    -        case _ =>
    -          build(toSQL(p.child), "TABLESAMPLE(" + fraction + " PERCENT)")
    -      }
    --- End diff --
    
    I explained it in the comment of `ResolveSQLTable` rule. We only support 
table sample so any `Sample` operator that is not on top of table relation 
should throw exception.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to