Skip to content

Commit a049452

Browse files
author
Sun Rui
committed
Add a test case for SHARK-138.
1 parent 710e4dc commit a049452

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

data/files/test1.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1 012
2+
2 345
3+
3 678

src/main/scala/shark/execution/JoinOperator.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ import org.apache.hadoop.hive.conf.HiveConf
2727
import org.apache.hadoop.hive.ql.exec.{JoinOperator => HiveJoinOperator}
2828
import org.apache.hadoop.hive.ql.plan.{JoinDesc, TableDesc}
2929
import org.apache.hadoop.hive.serde2.{Deserializer, Serializer, SerDeUtils}
30-
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorUtils
31-
import org.apache.hadoop.hive.serde2.objectinspector.StandardStructObjectInspector
30+
import org.apache.hadoop.hive.serde2.objectinspector.{ObjectInspectorUtils, StandardStructObjectInspector}
3231
import org.apache.hadoop.io.BytesWritable
3332

3433
import shark.execution.serialization.OperatorSerializationWrapper

src/test/scala/shark/SQLSuite.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ class SQLSuite extends FunSuite with BeforeAndAfterAll {
7373
OVERWRITE INTO TABLE users""")
7474
sc.sql("drop table if exists users_cached")
7575
sc.sql("create table users_cached as select * from users")
76+
77+
// test1
78+
sc.sql("drop table if exists test1")
79+
sc.sql("""CREATE TABLE test1 (id INT, test1val ARRAY<INT>)
80+
row format delimited fields terminated by '\t'""")
81+
sc.sql("LOAD DATA LOCAL INPATH '${hiveconf:shark.test.data.path}/test1.txt' INTO TABLE test1")
82+
sc.sql("drop table if exists test1_cached")
83+
sc.sql("CREATE TABLE test1_cached AS SELECT * FROM test1")
7684
}
7785

7886
override def afterAll() {
@@ -141,6 +149,14 @@ class SQLSuite extends FunSuite with BeforeAndAfterAll {
141149
"val_98\t196")
142150
}
143151

152+
//////////////////////////////////////////////////////////////////////////////
153+
// join
154+
//////////////////////////////////////////////////////////////////////////////
155+
test("join ouput rows of stand objects") {
156+
expect("select test1val from users join test1 on users.id=test1.id and users.id=1",
157+
"[0,1,2]")
158+
}
159+
144160
//////////////////////////////////////////////////////////////////////////////
145161
// map join
146162
//////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)