Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFail
if (!checkIntervalOperands(callBinding, 2)) {
return throwValidationSignatureErrorOrReturnFalse(callBinding, throwOnFailure);
}
if (callBinding.getOperandCount() == 5) {
return throwValidationSignatureErrorOrReturnFalse(callBinding, throwOnFailure);
}
// check time attribute
return throwExceptionOrReturnFalse(
checkTimeColumnDescriptorOperand(callBinding, 1), throwOnFailure);
Expand All @@ -66,7 +69,7 @@ public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFail
public String getAllowedSignatures(SqlOperator op, String opName) {
return opName
+ "(TABLE table_name, DESCRIPTOR(timecol), "
+ "datetime interval, datetime interval[, datetime interval])";
+ "datetime interval, datetime interval)";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFail
if (!checkIntervalOperands(callBinding, 2)) {
return throwValidationSignatureErrorOrReturnFalse(callBinding, throwOnFailure);
}
if (callBinding.getOperandCount() == 5) {
return throwValidationSignatureErrorOrReturnFalse(callBinding, throwOnFailure);
}
// check time attribute
return throwExceptionOrReturnFalse(
checkTimeColumnDescriptorOperand(callBinding, 1), throwOnFailure);
Expand All @@ -66,7 +69,7 @@ public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFail
public String getAllowedSignatures(SqlOperator op, String opName) {
return opName
+ "(TABLE table_name, DESCRIPTOR(timecol), "
+ "datetime interval, datetime interval[, datetime interval])";
+ "datetime interval, datetime interval)";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,17 @@ public boolean checkOperandTypes(SqlCallBinding callBinding, boolean throwOnFail
if (!checkIntervalOperands(callBinding, 2)) {
return throwValidationSignatureErrorOrReturnFalse(callBinding, throwOnFailure);
}
if (callBinding.getOperandCount() == 4) {
return throwValidationSignatureErrorOrReturnFalse(callBinding, throwOnFailure);
}
// check time attribute
return throwExceptionOrReturnFalse(
checkTimeColumnDescriptorOperand(callBinding, 1), throwOnFailure);
}

@Override
public String getAllowedSignatures(SqlOperator op, String opName) {
return opName
+ "(TABLE table_name, DESCRIPTOR(timecol), datetime interval"
+ "[, datetime interval])";
return opName + "(TABLE table_name, DESCRIPTOR(timecol), datetime interval)";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,59 @@ class WindowTableFunctionTest extends TableTestBase {
util.verifyExplain(sql)
}

@Test
def testInvalidTumbleParameters(): Unit = {
val sql =
"""
|SELECT *
|FROM TABLE(TUMBLE(
| TABLE MyTable, DESCRIPTOR(rowtime), INTERVAL '15' MINUTE, INTERVAL '5' MINUTE))
|""".stripMargin

thrown.expectMessage("Supported form(s): " +
"TUMBLE(TABLE table_name, DESCRIPTOR(timecol), datetime interval)")
thrown.expect(classOf[ValidationException])
util.verifyExplain(sql)
}

@Test
def testInvalidHopParameters(): Unit = {
val sql =
"""
|SELECT *
|FROM TABLE(
| HOP(
| TABLE MyTable,
| DESCRIPTOR(rowtime),
| INTERVAL '1' MINUTE,
| INTERVAL '15' MINUTE,
| INTERVAL '5' MINUTE))
|""".stripMargin

thrown.expectMessage("Supported form(s): " +
"HOP(TABLE table_name, DESCRIPTOR(timecol), datetime interval, datetime interval)")
thrown.expect(classOf[ValidationException])
util.verifyExplain(sql)
}

@Test
def testInvalidCumulateParameters(): Unit = {
val sql =
"""
|SELECT *
|FROM TABLE(
| CUMULATE(
| TABLE MyTable,
| DESCRIPTOR(rowtime),
| INTERVAL '1' MINUTE,
| INTERVAL '15' MINUTE,
| INTERVAL '5' MINUTE))
|""".stripMargin

thrown.expectMessage("Supported form(s): " +
"CUMULATE(TABLE table_name, DESCRIPTOR(timecol), datetime interval, datetime interval)")
thrown.expect(classOf[ValidationException])
util.verifyExplain(sql)
}

}