Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
95b3301
Fixed bugs in IntegralDelta
liancheng Apr 8, 2014
052bf41
Bug fix: should only gather compressibility info for non-null values
liancheng Apr 8, 2014
44591a5
Bug fix: NullableColumnAccessor.hasNext must take nulls into account
liancheng Apr 9, 2014
036cd09
Clean up unused imports
liancheng Apr 9, 2014
8426ddc
Bug fix: InMemoryColumnarTableScan should cache columns specified by …
liancheng Apr 9, 2014
e619995
Bug fix: incorrect byte order in CompressionScheme.columnHeaderSize
liancheng Apr 9, 2014
9c8fc40
Disable compression by default
liancheng Apr 9, 2014
c9b0f6f
Let InsertIntoTable support InMemoryColumnarTableScan
liancheng Apr 9, 2014
6360723
Made PreInsertionCasts support SparkLogicalPlan and InMemoryColumnarT…
liancheng Apr 9, 2014
2d0e168
Run Hive tests in-memory too.
marmbrus Apr 8, 2014
e36cdd0
Spelling.
marmbrus Apr 10, 2014
1965123
Don't use coalesce for gathering all data to a single partition, as i…
marmbrus Apr 10, 2014
ab9e807
Fix the logged console version of failed test cases to use the new sy…
marmbrus Apr 10, 2014
d1df4fd
Remove test tables that might always get created anyway?
marmbrus Apr 10, 2014
4390bcc
Report error for any Throwable in HiveComparisonTest
liancheng Apr 11, 2014
99382bf
Enable compression by default
liancheng Apr 11, 2014
32cc9ce
Code style cleanup
liancheng Apr 11, 2014
882c538
Remove attributes field from InMemoryColumnarTableScan
liancheng Apr 11, 2014
5bdbfe7
Revert 882c538 & 8426ddc, which introduced regression
liancheng Apr 11, 2014
6ad6d9b
Merged HiveCompatibilitySuite and HiveInMemoryCompatibilitySuite
liancheng Apr 11, 2014
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
Revert 882c538 & 8426ddc, which introduced regression
  • Loading branch information
liancheng committed Apr 11, 2014
commit 5bdbfe7170e0bfbb09a7b43aec04dc4a1ee866f2
4 changes: 2 additions & 2 deletions sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
def cacheTable(tableName: String): Unit = {
val currentTable = catalog.lookupRelation(None, tableName)
val asInMemoryRelation =
InMemoryColumnarTableScan(executePlan(currentTable).executedPlan)
InMemoryColumnarTableScan(currentTable.output, executePlan(currentTable).executedPlan)

catalog.registerTable(None, tableName, SparkLogicalPlan(asInMemoryRelation))
}
Expand All @@ -131,7 +131,7 @@ class SQLContext(@transient val sparkContext: SparkContext)
EliminateAnalysisOperators(catalog.lookupRelation(None, tableName)) match {
// This is kind of a hack to make sure that if this was just an RDD registered as a table,
// we reregister the RDD as a table.
case SparkLogicalPlan(inMem @ InMemoryColumnarTableScan(e: ExistingRdd)) =>
case SparkLogicalPlan(inMem @ InMemoryColumnarTableScan(_, e: ExistingRdd)) =>
inMem.cachedColumnBuffers.unpersist()
catalog.unregisterTable(None, tableName)
catalog.registerTable(None, tableName, SparkLogicalPlan(e))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ import org.apache.spark.sql.catalyst.expressions.{GenericMutableRow, Attribute}
import org.apache.spark.sql.execution.{SparkPlan, LeafNode}
import org.apache.spark.sql.Row

private[sql] case class InMemoryColumnarTableScan(child: SparkPlan)
private[sql] case class InMemoryColumnarTableScan(attributes: Seq[Attribute], child: SparkPlan)
extends LeafNode {

override def output: Seq[Attribute] = child.output
override def output: Seq[Attribute] = attributes

lazy val cachedColumnBuffers = {
val childOutput = child.output
val output = child.output
val cached = child.execute().mapPartitions { iterator =>
val columnBuilders = childOutput.map { attribute =>
val columnBuilders = output.map { attribute =>
ColumnBuilder(ColumnType(attribute.dataType).typeId, 0, attribute.name)
}.toArray

var row: Row = null
while (iterator.hasNext) {
row = iterator.next()
var i = 0
while (i < childOutput.length) {
while (i < row.length) {
columnBuilders(i).appendFrom(row, i)
i += 1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ case class SparkLogicalPlan(alreadyPlanned: SparkPlan)
SparkLogicalPlan(
alreadyPlanned match {
case ExistingRdd(output, rdd) => ExistingRdd(output.map(_.newInstance), rdd)
case scan @ InMemoryColumnarTableScan(child) => scan
case scan @ InMemoryColumnarTableScan(output, child) =>
scan.copy(attributes = output.map(_.newInstance))
case _ => sys.error("Multiple instance of the same relation detected.")
}).asInstanceOf[this.type]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ class InMemoryColumnarQuerySuite extends QueryTest {

test("simple columnar query") {
val plan = TestSQLContext.executePlan(testData.logicalPlan).executedPlan
val scan = SparkLogicalPlan(InMemoryColumnarTableScan(plan))
val scan = SparkLogicalPlan(InMemoryColumnarTableScan(plan.output, plan))

checkAnswer(scan, testData.collect().toSeq)
}

test("projection") {
val plan = TestSQLContext.executePlan(testData.select('value, 'key).logicalPlan).executedPlan
val scan = SparkLogicalPlan(InMemoryColumnarTableScan(plan))
val scan = SparkLogicalPlan(InMemoryColumnarTableScan(plan.output, plan))

checkAnswer(scan, testData.collect().map {
case Row(key: Int, value: String) => value -> key
Expand All @@ -44,7 +44,7 @@ class InMemoryColumnarQuerySuite extends QueryTest {

test("SPARK-1436 regression: in-memory columns must be able to be accessed multiple times") {
val plan = TestSQLContext.executePlan(testData.logicalPlan).executedPlan
val scan = SparkLogicalPlan(InMemoryColumnarTableScan(plan))
val scan = SparkLogicalPlan(InMemoryColumnarTableScan(plan.output, plan))

checkAnswer(scan, testData.collect().toSeq)
checkAnswer(scan, testData.collect().toSeq)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with Logging {
castChildOutput(p, table, child)

case p @ logical.InsertIntoTable(SparkLogicalPlan(InMemoryColumnarTableScan(
HiveTableScan(_, table, _))), _, child, _) =>
_, HiveTableScan(_, table, _))), _, child, _) =>
castChildOutput(p, table, child)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ trait HiveStrategies {
case logical.InsertIntoTable(table: MetastoreRelation, partition, child, overwrite) =>
InsertIntoHiveTable(table, partition, planLater(child), overwrite)(hiveContext) :: Nil
case logical.InsertIntoTable(SparkLogicalPlan(InMemoryColumnarTableScan(
HiveTableScan(_, table, _))), partition, child, overwrite) =>
_, HiveTableScan(_, table, _))), partition, child, overwrite) =>
InsertIntoHiveTable(table, partition, planLater(child), overwrite)(hiveContext) :: Nil
case _ => Nil
}
Expand Down