merge to 3eb59087fb98ed61655997de525331736c56256a (#215)

1. fixed a bug when cast float to string
2. delay result's cancelled time
3. update type check in CastTo
4. remove unused mysql channel log
5. update stop_be.sh, use kill -0 instead of flock -nx
6. update jprotobuf-rpc to 3.5.15 in Frontend, the previous version will cause too many threads in JVM
This commit is contained in:
morningman
2018-07-26 19:22:37 +08:00
committed by GitHub
parent a69ac65760
commit aad32ec8fc
6 changed files with 16 additions and 14 deletions

View File

@ -176,7 +176,6 @@ StringVal CastFunctions::cast_to_string_val(FunctionContext* ctx, const LargeInt
sv.len = snprintf(reinterpret_cast<char*>(sv.ptr), sv.len, format, val.val); \
DCHECK_GT(sv.len, 0); \
DCHECK_LE(sv.len, MAX_FLOAT_CHARS); \
AnyValUtil::TruncateIfNecessary(ctx->get_return_type(), &sv); \
return sv; \
}

View File

@ -86,7 +86,7 @@ Status ResultSink::close(RuntimeState* state, Status exec_status) {
if (_sender) {
_sender->close(exec_status);
}
state->exec_env()->result_mgr()->cancel_at_time(time(NULL) + 5, state->fragment_instance_id());
state->exec_env()->result_mgr()->cancel_at_time(time(NULL) + 32, state->fragment_instance_id());
Expr::close(_output_expr_ctxs, state);
_closed = true;

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
# Copyright (c) 2017, Baidu.com, Inc. All Rights Reserved
# Licensed under the Apache License, Version 2.0 (the "License");
@ -39,10 +38,7 @@ if [ -f $pidfile ]; then
exit 1
fi
if flock -nx $pidfile -c "ls > /dev/null 2>&1"; then
echo "Backend already exit, remove pid file. "
rm $pidfile
else
if kill -0 $pid; then
if kill -9 $pid > /dev/null 2>&1; then
echo "stop $pidcomm, and remove pid file. "
rm $pidfile
@ -50,9 +46,11 @@ if [ -f $pidfile ]; then
else
exit 1
fi
else
echo "Backend already exit, remove pid file. "
rm $pidfile
fi
else
echo "$pidfile does not exist"
exit 1
fi

View File

@ -1141,16 +1141,23 @@ abstract public class Expr extends TreeNode<Expr> implements ParseNode, Cloneabl
* failure to convert a string literal to a date literal
*/
public final Expr castTo(Type targetType) throws AnalysisException {
final Type type = Type.getAssignmentCompatibleType(this.type, targetType, false);
if (!type.isValid()) {
throw new AnalysisException("can't cast " + this.type + " to " + targetType);
}
// If the targetType is NULL_TYPE then ignore the cast because NULL_TYPE
// is compatible with all types and no cast is necessary.
if (targetType.isNull()) {
return this;
}
if ((targetType.isStringType() || targetType.isHllType())
&& (this.type.isStringType() || this.type.isHllType())) {
return this;
if (!targetType.isDecimal()) {
// requested cast must be to assignment-compatible type
// (which implies no loss of precision)
if (!targetType.equals(type)) {
throw new AnalysisException("can't cast " + this.type + " to " + targetType);
}
}
// Preconditions.checkState(PrimitiveType.isImplicitCast(type, targetType), "cast %s to %s", this.type, targetType);
// TODO(zc): use implicit cast
Preconditions.checkState(Type.canCastTo(this.type, targetType), "cast %s to %s", this.type, targetType);

View File

@ -72,8 +72,6 @@ public class MysqlChannel {
} catch (Exception e) {
LOG.warn("get remote host string failed: " + e.toString());
}
} else {
LOG.warn("get remote host string failed: " + "channel is null.");
}
}