Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
last fix
  • Loading branch information
cloud-fan committed May 26, 2017
commit f47922184e65312b47879c6d65e44bf25ea07606
5 changes: 3 additions & 2 deletions R/pkg/R/DataFrame.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,12 @@ setMethod("showDF",
signature(x = "SparkDataFrame"),
function(x, numRows = 20, truncate = TRUE, vertical = FALSE) {
if (is.logical(truncate) && truncate) {
s <- callJMethod(x@sdf, "showString", numToInt(numRows), numToInt(20), vertical)
s <- callJMethod(x@sdf, "showString", numToInt(numRows), numToInt(20),
vertical, FALSE)
} else {
truncate2 <- as.numeric(truncate)
s <- callJMethod(x@sdf, "showString", numToInt(numRows), numToInt(truncate2),
vertical)
vertical, FALSE)
}
cat(s)
})
Expand Down
4 changes: 2 additions & 2 deletions python/pyspark/sql/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,9 @@ def show(self, n=20, truncate=True, vertical=False):
name | Bob
"""
if isinstance(truncate, bool) and truncate:
print(self._jdf.showString(n, 20, vertical))
print(self._jdf.showString(n, 20, vertical, False))
else:
print(self._jdf.showString(n, int(truncate), vertical))
print(self._jdf.showString(n, int(truncate), vertical, False))

def __repr__(self):
return "DataFrame[%s]" % (", ".join("%s: %s" % c for c in self.dtypes))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ import org.apache.spark.{SparkConf, SparkContext}
import org.apache.spark.internal.Logging
import org.apache.spark.sql.{SparkSession, SQLContext}
import org.apache.spark.sql.catalyst.analysis.UnresolvedRelation
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
import org.apache.spark.sql.execution.QueryExecution
import org.apache.spark.sql.catalyst.plans.logical.{LogicalPlan, OneRowRelation}
import org.apache.spark.sql.execution.{QueryExecution, SQLExecution}
import org.apache.spark.sql.execution.command.CacheTableCommand
import org.apache.spark.sql.hive._
import org.apache.spark.sql.hive.client.HiveClient
Expand Down Expand Up @@ -456,7 +456,17 @@ private[hive] class TestHiveSparkSession(
logDebug(s"Loading test table $name")
val createCmds =
testTables.get(name).map(_.commands).getOrElse(sys.error(s"Unknown test table $name"))
createCmds.foreach(_())

// test tables are loaded lazily, so they may be loaded in the middle a query execution which
// has already set the execution id.
if (sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY) == null) {
// We don't actually have a `QueryExecution` here, use a fake one instead.
SQLExecution.withNewExecutionId(this, new QueryExecution(this, OneRowRelation)) {
createCmds.foreach(_())
}
} else {
createCmds.foreach(_())
}

if (cacheTables) {
new SQLContext(self).cacheTable(name)
Expand Down