diff --git a/data/files/decimal64table1.csv b/data/files/decimal64table1.csv new file mode 100644 index 0000000000..583a1de015 --- /dev/null +++ b/data/files/decimal64table1.csv @@ -0,0 +1,4 @@ +null,10,101,10 +1000,10,101,10 +1000,10,101,10 +1000,10,101,10 diff --git a/itests/src/test/resources/testconfiguration.properties b/itests/src/test/resources/testconfiguration.properties index dc4bf41113..028cbaf989 100644 --- a/itests/src/test/resources/testconfiguration.properties +++ b/itests/src/test/resources/testconfiguration.properties @@ -845,6 +845,7 @@ minillaplocal.query.files=\ vector_create_struct_table.q,\ vector_decimal_2.q,\ vector_decimal_udf.q,\ + vector_decimal64_case_when_nvl.q,\ vector_full_outer_join.q,\ vector_fullouter_mapjoin_1_fast.q,\ vector_fullouter_mapjoin_1_optimized.q,\ diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java index 627165d5be..1ab789ccd8 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java @@ -2473,14 +2473,39 @@ private VectorExpression getCoalesceExpression(List childExpr, final int size = vectorChildren.length; TypeInfo[] inputTypeInfos = new TypeInfo[size]; DataTypePhysicalVariation[] inputDataTypePhysicalVariations = new DataTypePhysicalVariation[size]; - int i = 0; - for (VectorExpression ve : vectorChildren) { + DataTypePhysicalVariation outputDataTypePhysicalVariation = DataTypePhysicalVariation.DECIMAL_64; + boolean fixConstants = false; + for (int i = 0; i < vectorChildren.length; ++i) { + VectorExpression ve = vectorChildren[i]; inputColumns[i] = ve.getOutputColumnNum(); inputTypeInfos[i] = ve.getOutputTypeInfo(); - inputDataTypePhysicalVariations[i++] = ve.getOutputDataTypePhysicalVariation(); + inputDataTypePhysicalVariations[i] = ve.getOutputDataTypePhysicalVariation(); + if (inputDataTypePhysicalVariations[i] == DataTypePhysicalVariation.NONE) { + if (childExpr.get(i) instanceof ExprNodeConstantDesc && inputTypeInfos[i] instanceof DecimalTypeInfo && + ((DecimalTypeInfo)inputTypeInfos[i]).precision() <= 18) { + fixConstants = true; + } else { + outputDataTypePhysicalVariation = DataTypePhysicalVariation.NONE; + } + } } - final int outputColumnNum = ocm.allocateOutputColumn(returnType); + if (outputDataTypePhysicalVariation == DataTypePhysicalVariation.DECIMAL_64 && fixConstants) { + for (int i = 0; i < vectorChildren.length; ++i) { + if (inputDataTypePhysicalVariations[i] == DataTypePhysicalVariation.NONE && + vectorChildren[i] instanceof ConstantVectorExpression) { + ConstantVectorExpression cve = ((ConstantVectorExpression)vectorChildren[i]); + HiveDecimal hd = cve.getDecimalValue(); + Long longValue = new HiveDecimalWritable(hd).serialize64(((DecimalTypeInfo)cve.getOutputTypeInfo()).getScale()); + ((ConstantVectorExpression)vectorChildren[i]).setLongValue(longValue); + vectorChildren[i].setOutputDataTypePhysicalVariation(DataTypePhysicalVariation.DECIMAL_64); + int scratchColIndex = vectorChildren[i].getOutputColumnNum() - ocm.initialOutputCol; + ocm.scratchDataTypePhysicalVariations[scratchColIndex] = DataTypePhysicalVariation.DECIMAL_64; + } + } + } + + final int outputColumnNum = ocm.allocateOutputColumn(returnType, outputDataTypePhysicalVariation); VectorCoalesce vectorCoalesce = new VectorCoalesce(inputColumns, outputColumnNum); vectorCoalesce.setChildExpressions(vectorChildren); @@ -2489,7 +2514,7 @@ private VectorExpression getCoalesceExpression(List childExpr, vectorCoalesce.setInputDataTypePhysicalVariations(inputDataTypePhysicalVariations); vectorCoalesce.setOutputTypeInfo(returnType); - vectorCoalesce.setOutputDataTypePhysicalVariation(DataTypePhysicalVariation.NONE); + vectorCoalesce.setOutputDataTypePhysicalVariation(outputDataTypePhysicalVariation); freeNonColumns(vectorChildren); @@ -3877,8 +3902,12 @@ private VectorExpression doGetIfExpression(GenericUDFIf genericUDFIf, List 17:boolean, IfExprStringScalarStringGroupColumn(col 18:boolean, val Twocol 22:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 18:boolean, IfExprStringScalarStringGroupColumn(col 19:boolean, val Somecol 21:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 19:boolean, IfExprStringScalarStringScalar(col 20:boolean, val Many, val Huge number)(children: LongColLessLongScalar(col 4:int, val 100) -> 20:boolean) -> 21:string) -> 22:string) -> 23:string) -> 24:string, IfExprStringScalarStringGroupColumn(col 25:boolean, val Singlecol 32:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 25:boolean, IfExprStringScalarStringGroupColumn(col 26:boolean, val Twocol 31:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 26:boolean, IfExprStringScalarStringGroupColumn(col 27:boolean, val Somecol 30:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 27:boolean, IfExprColumnNull(col 28:boolean, col 29:string, null)(children: LongColLessLongScalar(col 4:int, val 100) -> 28:boolean, ConstantVectorExpression(val Many) -> 29:string) -> 30:string) -> 31:string) -> 32:string) -> 33:string, IfExprStringScalarStringGroupColumn(col 34:boolean, val Singlecol 39:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 34:boolean, IfExprStringScalarStringGroupColumn(col 35:boolean, val Twocol 38:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 35:boolean, IfExprColumnNull(col 36:boolean, col 37:string, null)(children: LongColLessLongScalar(col 4:int, val 10) -> 36:boolean, ConstantVectorExpression(val Some) -> 37:string) -> 38:string) -> 39:string) -> 40:string, IfExprLongColumnLongColumn(col 41:boolean, col 42:date, col 43:date)(children: StringGroupColEqualCharScalar(col 14:char(10), val SHIP) -> 41:boolean, VectorUDFDateAddColScalar(col 10:date, val 10) -> 42:date, VectorUDFDateAddColScalar(col 10:date, val 5) -> 43:date) -> 44:date, IfExprDoubleColumnDoubleScalar(col 45:boolean, col 47:double, val 0.0)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 45:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 46:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 46:double) -> 47:double) -> 48:double, IfExprDoubleColumnDoubleScalar(col 49:boolean, col 51:double, val 0.0)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 49:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 50:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 50:double) -> 51:double) -> 52:double, IfExprNullColumn(col 53:boolean, null, col 78)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 53:boolean, ConvertDecimal64ToDecimal(col 7:decimal(10,2)/DECIMAL_64) -> 78:decimal(10,2)) -> 54:decimal(10,2), IfExprColumnNull(col 55:boolean, col 79:decimal(10,2), null)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 55:boolean, ConvertDecimal64ToDecimal(col 7:decimal(10,2)/DECIMAL_64) -> 79:decimal(10,2)) -> 56:decimal(10,2), VectorUDFAdaptor(if((l_shipinstruct = 'DELIVER IN PERSON'), 0, l_tax))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 57:boolean) -> 58:decimal(12,2), VectorUDFAdaptor(if((l_shipinstruct = 'TAKE BACK RETURN'), l_tax, 0))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 59:boolean) -> 60:decimal(12,2), IfExprDecimal64ScalarDecimal64Column(col 61:boolean, decimal64Val 0, decimalVal 0, col 7:decimal(10,2)/DECIMAL_64)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 61:boolean) -> 62:decimal(10,2)/DECIMAL_64, IfExprDecimal64ColumnDecimal64Scalar(col 63:boolean, col 7:decimal(10,2)/DECIMAL_64, decimal64Val 0, decimalVal 0)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 63:boolean) -> 64:decimal(10,2)/DECIMAL_64, IfExprTimestampColumnColumn(col 65:boolean, col 66:timestampcol 67:timestamp)(children: LongColGreaterLongScalar(col 1:int, val 30) -> 65:boolean, CastDateToTimestamp(col 12:date) -> 66:timestamp, CastDateToTimestamp(col 11:date) -> 67:timestamp) -> 68:timestamp, IfExprColumnNull(col 69:boolean, col 70:int, null)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 69:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 70:int) -> 71:int, IfExprNullColumn(col 72:boolean, null, col 73)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 72:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 73:int) -> 74:int, IfExprLongScalarLongScalar(col 76:boolean, val 14245, val 14609)(children: LongColGreaterLongScalar(col 75:int, val 100)(children: LongColModuloLongScalar(col 2:int, val 500) -> 75:int) -> 76:boolean) -> 77:date + selectExpressions: IfExprStringScalarStringGroupColumn(col 17:boolean, val Singlecol 23:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, IfExprStringScalarStringGroupColumn(col 18:boolean, val Twocol 22:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 18:boolean, IfExprStringScalarStringGroupColumn(col 19:boolean, val Somecol 21:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 19:boolean, IfExprStringScalarStringScalar(col 20:boolean, val Many, val Huge number)(children: LongColLessLongScalar(col 4:int, val 100) -> 20:boolean) -> 21:string) -> 22:string) -> 23:string) -> 24:string, IfExprStringScalarStringGroupColumn(col 25:boolean, val Singlecol 32:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 25:boolean, IfExprStringScalarStringGroupColumn(col 26:boolean, val Twocol 31:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 26:boolean, IfExprStringScalarStringGroupColumn(col 27:boolean, val Somecol 30:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 27:boolean, IfExprColumnNull(col 28:boolean, col 29:string, null)(children: LongColLessLongScalar(col 4:int, val 100) -> 28:boolean, ConstantVectorExpression(val Many) -> 29:string) -> 30:string) -> 31:string) -> 32:string) -> 33:string, IfExprStringScalarStringGroupColumn(col 34:boolean, val Singlecol 39:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 34:boolean, IfExprStringScalarStringGroupColumn(col 35:boolean, val Twocol 38:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 35:boolean, IfExprColumnNull(col 36:boolean, col 37:string, null)(children: LongColLessLongScalar(col 4:int, val 10) -> 36:boolean, ConstantVectorExpression(val Some) -> 37:string) -> 38:string) -> 39:string) -> 40:string, IfExprLongColumnLongColumn(col 41:boolean, col 42:date, col 43:date)(children: StringGroupColEqualCharScalar(col 14:char(10), val SHIP) -> 41:boolean, VectorUDFDateAddColScalar(col 10:date, val 10) -> 42:date, VectorUDFDateAddColScalar(col 10:date, val 5) -> 43:date) -> 44:date, IfExprDoubleColumnDoubleScalar(col 45:boolean, col 47:double, val 0.0)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 45:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 46:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 46:double) -> 47:double) -> 48:double, IfExprDoubleColumnDoubleScalar(col 49:boolean, col 51:double, val 0.0)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 49:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 50:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 50:double) -> 51:double) -> 52:double, IfExprNullColumn(col 53:boolean, null, col 7)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 53:boolean, col 7:decimal(10,2)/DECIMAL_64) -> 54:decimal(10,2)/DECIMAL_64, IfExprColumnNull(col 55:boolean, col 7:decimal(10,2)/DECIMAL_64, null)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 55:boolean, col 7:decimal(10,2)/DECIMAL_64) -> 56:decimal(10,2)/DECIMAL_64, VectorUDFAdaptor(if((l_shipinstruct = 'DELIVER IN PERSON'), 0, l_tax))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 57:boolean) -> 58:decimal(12,2), VectorUDFAdaptor(if((l_shipinstruct = 'TAKE BACK RETURN'), l_tax, 0))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 59:boolean) -> 60:decimal(12,2), IfExprDecimal64ScalarDecimal64Column(col 61:boolean, decimal64Val 0, decimalVal 0, col 7:decimal(10,2)/DECIMAL_64)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 61:boolean) -> 62:decimal(10,2)/DECIMAL_64, IfExprDecimal64ColumnDecimal64Scalar(col 63:boolean, col 7:decimal(10,2)/DECIMAL_64, decimal64Val 0, decimalVal 0)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 63:boolean) -> 64:decimal(10,2)/DECIMAL_64, IfExprTimestampColumnColumn(col 65:boolean, col 66:timestampcol 67:timestamp)(children: LongColGreaterLongScalar(col 1:int, val 30) -> 65:boolean, CastDateToTimestamp(col 12:date) -> 66:timestamp, CastDateToTimestamp(col 11:date) -> 67:timestamp) -> 68:timestamp, IfExprColumnNull(col 69:boolean, col 70:int, null)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 69:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 70:int) -> 71:int, IfExprNullColumn(col 72:boolean, null, col 73)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 72:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 73:int) -> 74:int, IfExprLongScalarLongScalar(col 76:boolean, val 14245, val 14609)(children: LongColGreaterLongScalar(col 75:int, val 100)(children: LongColModuloLongScalar(col 2:int, val 500) -> 75:int) -> 76:boolean) -> 77:date Statistics: Num rows: 101 Data size: 141804 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false @@ -580,7 +580,7 @@ STAGE PLANS: includeColumns: [1, 2, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14] dataColumns: l_orderkey:int, l_partkey:int, l_suppkey:int, l_linenumber:int, l_quantity:int, l_extendedprice:double, l_discount:double, l_tax:decimal(10,2)/DECIMAL_64, l_returnflag:char(1), l_linestatus:char(1), l_shipdate:date, l_commitdate:date, l_receiptdate:date, l_shipinstruct:varchar(20), l_shipmode:char(10), l_comment:string partitionColumnCount: 0 - scratchColumnTypeNames: [bigint, bigint, bigint, bigint, string, string, string, string, bigint, bigint, bigint, bigint, string, string, string, string, string, bigint, bigint, bigint, string, string, string, string, bigint, bigint, bigint, bigint, bigint, double, double, double, bigint, double, double, double, bigint, decimal(10,2), bigint, decimal(10,2), bigint, decimal(12,2), bigint, decimal(12,2), bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, timestamp, timestamp, timestamp, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, decimal(10,2), decimal(10,2)] + scratchColumnTypeNames: [bigint, bigint, bigint, bigint, string, string, string, string, bigint, bigint, bigint, bigint, string, string, string, string, string, bigint, bigint, bigint, string, string, string, string, bigint, bigint, bigint, bigint, bigint, double, double, double, bigint, double, double, double, bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(12,2), bigint, decimal(12,2), bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, timestamp, timestamp, timestamp, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint] Stage: Stage-0 Fetch Operator @@ -889,7 +889,7 @@ STAGE PLANS: className: VectorSelectOperator native: true projectedOutputColumnNums: [4, 27, 39, 48, 52, 57, 62, 64, 66, 71, 76, 78, 80, 84, 87, 90, 93] - selectExpressions: IfExprColumnCondExpr(col 17:boolean, col 18:stringcol 26:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, ConstantVectorExpression(val Single) -> 18:string, IfExprColumnCondExpr(col 19:boolean, col 20:stringcol 25:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 19:boolean, ConstantVectorExpression(val Two) -> 20:string, IfExprColumnCondExpr(col 21:boolean, col 22:stringcol 24:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 21:boolean, ConstantVectorExpression(val Some) -> 22:string, IfExprStringScalarStringScalar(col 23:boolean, val Many, val Huge number)(children: LongColLessLongScalar(col 4:int, val 100) -> 23:boolean) -> 24:string) -> 25:string) -> 26:string) -> 27:string, IfExprColumnCondExpr(col 28:boolean, col 29:stringcol 38:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 28:boolean, ConstantVectorExpression(val Single) -> 29:string, IfExprColumnCondExpr(col 30:boolean, col 31:stringcol 37:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 30:boolean, ConstantVectorExpression(val Two) -> 31:string, IfExprColumnCondExpr(col 32:boolean, col 33:stringcol 36:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 32:boolean, ConstantVectorExpression(val Some) -> 33:string, IfExprColumnNull(col 34:boolean, col 35:string, null)(children: LongColLessLongScalar(col 4:int, val 100) -> 34:boolean, ConstantVectorExpression(val Many) -> 35:string) -> 36:string) -> 37:string) -> 38:string) -> 39:string, IfExprColumnCondExpr(col 40:boolean, col 41:stringcol 47:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 40:boolean, ConstantVectorExpression(val Single) -> 41:string, IfExprColumnCondExpr(col 42:boolean, col 43:stringcol 46:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 42:boolean, ConstantVectorExpression(val Two) -> 43:string, IfExprColumnNull(col 44:boolean, col 45:string, null)(children: LongColLessLongScalar(col 4:int, val 10) -> 44:boolean, ConstantVectorExpression(val Some) -> 45:string) -> 46:string) -> 47:string) -> 48:string, IfExprCondExprCondExpr(col 49:boolean, col 50:datecol 51:date)(children: StringGroupColEqualCharScalar(col 14:char(10), val SHIP) -> 49:boolean, VectorUDFDateAddColScalar(col 10:date, val 10) -> 50:date, VectorUDFDateAddColScalar(col 10:date, val 5) -> 51:date) -> 52:date, IfExprCondExprColumn(col 53:boolean, col 55:double, col 56:double)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 53:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 54:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 54:double) -> 55:double, ConstantVectorExpression(val 0.0) -> 56:double) -> 57:double, IfExprCondExprColumn(col 58:boolean, col 60:double, col 61:double)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 58:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 59:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 59:double) -> 60:double, ConstantVectorExpression(val 0.0) -> 61:double) -> 62:double, IfExprNullColumn(col 63:boolean, null, col 94)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 63:boolean, ConvertDecimal64ToDecimal(col 7:decimal(10,2)/DECIMAL_64) -> 94:decimal(10,2)) -> 64:decimal(10,2), IfExprColumnNull(col 65:boolean, col 95:decimal(10,2), null)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 65:boolean, ConvertDecimal64ToDecimal(col 7:decimal(10,2)/DECIMAL_64) -> 95:decimal(10,2)) -> 66:decimal(10,2), VectorUDFAdaptor(if((l_shipinstruct = 'DELIVER IN PERSON'), 0, l_tax))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 70:boolean) -> 71:decimal(12,2), VectorUDFAdaptor(if((l_shipinstruct = 'TAKE BACK RETURN'), l_tax, 0))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 75:boolean) -> 76:decimal(12,2), IfExprDecimal64ScalarDecimal64Column(col 77:boolean, decimal64Val 0, decimalVal 0, col 7:decimal(10,2)/DECIMAL_64)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 77:boolean) -> 78:decimal(10,2)/DECIMAL_64, IfExprDecimal64ColumnDecimal64Scalar(col 79:boolean, col 7:decimal(10,2)/DECIMAL_64, decimal64Val 0, decimalVal 0)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 79:boolean) -> 80:decimal(10,2)/DECIMAL_64, IfExprCondExprCondExpr(col 81:boolean, col 82:timestampcol 83:timestamp)(children: LongColGreaterLongScalar(col 1:int, val 30) -> 81:boolean, CastDateToTimestamp(col 12:date) -> 82:timestamp, CastDateToTimestamp(col 11:date) -> 83:timestamp) -> 84:timestamp, IfExprCondExprNull(col 85:boolean, col 86:int, null)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 85:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 86:int) -> 87:int, IfExprNullCondExpr(col 88:boolean, null, col 89:int)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 88:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 89:int) -> 90:int, IfExprLongScalarLongScalar(col 92:boolean, val 14245, val 14609)(children: LongColGreaterLongScalar(col 91:int, val 100)(children: LongColModuloLongScalar(col 2:int, val 500) -> 91:int) -> 92:boolean) -> 93:date + selectExpressions: IfExprColumnCondExpr(col 17:boolean, col 18:stringcol 26:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, ConstantVectorExpression(val Single) -> 18:string, IfExprColumnCondExpr(col 19:boolean, col 20:stringcol 25:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 19:boolean, ConstantVectorExpression(val Two) -> 20:string, IfExprColumnCondExpr(col 21:boolean, col 22:stringcol 24:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 21:boolean, ConstantVectorExpression(val Some) -> 22:string, IfExprStringScalarStringScalar(col 23:boolean, val Many, val Huge number)(children: LongColLessLongScalar(col 4:int, val 100) -> 23:boolean) -> 24:string) -> 25:string) -> 26:string) -> 27:string, IfExprColumnCondExpr(col 28:boolean, col 29:stringcol 38:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 28:boolean, ConstantVectorExpression(val Single) -> 29:string, IfExprColumnCondExpr(col 30:boolean, col 31:stringcol 37:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 30:boolean, ConstantVectorExpression(val Two) -> 31:string, IfExprColumnCondExpr(col 32:boolean, col 33:stringcol 36:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 32:boolean, ConstantVectorExpression(val Some) -> 33:string, IfExprColumnNull(col 34:boolean, col 35:string, null)(children: LongColLessLongScalar(col 4:int, val 100) -> 34:boolean, ConstantVectorExpression(val Many) -> 35:string) -> 36:string) -> 37:string) -> 38:string) -> 39:string, IfExprColumnCondExpr(col 40:boolean, col 41:stringcol 47:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 40:boolean, ConstantVectorExpression(val Single) -> 41:string, IfExprColumnCondExpr(col 42:boolean, col 43:stringcol 46:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 42:boolean, ConstantVectorExpression(val Two) -> 43:string, IfExprColumnNull(col 44:boolean, col 45:string, null)(children: LongColLessLongScalar(col 4:int, val 10) -> 44:boolean, ConstantVectorExpression(val Some) -> 45:string) -> 46:string) -> 47:string) -> 48:string, IfExprCondExprCondExpr(col 49:boolean, col 50:datecol 51:date)(children: StringGroupColEqualCharScalar(col 14:char(10), val SHIP) -> 49:boolean, VectorUDFDateAddColScalar(col 10:date, val 10) -> 50:date, VectorUDFDateAddColScalar(col 10:date, val 5) -> 51:date) -> 52:date, IfExprCondExprColumn(col 53:boolean, col 55:double, col 56:double)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 53:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 54:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 54:double) -> 55:double, ConstantVectorExpression(val 0.0) -> 56:double) -> 57:double, IfExprCondExprColumn(col 58:boolean, col 60:double, col 61:double)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 58:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 59:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 59:double) -> 60:double, ConstantVectorExpression(val 0.0) -> 61:double) -> 62:double, IfExprNullColumn(col 63:boolean, null, col 7)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 63:boolean, col 7:decimal(10,2)/DECIMAL_64) -> 64:decimal(10,2)/DECIMAL_64, IfExprColumnNull(col 65:boolean, col 7:decimal(10,2)/DECIMAL_64, null)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 65:boolean, col 7:decimal(10,2)/DECIMAL_64) -> 66:decimal(10,2)/DECIMAL_64, VectorUDFAdaptor(if((l_shipinstruct = 'DELIVER IN PERSON'), 0, l_tax))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 70:boolean) -> 71:decimal(12,2), VectorUDFAdaptor(if((l_shipinstruct = 'TAKE BACK RETURN'), l_tax, 0))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 75:boolean) -> 76:decimal(12,2), IfExprDecimal64ScalarDecimal64Column(col 77:boolean, decimal64Val 0, decimalVal 0, col 7:decimal(10,2)/DECIMAL_64)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 77:boolean) -> 78:decimal(10,2)/DECIMAL_64, IfExprDecimal64ColumnDecimal64Scalar(col 79:boolean, col 7:decimal(10,2)/DECIMAL_64, decimal64Val 0, decimalVal 0)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 79:boolean) -> 80:decimal(10,2)/DECIMAL_64, IfExprCondExprCondExpr(col 81:boolean, col 82:timestampcol 83:timestamp)(children: LongColGreaterLongScalar(col 1:int, val 30) -> 81:boolean, CastDateToTimestamp(col 12:date) -> 82:timestamp, CastDateToTimestamp(col 11:date) -> 83:timestamp) -> 84:timestamp, IfExprCondExprNull(col 85:boolean, col 86:int, null)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 85:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 86:int) -> 87:int, IfExprNullCondExpr(col 88:boolean, null, col 89:int)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 88:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 89:int) -> 90:int, IfExprLongScalarLongScalar(col 92:boolean, val 14245, val 14609)(children: LongColGreaterLongScalar(col 91:int, val 100)(children: LongColModuloLongScalar(col 2:int, val 500) -> 91:int) -> 92:boolean) -> 93:date Statistics: Num rows: 101 Data size: 141804 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false @@ -917,7 +917,7 @@ STAGE PLANS: includeColumns: [1, 2, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14] dataColumns: l_orderkey:int, l_partkey:int, l_suppkey:int, l_linenumber:int, l_quantity:int, l_extendedprice:double, l_discount:double, l_tax:decimal(10,2)/DECIMAL_64, l_returnflag:char(1), l_linestatus:char(1), l_shipdate:date, l_commitdate:date, l_receiptdate:date, l_shipinstruct:varchar(20), l_shipmode:char(10), l_comment:string partitionColumnCount: 0 - scratchColumnTypeNames: [bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, bigint, bigint, bigint, bigint, double, double, double, double, bigint, double, double, double, double, bigint, decimal(10,2), bigint, decimal(10,2), bigint, bigint, decimal(12,2), bigint, decimal(12,2), bigint, decimal(12,2), bigint, bigint, decimal(12,2), bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, timestamp, timestamp, timestamp, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, decimal(10,2), decimal(10,2)] + scratchColumnTypeNames: [bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, bigint, bigint, bigint, bigint, double, double, double, double, bigint, double, double, double, double, bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, bigint, decimal(12,2), bigint, decimal(12,2), bigint, decimal(12,2), bigint, bigint, decimal(12,2), bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, timestamp, timestamp, timestamp, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint] Stage: Stage-0 Fetch Operator diff --git a/ql/src/test/results/clientpositive/llap/vector_decimal64_case_when_nvl.q.out b/ql/src/test/results/clientpositive/llap/vector_decimal64_case_when_nvl.q.out new file mode 100644 index 0000000000..2b480586f5 --- /dev/null +++ b/ql/src/test/results/clientpositive/llap/vector_decimal64_case_when_nvl.q.out @@ -0,0 +1,438 @@ +PREHOOK: query: create external table vector_decimal64_case_when(ss_ext_list_price decimal(7,2), ss_ext_wholesale_cost decimal(19,1), ss_ext_discount_amt int, ss_ext_sales_price double) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STORED AS TEXTFILE +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@vector_decimal64_case_when +POSTHOOK: query: create external table vector_decimal64_case_when(ss_ext_list_price decimal(7,2), ss_ext_wholesale_cost decimal(19,1), ss_ext_discount_amt int, ss_ext_sales_price double) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STORED AS TEXTFILE +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@vector_decimal64_case_when +PREHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/decimal64table1.csv' OVERWRITE INTO TABLE vector_decimal64_case_when +PREHOOK: type: LOAD +#### A masked pattern was here #### +PREHOOK: Output: default@vector_decimal64_case_when +POSTHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/decimal64table1.csv' OVERWRITE INTO TABLE vector_decimal64_case_when +POSTHOOK: type: LOAD +#### A masked pattern was here #### +POSTHOOK: Output: default@vector_decimal64_case_when +PREHOOK: query: create table vector_decimal64_case_when_tmp(ss_ext_list_price decimal(7,2), ss_ext_wholesale_cost decimal(19,1), ss_ext_discount_amt int, ss_ext_sales_price decimal(7,2)) stored as ORC +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@vector_decimal64_case_when_tmp +POSTHOOK: query: create table vector_decimal64_case_when_tmp(ss_ext_list_price decimal(7,2), ss_ext_wholesale_cost decimal(19,1), ss_ext_discount_amt int, ss_ext_sales_price decimal(7,2)) stored as ORC +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@vector_decimal64_case_when_tmp +PREHOOK: query: insert into table vector_decimal64_case_when_tmp select * from vector_decimal64_case_when +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when +PREHOOK: Output: default@vector_decimal64_case_when_tmp +POSTHOOK: query: insert into table vector_decimal64_case_when_tmp select * from vector_decimal64_case_when +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when +POSTHOOK: Output: default@vector_decimal64_case_when_tmp +POSTHOOK: Lineage: vector_decimal64_case_when_tmp.ss_ext_discount_amt SIMPLE [(vector_decimal64_case_when)vector_decimal64_case_when.FieldSchema(name:ss_ext_discount_amt, type:int, comment:null), ] +POSTHOOK: Lineage: vector_decimal64_case_when_tmp.ss_ext_list_price SIMPLE [(vector_decimal64_case_when)vector_decimal64_case_when.FieldSchema(name:ss_ext_list_price, type:decimal(7,2), comment:null), ] +POSTHOOK: Lineage: vector_decimal64_case_when_tmp.ss_ext_sales_price EXPRESSION [(vector_decimal64_case_when)vector_decimal64_case_when.FieldSchema(name:ss_ext_sales_price, type:double, comment:null), ] +POSTHOOK: Lineage: vector_decimal64_case_when_tmp.ss_ext_wholesale_cost SIMPLE [(vector_decimal64_case_when)vector_decimal64_case_when.FieldSchema(name:ss_ext_wholesale_cost, type:decimal(19,1), comment:null), ] +PREHOOK: query: explain vectorization detail select sum(case when (ss_ext_discount_amt=101) then ss_ext_list_price else null end) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: explain vectorization detail select sum(case when (ss_ext_discount_amt=101) then ss_ext_list_price else null end) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +PLAN VECTORIZATION: + enabled: true + enabledConditionsMet: [hive.vectorized.execution.enabled IS true] + +STAGE DEPENDENCIES: + Stage-1 is a root stage + Stage-0 depends on stages: Stage-1 + +STAGE PLANS: + Stage: Stage-1 + Tez +#### A masked pattern was here #### + Edges: + Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE) +#### A masked pattern was here #### + Vertices: + Map 1 + Map Operator Tree: + TableScan + alias: vector_decimal64_case_when_tmp + Statistics: Num rows: 4 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE + TableScan Vectorization: + native: true + vectorizationSchemaColumns: [0:ss_ext_list_price:decimal(7,2)/DECIMAL_64, 1:ss_ext_wholesale_cost:decimal(19,1), 2:ss_ext_discount_amt:int, 3:ss_ext_sales_price:decimal(7,2)/DECIMAL_64, 4:ROW__ID:struct] + Select Operator + expressions: ss_ext_list_price (type: decimal(7,2)), ss_ext_discount_amt (type: int) + outputColumnNames: ss_ext_list_price, ss_ext_discount_amt + Select Vectorization: + className: VectorSelectOperator + native: true + projectedOutputColumnNums: [0, 2] + Statistics: Num rows: 4 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE + Group By Operator + aggregations: sum(CASE WHEN ((ss_ext_discount_amt = 101)) THEN (ss_ext_list_price) ELSE (null) END) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal64(IfExprColumnNull(col 5:boolean, col 0:decimal(7,2)/DECIMAL_64, null)(children: LongColEqualLongScalar(col 2:int, val 101) -> 5:boolean, col 0:decimal(7,2)/DECIMAL_64) -> 6:decimal(7,2)/DECIMAL_64) -> decimal(17,2)/DECIMAL_64 + className: VectorGroupByOperator + groupByMode: HASH + native: false + vectorProcessingMode: HASH + projectedOutputColumnNums: [0] + minReductionHashAggr: 0.75 + mode: hash + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + null sort order: + sort order: + Reduce Sink Vectorization: + className: VectorReduceSinkEmptyKeyOperator + native: true + nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true + valueColumns: 0:decimal(17,2) + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + value expressions: _col0 (type: decimal(17,2)) + Execution mode: vectorized, llap + LLAP IO: all inputs + Map Vectorization: + enabled: true + enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true + inputFormatFeatureSupport: [DECIMAL_64] + featureSupportInUse: [DECIMAL_64] + inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 4 + includeColumns: [0, 2] + dataColumns: ss_ext_list_price:decimal(7,2)/DECIMAL_64, ss_ext_wholesale_cost:decimal(19,1), ss_ext_discount_amt:int, ss_ext_sales_price:decimal(7,2)/DECIMAL_64 + partitionColumnCount: 0 + scratchColumnTypeNames: [bigint, decimal(7,2)/DECIMAL_64] + Reducer 2 + Execution mode: vectorized, llap + Reduce Vectorization: + enabled: true + enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true + reduceColumnNullOrder: + reduceColumnSortOrder: + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 1 + dataColumns: VALUE._col0:decimal(17,2) + partitionColumnCount: 0 + scratchColumnTypeNames: [] + Reduce Operator Tree: + Group By Operator + aggregations: sum(VALUE._col0) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal(col 0:decimal(17,2)) -> decimal(17,2) + className: VectorGroupByOperator + groupByMode: MERGEPARTIAL + native: false + vectorProcessingMode: GLOBAL + projectedOutputColumnNums: [0] + mode: mergepartial + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + File Output Operator + compressed: false + File Sink Vectorization: + className: VectorFileSinkOperator + native: false + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: select sum(case when (ss_ext_discount_amt=101) then ss_ext_list_price else null end) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: select sum(case when (ss_ext_discount_amt=101) then ss_ext_list_price else null end) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +3000.00 +PREHOOK: query: explain vectorization detail select sum(NVL(ss_ext_list_price, 1.1)) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: explain vectorization detail select sum(NVL(ss_ext_list_price, 1.1)) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +PLAN VECTORIZATION: + enabled: true + enabledConditionsMet: [hive.vectorized.execution.enabled IS true] + +STAGE DEPENDENCIES: + Stage-1 is a root stage + Stage-0 depends on stages: Stage-1 + +STAGE PLANS: + Stage: Stage-1 + Tez +#### A masked pattern was here #### + Edges: + Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE) +#### A masked pattern was here #### + Vertices: + Map 1 + Map Operator Tree: + TableScan + alias: vector_decimal64_case_when_tmp + Statistics: Num rows: 4 Data size: 448 Basic stats: COMPLETE Column stats: COMPLETE + TableScan Vectorization: + native: true + vectorizationSchemaColumns: [0:ss_ext_list_price:decimal(7,2)/DECIMAL_64, 1:ss_ext_wholesale_cost:decimal(19,1), 2:ss_ext_discount_amt:int, 3:ss_ext_sales_price:decimal(7,2)/DECIMAL_64, 4:ROW__ID:struct] + Select Operator + expressions: ss_ext_list_price (type: decimal(7,2)) + outputColumnNames: ss_ext_list_price + Select Vectorization: + className: VectorSelectOperator + native: true + projectedOutputColumnNums: [0] + Statistics: Num rows: 4 Data size: 448 Basic stats: COMPLETE Column stats: COMPLETE + Group By Operator + aggregations: sum(COALESCE(ss_ext_list_price,1.1)) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal64(VectorCoalesce(columns [0, 5])(children: col 0:decimal(7,2)/DECIMAL_64, ConstantVectorExpression(val 1.1) -> 5:decimal(7,2)/DECIMAL_64) -> 6:decimal(7,2)/DECIMAL_64) -> decimal(17,2)/DECIMAL_64 + className: VectorGroupByOperator + groupByMode: HASH + native: false + vectorProcessingMode: HASH + projectedOutputColumnNums: [0] + minReductionHashAggr: 0.75 + mode: hash + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + null sort order: + sort order: + Reduce Sink Vectorization: + className: VectorReduceSinkEmptyKeyOperator + native: true + nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true + valueColumns: 0:decimal(17,2) + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + value expressions: _col0 (type: decimal(17,2)) + Execution mode: vectorized, llap + LLAP IO: all inputs + Map Vectorization: + enabled: true + enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true + inputFormatFeatureSupport: [DECIMAL_64] + featureSupportInUse: [DECIMAL_64] + inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 4 + includeColumns: [0] + dataColumns: ss_ext_list_price:decimal(7,2)/DECIMAL_64, ss_ext_wholesale_cost:decimal(19,1), ss_ext_discount_amt:int, ss_ext_sales_price:decimal(7,2)/DECIMAL_64 + partitionColumnCount: 0 + scratchColumnTypeNames: [decimal(7,2)/DECIMAL_64, decimal(7,2)/DECIMAL_64] + Reducer 2 + Execution mode: vectorized, llap + Reduce Vectorization: + enabled: true + enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true + reduceColumnNullOrder: + reduceColumnSortOrder: + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 1 + dataColumns: VALUE._col0:decimal(17,2) + partitionColumnCount: 0 + scratchColumnTypeNames: [] + Reduce Operator Tree: + Group By Operator + aggregations: sum(VALUE._col0) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal(col 0:decimal(17,2)) -> decimal(17,2) + className: VectorGroupByOperator + groupByMode: MERGEPARTIAL + native: false + vectorProcessingMode: GLOBAL + projectedOutputColumnNums: [0] + mode: mergepartial + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + File Output Operator + compressed: false + File Sink Vectorization: + className: VectorFileSinkOperator + native: false + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: select sum(NVL(ss_ext_list_price, 1.1)) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: select sum(NVL(ss_ext_list_price, 1.1)) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +3001.10 +PREHOOK: query: explain vectorization detail select sum(NVL(ss_ext_list_price, 1.1BD)) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: explain vectorization detail select sum(NVL(ss_ext_list_price, 1.1BD)) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +PLAN VECTORIZATION: + enabled: true + enabledConditionsMet: [hive.vectorized.execution.enabled IS true] + +STAGE DEPENDENCIES: + Stage-1 is a root stage + Stage-0 depends on stages: Stage-1 + +STAGE PLANS: + Stage: Stage-1 + Tez +#### A masked pattern was here #### + Edges: + Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE) +#### A masked pattern was here #### + Vertices: + Map 1 + Map Operator Tree: + TableScan + alias: vector_decimal64_case_when_tmp + Statistics: Num rows: 4 Data size: 448 Basic stats: COMPLETE Column stats: COMPLETE + TableScan Vectorization: + native: true + vectorizationSchemaColumns: [0:ss_ext_list_price:decimal(7,2)/DECIMAL_64, 1:ss_ext_wholesale_cost:decimal(19,1), 2:ss_ext_discount_amt:int, 3:ss_ext_sales_price:decimal(7,2)/DECIMAL_64, 4:ROW__ID:struct] + Select Operator + expressions: ss_ext_list_price (type: decimal(7,2)) + outputColumnNames: ss_ext_list_price + Select Vectorization: + className: VectorSelectOperator + native: true + projectedOutputColumnNums: [0] + Statistics: Num rows: 4 Data size: 448 Basic stats: COMPLETE Column stats: COMPLETE + Group By Operator + aggregations: sum(COALESCE(ss_ext_list_price,1.1)) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal64(VectorCoalesce(columns [0, 5])(children: col 0:decimal(7,2)/DECIMAL_64, ConstantVectorExpression(val 1.1) -> 5:decimal(7,2)/DECIMAL_64) -> 6:decimal(7,2)/DECIMAL_64) -> decimal(17,2)/DECIMAL_64 + className: VectorGroupByOperator + groupByMode: HASH + native: false + vectorProcessingMode: HASH + projectedOutputColumnNums: [0] + minReductionHashAggr: 0.75 + mode: hash + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + null sort order: + sort order: + Reduce Sink Vectorization: + className: VectorReduceSinkEmptyKeyOperator + native: true + nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true + valueColumns: 0:decimal(17,2) + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + value expressions: _col0 (type: decimal(17,2)) + Execution mode: vectorized, llap + LLAP IO: all inputs + Map Vectorization: + enabled: true + enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true + inputFormatFeatureSupport: [DECIMAL_64] + featureSupportInUse: [DECIMAL_64] + inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 4 + includeColumns: [0] + dataColumns: ss_ext_list_price:decimal(7,2)/DECIMAL_64, ss_ext_wholesale_cost:decimal(19,1), ss_ext_discount_amt:int, ss_ext_sales_price:decimal(7,2)/DECIMAL_64 + partitionColumnCount: 0 + scratchColumnTypeNames: [decimal(7,2)/DECIMAL_64, decimal(7,2)/DECIMAL_64] + Reducer 2 + Execution mode: vectorized, llap + Reduce Vectorization: + enabled: true + enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true + reduceColumnNullOrder: + reduceColumnSortOrder: + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 1 + dataColumns: VALUE._col0:decimal(17,2) + partitionColumnCount: 0 + scratchColumnTypeNames: [] + Reduce Operator Tree: + Group By Operator + aggregations: sum(VALUE._col0) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal(col 0:decimal(17,2)) -> decimal(17,2) + className: VectorGroupByOperator + groupByMode: MERGEPARTIAL + native: false + vectorProcessingMode: GLOBAL + projectedOutputColumnNums: [0] + mode: mergepartial + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + File Output Operator + compressed: false + File Sink Vectorization: + className: VectorFileSinkOperator + native: false + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: select sum(NVL(ss_ext_list_price, 1.1BD)) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: select sum(NVL(ss_ext_list_price, 1.1BD)) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +3001.10 diff --git a/ql/src/test/results/clientpositive/llap/vectorized_case.q.out b/ql/src/test/results/clientpositive/llap/vectorized_case.q.out index 5b8207fe7f..a1767021ee 100644 --- a/ql/src/test/results/clientpositive/llap/vectorized_case.q.out +++ b/ql/src/test/results/clientpositive/llap/vectorized_case.q.out @@ -618,7 +618,7 @@ STAGE PLANS: className: VectorSelectOperator native: true projectedOutputColumnNums: [6] - selectExpressions: IfExprCondExprCondExpr(col 3:boolean, col 7:decimal(11,0)col 8:decimal(11,0))(children: Decimal64ColEqualDecimal64Scalar(col 0:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 3:boolean, ConvertDecimal64ToDecimal(col 4:decimal(11,0)/DECIMAL_64)(children: Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 4:decimal(11,0)/DECIMAL_64) -> 7:decimal(11,0), ConvertDecimal64ToDecimal(col 5:decimal(11,0)/DECIMAL_64)(children: Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 2, decimalVal 2) -> 5:decimal(11,0)/DECIMAL_64) -> 8:decimal(11,0)) -> 6:decimal(11,0) + selectExpressions: IfExprCondExprCondExpr(col 3:boolean, col 4:decimal(11,0)/DECIMAL_64col 5:decimal(11,0)/DECIMAL_64)(children: Decimal64ColEqualDecimal64Scalar(col 0:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 3:boolean, Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 4:decimal(11,0)/DECIMAL_64, Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 2, decimalVal 2) -> 5:decimal(11,0)/DECIMAL_64) -> 6:decimal(11,0)/DECIMAL_64 Statistics: Num rows: 3 Data size: 336 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false @@ -646,7 +646,7 @@ STAGE PLANS: includeColumns: [0, 1] dataColumns: member:decimal(10,0)/DECIMAL_64, attr:decimal(10,0)/DECIMAL_64 partitionColumnCount: 0 - scratchColumnTypeNames: [bigint, decimal(11,0)/DECIMAL_64, decimal(11,0)/DECIMAL_64, decimal(11,0), decimal(11,0), decimal(11,0)] + scratchColumnTypeNames: [bigint, decimal(11,0)/DECIMAL_64, decimal(11,0)/DECIMAL_64, decimal(11,0)/DECIMAL_64] Stage: Stage-0 Fetch Operator diff --git a/ql/src/test/results/clientpositive/spark/vectorized_case.q.out b/ql/src/test/results/clientpositive/spark/vectorized_case.q.out index b86f9af329..423acc4b72 100644 --- a/ql/src/test/results/clientpositive/spark/vectorized_case.q.out +++ b/ql/src/test/results/clientpositive/spark/vectorized_case.q.out @@ -612,7 +612,7 @@ STAGE PLANS: className: VectorSelectOperator native: true projectedOutputColumnNums: [6] - selectExpressions: IfExprCondExprCondExpr(col 3:boolean, col 7:decimal(11,0)col 8:decimal(11,0))(children: Decimal64ColEqualDecimal64Scalar(col 0:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 3:boolean, ConvertDecimal64ToDecimal(col 4:decimal(11,0)/DECIMAL_64)(children: Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 4:decimal(11,0)/DECIMAL_64) -> 7:decimal(11,0), ConvertDecimal64ToDecimal(col 5:decimal(11,0)/DECIMAL_64)(children: Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 2, decimalVal 2) -> 5:decimal(11,0)/DECIMAL_64) -> 8:decimal(11,0)) -> 6:decimal(11,0) + selectExpressions: IfExprCondExprCondExpr(col 3:boolean, col 4:decimal(11,0)/DECIMAL_64col 5:decimal(11,0)/DECIMAL_64)(children: Decimal64ColEqualDecimal64Scalar(col 0:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 3:boolean, Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 4:decimal(11,0)/DECIMAL_64, Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 2, decimalVal 2) -> 5:decimal(11,0)/DECIMAL_64) -> 6:decimal(11,0)/DECIMAL_64 Statistics: Num rows: 3 Data size: 672 Basic stats: COMPLETE Column stats: NONE File Output Operator compressed: false @@ -639,7 +639,7 @@ STAGE PLANS: includeColumns: [0, 1] dataColumns: member:decimal(10,0)/DECIMAL_64, attr:decimal(10,0)/DECIMAL_64 partitionColumnCount: 0 - scratchColumnTypeNames: [bigint, decimal(11,0)/DECIMAL_64, decimal(11,0)/DECIMAL_64, decimal(11,0), decimal(11,0), decimal(11,0)] + scratchColumnTypeNames: [bigint, decimal(11,0)/DECIMAL_64, decimal(11,0)/DECIMAL_64, decimal(11,0)/DECIMAL_64] Stage: Stage-0 Fetch Operator diff --git a/ql/src/test/results/clientpositive/vector_case_when_1.q.out b/ql/src/test/results/clientpositive/vector_case_when_1.q.out index d6c8a3dac0..bedde47bc4 100644 --- a/ql/src/test/results/clientpositive/vector_case_when_1.q.out +++ b/ql/src/test/results/clientpositive/vector_case_when_1.q.out @@ -545,7 +545,7 @@ STAGE PLANS: className: VectorSelectOperator native: true projectedOutputColumnNums: [4, 24, 33, 40, 44, 48, 52, 54, 56, 58, 60, 62, 64, 68, 71, 74, 77] - selectExpressions: IfExprStringScalarStringGroupColumn(col 17:boolean, val Singlecol 23:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, IfExprStringScalarStringGroupColumn(col 18:boolean, val Twocol 22:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 18:boolean, IfExprStringScalarStringGroupColumn(col 19:boolean, val Somecol 21:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 19:boolean, IfExprStringScalarStringScalar(col 20:boolean, val Many, val Huge number)(children: LongColLessLongScalar(col 4:int, val 100) -> 20:boolean) -> 21:string) -> 22:string) -> 23:string) -> 24:string, IfExprStringScalarStringGroupColumn(col 25:boolean, val Singlecol 32:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 25:boolean, IfExprStringScalarStringGroupColumn(col 26:boolean, val Twocol 31:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 26:boolean, IfExprStringScalarStringGroupColumn(col 27:boolean, val Somecol 30:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 27:boolean, IfExprColumnNull(col 28:boolean, col 29:string, null)(children: LongColLessLongScalar(col 4:int, val 100) -> 28:boolean, ConstantVectorExpression(val Many) -> 29:string) -> 30:string) -> 31:string) -> 32:string) -> 33:string, IfExprStringScalarStringGroupColumn(col 34:boolean, val Singlecol 39:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 34:boolean, IfExprStringScalarStringGroupColumn(col 35:boolean, val Twocol 38:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 35:boolean, IfExprColumnNull(col 36:boolean, col 37:string, null)(children: LongColLessLongScalar(col 4:int, val 10) -> 36:boolean, ConstantVectorExpression(val Some) -> 37:string) -> 38:string) -> 39:string) -> 40:string, IfExprLongColumnLongColumn(col 41:boolean, col 42:date, col 43:date)(children: StringGroupColEqualCharScalar(col 14:char(10), val SHIP) -> 41:boolean, VectorUDFDateAddColScalar(col 10:date, val 10) -> 42:date, VectorUDFDateAddColScalar(col 10:date, val 5) -> 43:date) -> 44:date, IfExprDoubleColumnDoubleScalar(col 45:boolean, col 47:double, val 0.0)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 45:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 46:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 46:double) -> 47:double) -> 48:double, IfExprDoubleColumnDoubleScalar(col 49:boolean, col 51:double, val 0.0)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 49:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 50:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 50:double) -> 51:double) -> 52:double, IfExprNullColumn(col 53:boolean, null, col 78)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 53:boolean, ConvertDecimal64ToDecimal(col 7:decimal(10,2)/DECIMAL_64) -> 78:decimal(10,2)) -> 54:decimal(10,2), IfExprColumnNull(col 55:boolean, col 79:decimal(10,2), null)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 55:boolean, ConvertDecimal64ToDecimal(col 7:decimal(10,2)/DECIMAL_64) -> 79:decimal(10,2)) -> 56:decimal(10,2), VectorUDFAdaptor(if((l_shipinstruct = 'DELIVER IN PERSON'), 0, l_tax))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 57:boolean) -> 58:decimal(12,2), VectorUDFAdaptor(if((l_shipinstruct = 'TAKE BACK RETURN'), l_tax, 0))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 59:boolean) -> 60:decimal(12,2), IfExprDecimal64ScalarDecimal64Column(col 61:boolean, decimal64Val 0, decimalVal 0, col 7:decimal(10,2)/DECIMAL_64)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 61:boolean) -> 62:decimal(10,2)/DECIMAL_64, IfExprDecimal64ColumnDecimal64Scalar(col 63:boolean, col 7:decimal(10,2)/DECIMAL_64, decimal64Val 0, decimalVal 0)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 63:boolean) -> 64:decimal(10,2)/DECIMAL_64, IfExprTimestampColumnColumn(col 65:boolean, col 66:timestampcol 67:timestamp)(children: LongColGreaterLongScalar(col 1:int, val 30) -> 65:boolean, CastDateToTimestamp(col 12:date) -> 66:timestamp, CastDateToTimestamp(col 11:date) -> 67:timestamp) -> 68:timestamp, IfExprColumnNull(col 69:boolean, col 70:int, null)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 69:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 70:int) -> 71:int, IfExprNullColumn(col 72:boolean, null, col 73)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 72:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 73:int) -> 74:int, IfExprLongScalarLongScalar(col 76:boolean, val 14245, val 14609)(children: LongColGreaterLongScalar(col 75:int, val 100)(children: LongColModuloLongScalar(col 2:int, val 500) -> 75:int) -> 76:boolean) -> 77:date + selectExpressions: IfExprStringScalarStringGroupColumn(col 17:boolean, val Singlecol 23:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, IfExprStringScalarStringGroupColumn(col 18:boolean, val Twocol 22:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 18:boolean, IfExprStringScalarStringGroupColumn(col 19:boolean, val Somecol 21:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 19:boolean, IfExprStringScalarStringScalar(col 20:boolean, val Many, val Huge number)(children: LongColLessLongScalar(col 4:int, val 100) -> 20:boolean) -> 21:string) -> 22:string) -> 23:string) -> 24:string, IfExprStringScalarStringGroupColumn(col 25:boolean, val Singlecol 32:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 25:boolean, IfExprStringScalarStringGroupColumn(col 26:boolean, val Twocol 31:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 26:boolean, IfExprStringScalarStringGroupColumn(col 27:boolean, val Somecol 30:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 27:boolean, IfExprColumnNull(col 28:boolean, col 29:string, null)(children: LongColLessLongScalar(col 4:int, val 100) -> 28:boolean, ConstantVectorExpression(val Many) -> 29:string) -> 30:string) -> 31:string) -> 32:string) -> 33:string, IfExprStringScalarStringGroupColumn(col 34:boolean, val Singlecol 39:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 34:boolean, IfExprStringScalarStringGroupColumn(col 35:boolean, val Twocol 38:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 35:boolean, IfExprColumnNull(col 36:boolean, col 37:string, null)(children: LongColLessLongScalar(col 4:int, val 10) -> 36:boolean, ConstantVectorExpression(val Some) -> 37:string) -> 38:string) -> 39:string) -> 40:string, IfExprLongColumnLongColumn(col 41:boolean, col 42:date, col 43:date)(children: StringGroupColEqualCharScalar(col 14:char(10), val SHIP) -> 41:boolean, VectorUDFDateAddColScalar(col 10:date, val 10) -> 42:date, VectorUDFDateAddColScalar(col 10:date, val 5) -> 43:date) -> 44:date, IfExprDoubleColumnDoubleScalar(col 45:boolean, col 47:double, val 0.0)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 45:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 46:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 46:double) -> 47:double) -> 48:double, IfExprDoubleColumnDoubleScalar(col 49:boolean, col 51:double, val 0.0)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 49:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 50:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 50:double) -> 51:double) -> 52:double, IfExprNullColumn(col 53:boolean, null, col 7)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 53:boolean, col 7:decimal(10,2)/DECIMAL_64) -> 54:decimal(10,2)/DECIMAL_64, IfExprColumnNull(col 55:boolean, col 7:decimal(10,2)/DECIMAL_64, null)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 55:boolean, col 7:decimal(10,2)/DECIMAL_64) -> 56:decimal(10,2)/DECIMAL_64, VectorUDFAdaptor(if((l_shipinstruct = 'DELIVER IN PERSON'), 0, l_tax))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 57:boolean) -> 58:decimal(12,2), VectorUDFAdaptor(if((l_shipinstruct = 'TAKE BACK RETURN'), l_tax, 0))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 59:boolean) -> 60:decimal(12,2), IfExprDecimal64ScalarDecimal64Column(col 61:boolean, decimal64Val 0, decimalVal 0, col 7:decimal(10,2)/DECIMAL_64)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 61:boolean) -> 62:decimal(10,2)/DECIMAL_64, IfExprDecimal64ColumnDecimal64Scalar(col 63:boolean, col 7:decimal(10,2)/DECIMAL_64, decimal64Val 0, decimalVal 0)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 63:boolean) -> 64:decimal(10,2)/DECIMAL_64, IfExprTimestampColumnColumn(col 65:boolean, col 66:timestampcol 67:timestamp)(children: LongColGreaterLongScalar(col 1:int, val 30) -> 65:boolean, CastDateToTimestamp(col 12:date) -> 66:timestamp, CastDateToTimestamp(col 11:date) -> 67:timestamp) -> 68:timestamp, IfExprColumnNull(col 69:boolean, col 70:int, null)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 69:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 70:int) -> 71:int, IfExprNullColumn(col 72:boolean, null, col 73)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 72:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 73:int) -> 74:int, IfExprLongScalarLongScalar(col 76:boolean, val 14245, val 14609)(children: LongColGreaterLongScalar(col 75:int, val 100)(children: LongColModuloLongScalar(col 2:int, val 500) -> 75:int) -> 76:boolean) -> 77:date Statistics: Num rows: 101 Data size: 141804 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false @@ -572,7 +572,7 @@ STAGE PLANS: includeColumns: [1, 2, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14] dataColumns: l_orderkey:int, l_partkey:int, l_suppkey:int, l_linenumber:int, l_quantity:int, l_extendedprice:double, l_discount:double, l_tax:decimal(10,2)/DECIMAL_64, l_returnflag:char(1), l_linestatus:char(1), l_shipdate:date, l_commitdate:date, l_receiptdate:date, l_shipinstruct:varchar(20), l_shipmode:char(10), l_comment:string partitionColumnCount: 0 - scratchColumnTypeNames: [bigint, bigint, bigint, bigint, string, string, string, string, bigint, bigint, bigint, bigint, string, string, string, string, string, bigint, bigint, bigint, string, string, string, string, bigint, bigint, bigint, bigint, bigint, double, double, double, bigint, double, double, double, bigint, decimal(10,2), bigint, decimal(10,2), bigint, decimal(12,2), bigint, decimal(12,2), bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, timestamp, timestamp, timestamp, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, decimal(10,2), decimal(10,2)] + scratchColumnTypeNames: [bigint, bigint, bigint, bigint, string, string, string, string, bigint, bigint, bigint, bigint, string, string, string, string, string, bigint, bigint, bigint, string, string, string, string, bigint, bigint, bigint, bigint, bigint, double, double, double, bigint, double, double, double, bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(12,2), bigint, decimal(12,2), bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, timestamp, timestamp, timestamp, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint] Stage: Stage-0 Fetch Operator @@ -878,7 +878,7 @@ STAGE PLANS: className: VectorSelectOperator native: true projectedOutputColumnNums: [4, 27, 39, 48, 52, 57, 62, 64, 66, 71, 76, 78, 80, 84, 87, 90, 93] - selectExpressions: IfExprColumnCondExpr(col 17:boolean, col 18:stringcol 26:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, ConstantVectorExpression(val Single) -> 18:string, IfExprColumnCondExpr(col 19:boolean, col 20:stringcol 25:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 19:boolean, ConstantVectorExpression(val Two) -> 20:string, IfExprColumnCondExpr(col 21:boolean, col 22:stringcol 24:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 21:boolean, ConstantVectorExpression(val Some) -> 22:string, IfExprStringScalarStringScalar(col 23:boolean, val Many, val Huge number)(children: LongColLessLongScalar(col 4:int, val 100) -> 23:boolean) -> 24:string) -> 25:string) -> 26:string) -> 27:string, IfExprColumnCondExpr(col 28:boolean, col 29:stringcol 38:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 28:boolean, ConstantVectorExpression(val Single) -> 29:string, IfExprColumnCondExpr(col 30:boolean, col 31:stringcol 37:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 30:boolean, ConstantVectorExpression(val Two) -> 31:string, IfExprColumnCondExpr(col 32:boolean, col 33:stringcol 36:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 32:boolean, ConstantVectorExpression(val Some) -> 33:string, IfExprColumnNull(col 34:boolean, col 35:string, null)(children: LongColLessLongScalar(col 4:int, val 100) -> 34:boolean, ConstantVectorExpression(val Many) -> 35:string) -> 36:string) -> 37:string) -> 38:string) -> 39:string, IfExprColumnCondExpr(col 40:boolean, col 41:stringcol 47:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 40:boolean, ConstantVectorExpression(val Single) -> 41:string, IfExprColumnCondExpr(col 42:boolean, col 43:stringcol 46:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 42:boolean, ConstantVectorExpression(val Two) -> 43:string, IfExprColumnNull(col 44:boolean, col 45:string, null)(children: LongColLessLongScalar(col 4:int, val 10) -> 44:boolean, ConstantVectorExpression(val Some) -> 45:string) -> 46:string) -> 47:string) -> 48:string, IfExprCondExprCondExpr(col 49:boolean, col 50:datecol 51:date)(children: StringGroupColEqualCharScalar(col 14:char(10), val SHIP) -> 49:boolean, VectorUDFDateAddColScalar(col 10:date, val 10) -> 50:date, VectorUDFDateAddColScalar(col 10:date, val 5) -> 51:date) -> 52:date, IfExprCondExprColumn(col 53:boolean, col 55:double, col 56:double)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 53:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 54:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 54:double) -> 55:double, ConstantVectorExpression(val 0.0) -> 56:double) -> 57:double, IfExprCondExprColumn(col 58:boolean, col 60:double, col 61:double)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 58:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 59:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 59:double) -> 60:double, ConstantVectorExpression(val 0.0) -> 61:double) -> 62:double, IfExprNullColumn(col 63:boolean, null, col 94)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 63:boolean, ConvertDecimal64ToDecimal(col 7:decimal(10,2)/DECIMAL_64) -> 94:decimal(10,2)) -> 64:decimal(10,2), IfExprColumnNull(col 65:boolean, col 95:decimal(10,2), null)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 65:boolean, ConvertDecimal64ToDecimal(col 7:decimal(10,2)/DECIMAL_64) -> 95:decimal(10,2)) -> 66:decimal(10,2), VectorUDFAdaptor(if((l_shipinstruct = 'DELIVER IN PERSON'), 0, l_tax))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 70:boolean) -> 71:decimal(12,2), VectorUDFAdaptor(if((l_shipinstruct = 'TAKE BACK RETURN'), l_tax, 0))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 75:boolean) -> 76:decimal(12,2), IfExprDecimal64ScalarDecimal64Column(col 77:boolean, decimal64Val 0, decimalVal 0, col 7:decimal(10,2)/DECIMAL_64)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 77:boolean) -> 78:decimal(10,2)/DECIMAL_64, IfExprDecimal64ColumnDecimal64Scalar(col 79:boolean, col 7:decimal(10,2)/DECIMAL_64, decimal64Val 0, decimalVal 0)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 79:boolean) -> 80:decimal(10,2)/DECIMAL_64, IfExprCondExprCondExpr(col 81:boolean, col 82:timestampcol 83:timestamp)(children: LongColGreaterLongScalar(col 1:int, val 30) -> 81:boolean, CastDateToTimestamp(col 12:date) -> 82:timestamp, CastDateToTimestamp(col 11:date) -> 83:timestamp) -> 84:timestamp, IfExprCondExprNull(col 85:boolean, col 86:int, null)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 85:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 86:int) -> 87:int, IfExprNullCondExpr(col 88:boolean, null, col 89:int)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 88:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 89:int) -> 90:int, IfExprLongScalarLongScalar(col 92:boolean, val 14245, val 14609)(children: LongColGreaterLongScalar(col 91:int, val 100)(children: LongColModuloLongScalar(col 2:int, val 500) -> 91:int) -> 92:boolean) -> 93:date + selectExpressions: IfExprColumnCondExpr(col 17:boolean, col 18:stringcol 26:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 17:boolean, ConstantVectorExpression(val Single) -> 18:string, IfExprColumnCondExpr(col 19:boolean, col 20:stringcol 25:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 19:boolean, ConstantVectorExpression(val Two) -> 20:string, IfExprColumnCondExpr(col 21:boolean, col 22:stringcol 24:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 21:boolean, ConstantVectorExpression(val Some) -> 22:string, IfExprStringScalarStringScalar(col 23:boolean, val Many, val Huge number)(children: LongColLessLongScalar(col 4:int, val 100) -> 23:boolean) -> 24:string) -> 25:string) -> 26:string) -> 27:string, IfExprColumnCondExpr(col 28:boolean, col 29:stringcol 38:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 28:boolean, ConstantVectorExpression(val Single) -> 29:string, IfExprColumnCondExpr(col 30:boolean, col 31:stringcol 37:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 30:boolean, ConstantVectorExpression(val Two) -> 31:string, IfExprColumnCondExpr(col 32:boolean, col 33:stringcol 36:string)(children: LongColLessLongScalar(col 4:int, val 10) -> 32:boolean, ConstantVectorExpression(val Some) -> 33:string, IfExprColumnNull(col 34:boolean, col 35:string, null)(children: LongColLessLongScalar(col 4:int, val 100) -> 34:boolean, ConstantVectorExpression(val Many) -> 35:string) -> 36:string) -> 37:string) -> 38:string) -> 39:string, IfExprColumnCondExpr(col 40:boolean, col 41:stringcol 47:string)(children: LongColEqualLongScalar(col 4:int, val 1) -> 40:boolean, ConstantVectorExpression(val Single) -> 41:string, IfExprColumnCondExpr(col 42:boolean, col 43:stringcol 46:string)(children: LongColEqualLongScalar(col 4:int, val 2) -> 42:boolean, ConstantVectorExpression(val Two) -> 43:string, IfExprColumnNull(col 44:boolean, col 45:string, null)(children: LongColLessLongScalar(col 4:int, val 10) -> 44:boolean, ConstantVectorExpression(val Some) -> 45:string) -> 46:string) -> 47:string) -> 48:string, IfExprCondExprCondExpr(col 49:boolean, col 50:datecol 51:date)(children: StringGroupColEqualCharScalar(col 14:char(10), val SHIP) -> 49:boolean, VectorUDFDateAddColScalar(col 10:date, val 10) -> 50:date, VectorUDFDateAddColScalar(col 10:date, val 5) -> 51:date) -> 52:date, IfExprCondExprColumn(col 53:boolean, col 55:double, col 56:double)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 53:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 54:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 54:double) -> 55:double, ConstantVectorExpression(val 0.0) -> 56:double) -> 57:double, IfExprCondExprColumn(col 58:boolean, col 60:double, col 61:double)(children: StringGroupColEqualCharScalar(col 8:char(1), val N) -> 58:boolean, DoubleColMultiplyDoubleColumn(col 5:double, col 59:double)(children: DoubleScalarSubtractDoubleColumn(val 1.0, col 6:double) -> 59:double) -> 60:double, ConstantVectorExpression(val 0.0) -> 61:double) -> 62:double, IfExprNullColumn(col 63:boolean, null, col 7)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 63:boolean, col 7:decimal(10,2)/DECIMAL_64) -> 64:decimal(10,2)/DECIMAL_64, IfExprColumnNull(col 65:boolean, col 7:decimal(10,2)/DECIMAL_64, null)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 65:boolean, col 7:decimal(10,2)/DECIMAL_64) -> 66:decimal(10,2)/DECIMAL_64, VectorUDFAdaptor(if((l_shipinstruct = 'DELIVER IN PERSON'), 0, l_tax))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 70:boolean) -> 71:decimal(12,2), VectorUDFAdaptor(if((l_shipinstruct = 'TAKE BACK RETURN'), l_tax, 0))(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 75:boolean) -> 76:decimal(12,2), IfExprDecimal64ScalarDecimal64Column(col 77:boolean, decimal64Val 0, decimalVal 0, col 7:decimal(10,2)/DECIMAL_64)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val DELIVER IN PERSON) -> 77:boolean) -> 78:decimal(10,2)/DECIMAL_64, IfExprDecimal64ColumnDecimal64Scalar(col 79:boolean, col 7:decimal(10,2)/DECIMAL_64, decimal64Val 0, decimalVal 0)(children: StringGroupColEqualVarCharScalar(col 13:varchar(20), val TAKE BACK RETURN) -> 79:boolean) -> 80:decimal(10,2)/DECIMAL_64, IfExprCondExprCondExpr(col 81:boolean, col 82:timestampcol 83:timestamp)(children: LongColGreaterLongScalar(col 1:int, val 30) -> 81:boolean, CastDateToTimestamp(col 12:date) -> 82:timestamp, CastDateToTimestamp(col 11:date) -> 83:timestamp) -> 84:timestamp, IfExprCondExprNull(col 85:boolean, col 86:int, null)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 85:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 86:int) -> 87:int, IfExprNullCondExpr(col 88:boolean, null, col 89:int)(children: LongColGreaterLongScalar(col 2:int, val 10000) -> 88:boolean, VectorUDFDateDiffColCol(col 12:date, col 11:date) -> 89:int) -> 90:int, IfExprLongScalarLongScalar(col 92:boolean, val 14245, val 14609)(children: LongColGreaterLongScalar(col 91:int, val 100)(children: LongColModuloLongScalar(col 2:int, val 500) -> 91:int) -> 92:boolean) -> 93:date Statistics: Num rows: 101 Data size: 141804 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false @@ -905,7 +905,7 @@ STAGE PLANS: includeColumns: [1, 2, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14] dataColumns: l_orderkey:int, l_partkey:int, l_suppkey:int, l_linenumber:int, l_quantity:int, l_extendedprice:double, l_discount:double, l_tax:decimal(10,2)/DECIMAL_64, l_returnflag:char(1), l_linestatus:char(1), l_shipdate:date, l_commitdate:date, l_receiptdate:date, l_shipinstruct:varchar(20), l_shipmode:char(10), l_comment:string partitionColumnCount: 0 - scratchColumnTypeNames: [bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, bigint, bigint, bigint, bigint, double, double, double, double, bigint, double, double, double, double, bigint, decimal(10,2), bigint, decimal(10,2), bigint, bigint, decimal(12,2), bigint, decimal(12,2), bigint, decimal(12,2), bigint, bigint, decimal(12,2), bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, timestamp, timestamp, timestamp, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, decimal(10,2), decimal(10,2)] + scratchColumnTypeNames: [bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, string, bigint, string, bigint, string, bigint, string, string, string, string, string, bigint, string, bigint, string, bigint, string, string, string, string, bigint, bigint, bigint, bigint, bigint, double, double, double, double, bigint, double, double, double, double, bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, bigint, decimal(12,2), bigint, decimal(12,2), bigint, decimal(12,2), bigint, bigint, decimal(12,2), bigint, decimal(10,2)/DECIMAL_64, bigint, decimal(10,2)/DECIMAL_64, bigint, timestamp, timestamp, timestamp, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint] Stage: Stage-0 Fetch Operator diff --git a/ql/src/test/results/clientpositive/vector_decimal64_case_when_nvl.q.out b/ql/src/test/results/clientpositive/vector_decimal64_case_when_nvl.q.out new file mode 100644 index 0000000000..2b480586f5 --- /dev/null +++ b/ql/src/test/results/clientpositive/vector_decimal64_case_when_nvl.q.out @@ -0,0 +1,438 @@ +PREHOOK: query: create external table vector_decimal64_case_when(ss_ext_list_price decimal(7,2), ss_ext_wholesale_cost decimal(19,1), ss_ext_discount_amt int, ss_ext_sales_price double) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STORED AS TEXTFILE +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@vector_decimal64_case_when +POSTHOOK: query: create external table vector_decimal64_case_when(ss_ext_list_price decimal(7,2), ss_ext_wholesale_cost decimal(19,1), ss_ext_discount_amt int, ss_ext_sales_price double) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' STORED AS TEXTFILE +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@vector_decimal64_case_when +PREHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/decimal64table1.csv' OVERWRITE INTO TABLE vector_decimal64_case_when +PREHOOK: type: LOAD +#### A masked pattern was here #### +PREHOOK: Output: default@vector_decimal64_case_when +POSTHOOK: query: LOAD DATA LOCAL INPATH '../../data/files/decimal64table1.csv' OVERWRITE INTO TABLE vector_decimal64_case_when +POSTHOOK: type: LOAD +#### A masked pattern was here #### +POSTHOOK: Output: default@vector_decimal64_case_when +PREHOOK: query: create table vector_decimal64_case_when_tmp(ss_ext_list_price decimal(7,2), ss_ext_wholesale_cost decimal(19,1), ss_ext_discount_amt int, ss_ext_sales_price decimal(7,2)) stored as ORC +PREHOOK: type: CREATETABLE +PREHOOK: Output: database:default +PREHOOK: Output: default@vector_decimal64_case_when_tmp +POSTHOOK: query: create table vector_decimal64_case_when_tmp(ss_ext_list_price decimal(7,2), ss_ext_wholesale_cost decimal(19,1), ss_ext_discount_amt int, ss_ext_sales_price decimal(7,2)) stored as ORC +POSTHOOK: type: CREATETABLE +POSTHOOK: Output: database:default +POSTHOOK: Output: default@vector_decimal64_case_when_tmp +PREHOOK: query: insert into table vector_decimal64_case_when_tmp select * from vector_decimal64_case_when +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when +PREHOOK: Output: default@vector_decimal64_case_when_tmp +POSTHOOK: query: insert into table vector_decimal64_case_when_tmp select * from vector_decimal64_case_when +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when +POSTHOOK: Output: default@vector_decimal64_case_when_tmp +POSTHOOK: Lineage: vector_decimal64_case_when_tmp.ss_ext_discount_amt SIMPLE [(vector_decimal64_case_when)vector_decimal64_case_when.FieldSchema(name:ss_ext_discount_amt, type:int, comment:null), ] +POSTHOOK: Lineage: vector_decimal64_case_when_tmp.ss_ext_list_price SIMPLE [(vector_decimal64_case_when)vector_decimal64_case_when.FieldSchema(name:ss_ext_list_price, type:decimal(7,2), comment:null), ] +POSTHOOK: Lineage: vector_decimal64_case_when_tmp.ss_ext_sales_price EXPRESSION [(vector_decimal64_case_when)vector_decimal64_case_when.FieldSchema(name:ss_ext_sales_price, type:double, comment:null), ] +POSTHOOK: Lineage: vector_decimal64_case_when_tmp.ss_ext_wholesale_cost SIMPLE [(vector_decimal64_case_when)vector_decimal64_case_when.FieldSchema(name:ss_ext_wholesale_cost, type:decimal(19,1), comment:null), ] +PREHOOK: query: explain vectorization detail select sum(case when (ss_ext_discount_amt=101) then ss_ext_list_price else null end) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: explain vectorization detail select sum(case when (ss_ext_discount_amt=101) then ss_ext_list_price else null end) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +PLAN VECTORIZATION: + enabled: true + enabledConditionsMet: [hive.vectorized.execution.enabled IS true] + +STAGE DEPENDENCIES: + Stage-1 is a root stage + Stage-0 depends on stages: Stage-1 + +STAGE PLANS: + Stage: Stage-1 + Tez +#### A masked pattern was here #### + Edges: + Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE) +#### A masked pattern was here #### + Vertices: + Map 1 + Map Operator Tree: + TableScan + alias: vector_decimal64_case_when_tmp + Statistics: Num rows: 4 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE + TableScan Vectorization: + native: true + vectorizationSchemaColumns: [0:ss_ext_list_price:decimal(7,2)/DECIMAL_64, 1:ss_ext_wholesale_cost:decimal(19,1), 2:ss_ext_discount_amt:int, 3:ss_ext_sales_price:decimal(7,2)/DECIMAL_64, 4:ROW__ID:struct] + Select Operator + expressions: ss_ext_list_price (type: decimal(7,2)), ss_ext_discount_amt (type: int) + outputColumnNames: ss_ext_list_price, ss_ext_discount_amt + Select Vectorization: + className: VectorSelectOperator + native: true + projectedOutputColumnNums: [0, 2] + Statistics: Num rows: 4 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE + Group By Operator + aggregations: sum(CASE WHEN ((ss_ext_discount_amt = 101)) THEN (ss_ext_list_price) ELSE (null) END) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal64(IfExprColumnNull(col 5:boolean, col 0:decimal(7,2)/DECIMAL_64, null)(children: LongColEqualLongScalar(col 2:int, val 101) -> 5:boolean, col 0:decimal(7,2)/DECIMAL_64) -> 6:decimal(7,2)/DECIMAL_64) -> decimal(17,2)/DECIMAL_64 + className: VectorGroupByOperator + groupByMode: HASH + native: false + vectorProcessingMode: HASH + projectedOutputColumnNums: [0] + minReductionHashAggr: 0.75 + mode: hash + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + null sort order: + sort order: + Reduce Sink Vectorization: + className: VectorReduceSinkEmptyKeyOperator + native: true + nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true + valueColumns: 0:decimal(17,2) + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + value expressions: _col0 (type: decimal(17,2)) + Execution mode: vectorized, llap + LLAP IO: all inputs + Map Vectorization: + enabled: true + enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true + inputFormatFeatureSupport: [DECIMAL_64] + featureSupportInUse: [DECIMAL_64] + inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 4 + includeColumns: [0, 2] + dataColumns: ss_ext_list_price:decimal(7,2)/DECIMAL_64, ss_ext_wholesale_cost:decimal(19,1), ss_ext_discount_amt:int, ss_ext_sales_price:decimal(7,2)/DECIMAL_64 + partitionColumnCount: 0 + scratchColumnTypeNames: [bigint, decimal(7,2)/DECIMAL_64] + Reducer 2 + Execution mode: vectorized, llap + Reduce Vectorization: + enabled: true + enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true + reduceColumnNullOrder: + reduceColumnSortOrder: + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 1 + dataColumns: VALUE._col0:decimal(17,2) + partitionColumnCount: 0 + scratchColumnTypeNames: [] + Reduce Operator Tree: + Group By Operator + aggregations: sum(VALUE._col0) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal(col 0:decimal(17,2)) -> decimal(17,2) + className: VectorGroupByOperator + groupByMode: MERGEPARTIAL + native: false + vectorProcessingMode: GLOBAL + projectedOutputColumnNums: [0] + mode: mergepartial + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + File Output Operator + compressed: false + File Sink Vectorization: + className: VectorFileSinkOperator + native: false + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: select sum(case when (ss_ext_discount_amt=101) then ss_ext_list_price else null end) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: select sum(case when (ss_ext_discount_amt=101) then ss_ext_list_price else null end) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +3000.00 +PREHOOK: query: explain vectorization detail select sum(NVL(ss_ext_list_price, 1.1)) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: explain vectorization detail select sum(NVL(ss_ext_list_price, 1.1)) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +PLAN VECTORIZATION: + enabled: true + enabledConditionsMet: [hive.vectorized.execution.enabled IS true] + +STAGE DEPENDENCIES: + Stage-1 is a root stage + Stage-0 depends on stages: Stage-1 + +STAGE PLANS: + Stage: Stage-1 + Tez +#### A masked pattern was here #### + Edges: + Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE) +#### A masked pattern was here #### + Vertices: + Map 1 + Map Operator Tree: + TableScan + alias: vector_decimal64_case_when_tmp + Statistics: Num rows: 4 Data size: 448 Basic stats: COMPLETE Column stats: COMPLETE + TableScan Vectorization: + native: true + vectorizationSchemaColumns: [0:ss_ext_list_price:decimal(7,2)/DECIMAL_64, 1:ss_ext_wholesale_cost:decimal(19,1), 2:ss_ext_discount_amt:int, 3:ss_ext_sales_price:decimal(7,2)/DECIMAL_64, 4:ROW__ID:struct] + Select Operator + expressions: ss_ext_list_price (type: decimal(7,2)) + outputColumnNames: ss_ext_list_price + Select Vectorization: + className: VectorSelectOperator + native: true + projectedOutputColumnNums: [0] + Statistics: Num rows: 4 Data size: 448 Basic stats: COMPLETE Column stats: COMPLETE + Group By Operator + aggregations: sum(COALESCE(ss_ext_list_price,1.1)) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal64(VectorCoalesce(columns [0, 5])(children: col 0:decimal(7,2)/DECIMAL_64, ConstantVectorExpression(val 1.1) -> 5:decimal(7,2)/DECIMAL_64) -> 6:decimal(7,2)/DECIMAL_64) -> decimal(17,2)/DECIMAL_64 + className: VectorGroupByOperator + groupByMode: HASH + native: false + vectorProcessingMode: HASH + projectedOutputColumnNums: [0] + minReductionHashAggr: 0.75 + mode: hash + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + null sort order: + sort order: + Reduce Sink Vectorization: + className: VectorReduceSinkEmptyKeyOperator + native: true + nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true + valueColumns: 0:decimal(17,2) + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + value expressions: _col0 (type: decimal(17,2)) + Execution mode: vectorized, llap + LLAP IO: all inputs + Map Vectorization: + enabled: true + enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true + inputFormatFeatureSupport: [DECIMAL_64] + featureSupportInUse: [DECIMAL_64] + inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 4 + includeColumns: [0] + dataColumns: ss_ext_list_price:decimal(7,2)/DECIMAL_64, ss_ext_wholesale_cost:decimal(19,1), ss_ext_discount_amt:int, ss_ext_sales_price:decimal(7,2)/DECIMAL_64 + partitionColumnCount: 0 + scratchColumnTypeNames: [decimal(7,2)/DECIMAL_64, decimal(7,2)/DECIMAL_64] + Reducer 2 + Execution mode: vectorized, llap + Reduce Vectorization: + enabled: true + enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true + reduceColumnNullOrder: + reduceColumnSortOrder: + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 1 + dataColumns: VALUE._col0:decimal(17,2) + partitionColumnCount: 0 + scratchColumnTypeNames: [] + Reduce Operator Tree: + Group By Operator + aggregations: sum(VALUE._col0) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal(col 0:decimal(17,2)) -> decimal(17,2) + className: VectorGroupByOperator + groupByMode: MERGEPARTIAL + native: false + vectorProcessingMode: GLOBAL + projectedOutputColumnNums: [0] + mode: mergepartial + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + File Output Operator + compressed: false + File Sink Vectorization: + className: VectorFileSinkOperator + native: false + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: select sum(NVL(ss_ext_list_price, 1.1)) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: select sum(NVL(ss_ext_list_price, 1.1)) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +3001.10 +PREHOOK: query: explain vectorization detail select sum(NVL(ss_ext_list_price, 1.1BD)) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: explain vectorization detail select sum(NVL(ss_ext_list_price, 1.1BD)) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +PLAN VECTORIZATION: + enabled: true + enabledConditionsMet: [hive.vectorized.execution.enabled IS true] + +STAGE DEPENDENCIES: + Stage-1 is a root stage + Stage-0 depends on stages: Stage-1 + +STAGE PLANS: + Stage: Stage-1 + Tez +#### A masked pattern was here #### + Edges: + Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE) +#### A masked pattern was here #### + Vertices: + Map 1 + Map Operator Tree: + TableScan + alias: vector_decimal64_case_when_tmp + Statistics: Num rows: 4 Data size: 448 Basic stats: COMPLETE Column stats: COMPLETE + TableScan Vectorization: + native: true + vectorizationSchemaColumns: [0:ss_ext_list_price:decimal(7,2)/DECIMAL_64, 1:ss_ext_wholesale_cost:decimal(19,1), 2:ss_ext_discount_amt:int, 3:ss_ext_sales_price:decimal(7,2)/DECIMAL_64, 4:ROW__ID:struct] + Select Operator + expressions: ss_ext_list_price (type: decimal(7,2)) + outputColumnNames: ss_ext_list_price + Select Vectorization: + className: VectorSelectOperator + native: true + projectedOutputColumnNums: [0] + Statistics: Num rows: 4 Data size: 448 Basic stats: COMPLETE Column stats: COMPLETE + Group By Operator + aggregations: sum(COALESCE(ss_ext_list_price,1.1)) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal64(VectorCoalesce(columns [0, 5])(children: col 0:decimal(7,2)/DECIMAL_64, ConstantVectorExpression(val 1.1) -> 5:decimal(7,2)/DECIMAL_64) -> 6:decimal(7,2)/DECIMAL_64) -> decimal(17,2)/DECIMAL_64 + className: VectorGroupByOperator + groupByMode: HASH + native: false + vectorProcessingMode: HASH + projectedOutputColumnNums: [0] + minReductionHashAggr: 0.75 + mode: hash + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + Reduce Output Operator + null sort order: + sort order: + Reduce Sink Vectorization: + className: VectorReduceSinkEmptyKeyOperator + native: true + nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true + valueColumns: 0:decimal(17,2) + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + value expressions: _col0 (type: decimal(17,2)) + Execution mode: vectorized, llap + LLAP IO: all inputs + Map Vectorization: + enabled: true + enabledConditionsMet: hive.vectorized.use.vectorized.input.format IS true + inputFormatFeatureSupport: [DECIMAL_64] + featureSupportInUse: [DECIMAL_64] + inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 4 + includeColumns: [0] + dataColumns: ss_ext_list_price:decimal(7,2)/DECIMAL_64, ss_ext_wholesale_cost:decimal(19,1), ss_ext_discount_amt:int, ss_ext_sales_price:decimal(7,2)/DECIMAL_64 + partitionColumnCount: 0 + scratchColumnTypeNames: [decimal(7,2)/DECIMAL_64, decimal(7,2)/DECIMAL_64] + Reducer 2 + Execution mode: vectorized, llap + Reduce Vectorization: + enabled: true + enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true + reduceColumnNullOrder: + reduceColumnSortOrder: + allNative: false + usesVectorUDFAdaptor: false + vectorized: true + rowBatchContext: + dataColumnCount: 1 + dataColumns: VALUE._col0:decimal(17,2) + partitionColumnCount: 0 + scratchColumnTypeNames: [] + Reduce Operator Tree: + Group By Operator + aggregations: sum(VALUE._col0) + Group By Vectorization: + aggregators: VectorUDAFSumDecimal(col 0:decimal(17,2)) -> decimal(17,2) + className: VectorGroupByOperator + groupByMode: MERGEPARTIAL + native: false + vectorProcessingMode: GLOBAL + projectedOutputColumnNums: [0] + mode: mergepartial + outputColumnNames: _col0 + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + File Output Operator + compressed: false + File Sink Vectorization: + className: VectorFileSinkOperator + native: false + Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE + table: + input format: org.apache.hadoop.mapred.SequenceFileInputFormat + output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat + serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe + + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: select sum(NVL(ss_ext_list_price, 1.1BD)) from vector_decimal64_case_when_tmp +PREHOOK: type: QUERY +PREHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +POSTHOOK: query: select sum(NVL(ss_ext_list_price, 1.1BD)) from vector_decimal64_case_when_tmp +POSTHOOK: type: QUERY +POSTHOOK: Input: default@vector_decimal64_case_when_tmp +#### A masked pattern was here #### +3001.10 diff --git a/ql/src/test/results/clientpositive/vectorized_case.q.out b/ql/src/test/results/clientpositive/vectorized_case.q.out index ab477ddc57..f8edaa4e7f 100644 --- a/ql/src/test/results/clientpositive/vectorized_case.q.out +++ b/ql/src/test/results/clientpositive/vectorized_case.q.out @@ -551,7 +551,7 @@ STAGE PLANS: className: VectorSelectOperator native: true projectedOutputColumnNums: [6] - selectExpressions: IfExprCondExprCondExpr(col 3:boolean, col 7:decimal(11,0)col 8:decimal(11,0))(children: Decimal64ColEqualDecimal64Scalar(col 0:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 3:boolean, ConvertDecimal64ToDecimal(col 4:decimal(11,0)/DECIMAL_64)(children: Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 4:decimal(11,0)/DECIMAL_64) -> 7:decimal(11,0), ConvertDecimal64ToDecimal(col 5:decimal(11,0)/DECIMAL_64)(children: Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 2, decimalVal 2) -> 5:decimal(11,0)/DECIMAL_64) -> 8:decimal(11,0)) -> 6:decimal(11,0) + selectExpressions: IfExprCondExprCondExpr(col 3:boolean, col 4:decimal(11,0)/DECIMAL_64col 5:decimal(11,0)/DECIMAL_64)(children: Decimal64ColEqualDecimal64Scalar(col 0:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 3:boolean, Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 1, decimalVal 1) -> 4:decimal(11,0)/DECIMAL_64, Decimal64ColAddDecimal64Scalar(col 1:decimal(10,0)/DECIMAL_64, decimal64Val 2, decimalVal 2) -> 5:decimal(11,0)/DECIMAL_64) -> 6:decimal(11,0)/DECIMAL_64 Statistics: Num rows: 3 Data size: 336 Basic stats: COMPLETE Column stats: COMPLETE File Output Operator compressed: false @@ -578,7 +578,7 @@ STAGE PLANS: includeColumns: [0, 1] dataColumns: member:decimal(10,0)/DECIMAL_64, attr:decimal(10,0)/DECIMAL_64 partitionColumnCount: 0 - scratchColumnTypeNames: [bigint, decimal(11,0)/DECIMAL_64, decimal(11,0)/DECIMAL_64, decimal(11,0), decimal(11,0), decimal(11,0)] + scratchColumnTypeNames: [bigint, decimal(11,0)/DECIMAL_64, decimal(11,0)/DECIMAL_64, decimal(11,0)/DECIMAL_64] Stage: Stage-0 Fetch Operator