diff --git a/data/files/smbdata.txt b/data/files/smbdata.txt new file mode 100644 index 0000000000000000000000000000000000000000..4422a548fbd8bfbdd42a06a267c1923ce3c6ef6a --- /dev/null +++ b/data/files/smbdata.txt @@ -0,0 +1,99 @@ +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/SMBMapJoinOperator.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/SMBMapJoinOperator.java index 23abec3b1d05b2ab0997734cad3fd72ce840902a..27b16735500697e6d1883e5763cdb9cad1ec948c 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/SMBMapJoinOperator.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/SMBMapJoinOperator.java @@ -350,7 +350,7 @@ private void joinFinalLeftData() throws HiveException { joinOneGroup(); dataInCache = false; for (byte pos = 0; pos < order.length; pos++) { - if (this.candidateStorage[pos].hasRows()) { + if (this.candidateStorage[pos] != null && this.candidateStorage[pos].hasRows()) { dataInCache = true; break; } diff --git a/ql/src/test/queries/clientpositive/smblimit.q b/ql/src/test/queries/clientpositive/smblimit.q new file mode 100644 index 0000000000000000000000000000000000000000..1db21675223e42606b209dd49b783610a2cc33d6 --- /dev/null +++ b/ql/src/test/queries/clientpositive/smblimit.q @@ -0,0 +1,12 @@ +drop table if exists hlp1; +drop table if exists btl; +create table hlp1(c string); +load data local inpath '../../data/files/smbdata.txt' into table hlp1; +create table btl(c string) clustered by (c) sorted by (c) into 5 buckets; +insert overwrite table btl select * from hlp1; +SET hive.auto.convert.sortmerge.join = true; +SET hive.auto.convert.sortmerge.join.bigtable.selection.policy = org.apache.hadoop.hive.ql.optimizer.LeftmostBigTableSelectorForAutoSMJ; +SET hive.optimize.bucketmapjoin = true; +SET hive.optimize.bucketmapjoin.sortedmerge = true; +select 1 from btl join btl t1 on btl.c=t1.c limit 1; + diff --git a/ql/src/test/results/clientpositive/smblimit.q.out b/ql/src/test/results/clientpositive/smblimit.q.out new file mode 100644 index 0000000000000000000000000000000000000000..64ca6041aec435f411b03773667c9d90ebde0265 --- /dev/null +++ b/ql/src/test/results/clientpositive/smblimit.q.out @@ -0,0 +1,50 @@ +PREHOOK: query: drop table if exists hlp1 +PREHOOK: type: DROPTABLE +POSTHOOK: query: drop table if exists hlp1 +POSTHOOK: type: DROPTABLE +PREHOOK: query: drop table if exists btl +PREHOOK: type: DROPTABLE +POSTHOOK: query: drop table if exists btl +POSTHOOK: type: DROPTABLE +PREHOOK: query: create table hlp1(c string) +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@hlp1 +POSTHOOK: query: create table hlp1(c string) +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@hlp1 +PREHOOK: query: load data local inpath '../../data/files/smbdata.txt' into table hlp1 +PREHOOK: type: LOAD +#### A masked pattern was here #### +PREHOOK: Output: default@hlp1 +POSTHOOK: query: load data local inpath '../../data/files/smbdata.txt' into table hlp1 +POSTHOOK: type: LOAD +#### A masked pattern was here #### +POSTHOOK: Output: default@hlp1 +PREHOOK: query: create table btl(c string) clustered by (c) sorted by (c) into 5 buckets +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@btl +POSTHOOK: query: create table btl(c string) clustered by (c) sorted by (c) into 5 buckets +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@btl +PREHOOK: query: insert overwrite table btl select * from hlp1 +PREHOOK: type: QUERY +PREHOOK: Input: default@hlp1 +PREHOOK: Output: default@btl +POSTHOOK: query: insert overwrite table btl select * from hlp1 +POSTHOOK: type: QUERY +POSTHOOK: Input: default@hlp1 +POSTHOOK: Output: default@btl +POSTHOOK: Lineage: btl.c SIMPLE [(hlp1)hlp1.FieldSchema(name:c, type:string, comment:null), ] +PREHOOK: query: select 1 from btl join btl t1 on btl.c=t1.c limit 1 +PREHOOK: type: QUERY +PREHOOK: Input: default@btl +#### A masked pattern was here #### +POSTHOOK: query: select 1 from btl join btl t1 on btl.c=t1.c limit 1 +POSTHOOK: type: QUERY +POSTHOOK: Input: default@btl +#### A masked pattern was here #### +1