morningman closed pull request #469: Fix fe ut
URL: https://github.com/apache/incubator-doris/pull/469
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/be/src/runtime/decimal_value.cpp b/be/src/runtime/decimal_value.cpp
index 3ce57313..564a67f1 100755
--- a/be/src/runtime/decimal_value.cpp
+++ b/be/src/runtime/decimal_value.cpp
@@ -902,25 +902,25 @@ int DecimalValue::parse_from_str(const char* decimal_str,
int32_t length) {
// TODO: we do not support decimal in scientific notation
if ((frac_ptr + 1) < end && (*frac_ptr == 'e' || *frac_ptr == 'E')) {
- return E_DEC_BAD_NUM;
- // int64_t exponent = strtoll(frac_ptr + 1, (char**) &end, 10);
- // if (end != frac_ptr + 1) { // If at least one digit
- // if (errno) { // system error number, it is thread local
- // set_to_zero();
- // return E_DEC_BAD_NUM;
- // }
- // if (exponent > (INT_MAX / 2) || (errno == 0 && exponent < 0)) {
- // set_to_zero();
- // return E_DEC_OVERFLOW;
- // }
- // if (exponent < INT_MAX / 2 && error != E_DEC_OVERFLOW) {
- // set_to_zero();
- // return E_DEC_TRUNCATED;
- // }
- // if (error != E_DEC_OVERFLOW) {
- // // error = shift((int32_t) exponent);
- // }
- // }
+ // return E_DEC_BAD_NUM;
+ int64_t exponent = strtoll(frac_ptr + 1, (char**) &end, 10);
+ if (end != frac_ptr + 1) { // If at least one digit
+ if (errno) { // system error number, it is thread local
+ set_to_zero();
+ return E_DEC_BAD_NUM;
+ }
+ if (exponent > (INT_MAX / 2) || (errno == 0 && exponent < 0)) {
+ set_to_zero();
+ return E_DEC_OVERFLOW;
+ }
+ if (exponent < INT_MAX / 2 && error != E_DEC_OVERFLOW) {
+ set_to_zero();
+ return E_DEC_TRUNCATED;
+ }
+ if (error != E_DEC_OVERFLOW) {
+ // error = shift((int32_t) exponent);
+ }
+ }
}
if (_sign && is_zero()) {
_sign = false;
diff --git
a/fe/src/test/java/org/apache/doris/planner/StreamLoadScanNodeTest.java
b/fe/src/test/java/org/apache/doris/planner/StreamLoadScanNodeTest.java
index 919c85c0..bf26a8cd 100644
--- a/fe/src/test/java/org/apache/doris/planner/StreamLoadScanNodeTest.java
+++ b/fe/src/test/java/org/apache/doris/planner/StreamLoadScanNodeTest.java
@@ -230,6 +230,22 @@ public void testColumnsNormal() throws UserException,
UserException {
}
}
+ new Expectations() {
+ {
+ dstTable.getColumn("k1");
+ result = columns.stream().filter(c ->
c.getName().equals("k1")).findFirst().get();
+
+ dstTable.getColumn("k2");
+ result = columns.stream().filter(c ->
c.getName().equals("k2")).findFirst().get();
+
+ dstTable.getColumn("v1");
+ result = columns.stream().filter(c ->
c.getName().equals("v1")).findFirst().get();
+
+ dstTable.getColumn("v2");
+ result = columns.stream().filter(c ->
c.getName().equals("v2")).findFirst().get();
+ }
+ };
+
TStreamLoadPutRequest request = getBaseRequest();
request.setFileType(TFileType.FILE_LOCAL);
request.setColumns("k1,k2,v1, v2=k2");
@@ -264,6 +280,19 @@ public void testHllColumnsNormal() throws UserException {
catalog.getFunction((Function) any, (Function.CompareMode) any);
result = new ScalarFunction(new FunctionName("hll_hash"),
Lists.newArrayList(), Type.BIGINT, false);
}};
+
+ new Expectations() {
+ {
+ dstTable.getColumn("k1");
+ result = columns.stream().filter(c ->
c.getName().equals("k1")).findFirst().get();
+
+ dstTable.getColumn("k2");
+ result = null;
+
+ dstTable.getColumn("v1");
+ result = columns.stream().filter(c ->
c.getName().equals("v1")).findFirst().get();
+ }
+ };
TStreamLoadPutRequest request = getBaseRequest();
request.setFileType(TFileType.FILE_LOCAL);
@@ -300,6 +329,19 @@ public void testHllColumnsNoHllHash() throws UserException
{
result = new ScalarFunction(new FunctionName("hll_hash1"),
Lists.newArrayList(), Type.BIGINT, false);
}};
+ new Expectations() {
+ {
+ dstTable.getColumn("k1");
+ result = columns.stream().filter(c ->
c.getName().equals("k1")).findFirst().get();
+
+ dstTable.getColumn("k2");
+ result = null;
+
+ dstTable.getColumn("v1");
+ result = columns.stream().filter(c ->
c.getName().equals("v1")).findFirst().get();
+ }
+ };
+
TStreamLoadPutRequest request = getBaseRequest();
request.setFileType(TFileType.FILE_LOCAL);
request.setColumns("k1,k2, v1=hll_hash1(k2)");
@@ -419,6 +461,22 @@ public void testWhereNormal() throws UserException,
UserException {
}
}
+ new Expectations() {
+ {
+ dstTable.getColumn("k1");
+ result = columns.stream().filter(c ->
c.getName().equals("k1")).findFirst().get();
+
+ dstTable.getColumn("k2");
+ result = columns.stream().filter(c ->
c.getName().equals("k2")).findFirst().get();
+
+ dstTable.getColumn("v1");
+ result = columns.stream().filter(c ->
c.getName().equals("v1")).findFirst().get();
+
+ dstTable.getColumn("v2");
+ result = columns.stream().filter(c ->
c.getName().equals("v2")).findFirst().get();
+ }
+ };
+
TStreamLoadPutRequest request = getBaseRequest();
request.setColumns("k1,k2,v1, v2=k1");
request.setWhere("k1 = 1");
@@ -449,6 +507,22 @@ public void testWhereBad() throws UserException,
UserException {
}
}
+ new Expectations() {
+ {
+ dstTable.getColumn("k1");
+ result = columns.stream().filter(c ->
c.getName().equals("k1")).findFirst().get();
+
+ dstTable.getColumn("k2");
+ result = columns.stream().filter(c ->
c.getName().equals("k2")).findFirst().get();
+
+ dstTable.getColumn("v1");
+ result = columns.stream().filter(c ->
c.getName().equals("v1")).findFirst().get();
+
+ dstTable.getColumn("v2");
+ result = columns.stream().filter(c ->
c.getName().equals("v2")).findFirst().get();
+ }
+ };
+
TStreamLoadPutRequest request = getBaseRequest();
request.setColumns("k1,k2,v1, v2=k2");
request.setWhere("k1 1");
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]