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 @@ -72,52 +72,56 @@ private RangeUtils() {
List<RexNode> filters = sourceFilter.getKind() == SqlKind.AND
? ((RexCall) sourceFilter).operands
: Collections.singletonList(sourceFilter);
byte[] conditionValue;
for (RexNode filter : filters) {
conditionValue = calcConditionValue(
RuleUtils.checkCondition(filter), codec, realIndex, table.columns.size(), table
);
if (conditionValue == null) {
continue;
}
int compare = 0;
switch (filter.getKind()) {
case LESS_THAN_OR_EQUAL: {
compare = 1;
try {
byte[] conditionValue;
for (RexNode filter : filters) {
conditionValue = calcConditionValue(
RuleUtils.checkCondition(filter), codec, realIndex, table.columns.size(), table
);
if (conditionValue == null) {
continue;
}
case LESS_THAN: {
if (end == null || ByteArrayUtils.compare(conditionValue, end) <= compare) {
end = conditionValue;
withEnd = compare == 1;
int compare = 0;
switch (filter.getKind()) {
case LESS_THAN_OR_EQUAL: {
compare = 1;
}
break;
}
case GREATER_THAN_OR_EQUAL: {
compare = 1;
}
case GREATER_THAN: {
if (start == null || ByteArrayUtils.compare(conditionValue, start) >= compare) {
start = conditionValue;
withStart = compare == 1;
case LESS_THAN: {
if (end == null || ByteArrayUtils.compare(conditionValue, end) <= compare) {
end = conditionValue;
withEnd = compare == 1;
}
break;
}
case GREATER_THAN_OR_EQUAL: {
compare = 1;
}
break;
case GREATER_THAN: {
if (start == null || ByteArrayUtils.compare(conditionValue, start) >= compare) {
start = conditionValue;
withStart = compare == 1;
}
break;
}
case EQUALS:
start = conditionValue;
end = conditionValue;
withEnd = true;
withStart = true;
break;
default:
return null;
}
case EQUALS:
start = conditionValue;
end = conditionValue;
withEnd = true;
withStart = true;
break;
default:
return null;
}
return RangeDistribution.builder()
.startKey(start)
.endKey(end)
.withStart(withStart)
.withEnd(withEnd)
.build();
} catch (Throwable ignore) {
return null;
}
return RangeDistribution.builder()
.startKey(start)
.endKey(end)
.withStart(withStart)
.withEnd(withEnd)
.build();
}

private static byte[] calcConditionValue(RuleUtils.ConditionInfo info,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public DingoTypeCoercionImpl(RelDataTypeFactory typeFactory, SqlValidator valida
} else if (targetType.getSqlTypeName().getName().equalsIgnoreCase("DOUBLE")
&& sourceType.getSqlTypeName().getName().equalsIgnoreCase("BINARY")) {
continue;
} else if (targetType.getSqlTypeName().getName().equalsIgnoreCase("TINYINT")
&& sourceType.getSqlTypeName().getName().equalsIgnoreCase("BINARY")) {
continue;
} else {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class ScopeVariables {
public static final List<String> characterSet = new ArrayList<>();

public static final List<String> globalVariables = List.of("job_need_gc", "txn_history_duration",
"safepoint_ts", "ssl_enable", "log_bin_trust_function_creators", "innodb_online_alter_log_max_size",
"safepoint_ts", "ssl_enable", "innodb_online_alter_log_max_size",
"max_allowed_packet", "table_definition_cache");

static {
Expand Down Expand Up @@ -252,6 +252,15 @@ public static boolean aliasCaseSensitivity() {
}
}

public static boolean ddlMetaMdlLockLog() {
try {
String aliasCaseSensitivity = executorProp.getOrDefault("mdl_log", "false").toString();
return "true".equalsIgnoreCase(aliasCaseSensitivity);
} catch (Exception e) {
return false;
}
}

public static synchronized void setExecutorProp(String key, String val) {
if ("rpc_batch_size".equalsIgnoreCase(key)) {
int rpcBatchSize = Integer.parseInt(val);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
import org.apache.calcite.rel.type.RelDataTypeField;
import org.apache.calcite.rel.type.RelDataTypeSystem;
import org.apache.calcite.runtime.CalciteContextException;
import org.apache.calcite.schema.impl.ListTransientTable;
import org.apache.calcite.server.DdlExecutor;
import org.apache.calcite.sql.SqlBasicCall;
import org.apache.calcite.sql.SqlExplain;
Expand Down Expand Up @@ -974,6 +975,8 @@ private static boolean checkEngine(SqlNode sqlNode,
name = fullName.get(1) + "." + fullName.get(2);
tableList.add(name);
}
} else if (relOptTable.table() instanceof ListTransientTable) {
engine = "TXN_LSM";
}
} else if (table instanceof DingoRelOptTable) {
DingoRelOptTable dingoRelOptTable = (DingoRelOptTable) table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,33 @@ private static Iterator<Object[]> getInformationColumns(String user, String host
if (column.state == 2) {
continue;
}
String extra = "";
if (column.isAutoIncrement()) {
extra = "auto_increment";
}
String type = column.getSqlTypeName();
String charsetName = null;
String collationName = null;
if (type.equalsIgnoreCase("INTEGER")) {
type = "int";
if (column.getPrecision() > 0) {
type = type + "(" + column.getPrecision() + ")";
}
} else if (type.equals("VARCHAR")) {
if (column.getPrecision() > 0) {
type = type + "(" + column.getPrecision() + ")";
}
charsetName = "utf8";
collationName = "utf8_bin";
} else if (type.equalsIgnoreCase("CHAR")) {
charsetName = "utf8";
collationName = "utf8_bin";
} else if (type.equalsIgnoreCase("DECIMAL")) {
if (column.getPrecision() > 0 && column.getScale() >= 0) {
type = type + "(" + column.getPrecision() + "," + column.getScale() + ")";
}
}
type = type.toLowerCase();
colRes.add(new Object[]{
"def",
schemaTables.getSchemaInfo().getName(),
Expand All @@ -164,12 +191,12 @@ private static Iterator<Object[]> getInformationColumns(String user, String host
null,
null,
null,
"utf8",
"utf8_bin",
column.getSqlTypeName(),
charsetName,
collationName,
type,
// is key
column.isPrimary() ? "PRI" : "",
"",
extra,
// privileges fix
"select,insert,update,references",
column.comment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.dingodb.common.environment.ExecutionEnvironment;
import io.dingodb.common.log.LogUtils;
import io.dingodb.common.metrics.DingoMetrics;
import io.dingodb.common.mysql.scope.ScopeVariables;
import io.dingodb.common.util.Utils;
import io.dingodb.server.executor.ddl.DdlContext;
import io.dingodb.server.executor.session.SessionManager;
Expand Down Expand Up @@ -73,7 +74,7 @@ private static synchronized void checkMdlVersion() {
if (maxVer > saveMaxSchemaVersion) {
saveMaxSchemaVersion = maxVer;
} else if (!jobNeedToSync) {
if (DdlUtil.timeOutError.get()) {
if (DdlUtil.timeOutError.get() && ScopeVariables.ddlMetaMdlLockLog()) {
LogUtils.info(log, "[ddl] mdl check not need to sync,max ver:{} saveMaxSchema ver:{}",
maxVer, saveMaxSchemaVersion);
}
Expand Down Expand Up @@ -103,7 +104,7 @@ private static synchronized void checkMdlVersion() {
if (jobCache.size() > 1000) {
jobCache = new HashMap<>();
}
if (DdlUtil.timeOutError.get()) {
if (DdlUtil.timeOutError.get() && ScopeVariables.ddlMetaMdlLockLog()) {
LogUtils.info(log, "[ddl] mdl check jobs id map size:{}, "
+ "jobs ver map size:{}, jobNeedToSync:{}", jobsIdsMap.size(),
jobsVerMap.size(), jobNeedToSync);
Expand Down