/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.calcite.sql.validate;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import org.apache.calcite.linq4j.Ord;
import org.apache.calcite.linq4j.function.Function2;
import org.apache.calcite.linq4j.function.Functions;
import org.apache.calcite.plan.RelOptTable;
import org.apache.calcite.plan.RelOptUtil;
import org.apache.calcite.prepare.Prepare;
import org.apache.calcite.rel.type.DynamicRecordType;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeFactory;
import org.apache.calcite.rel.type.RelDataTypeField;
import org.apache.calcite.rel.type.RelDataTypeSystem;
import org.apache.calcite.rel.type.RelRecordType;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.rex.RexPatternFieldRef;
import org.apache.calcite.rex.RexVisitor;
import org.apache.calcite.runtime.CalciteContextException;
import org.apache.calcite.runtime.CalciteException;
import org.apache.calcite.runtime.Feature;
import org.apache.calcite.runtime.Resources;
import org.apache.calcite.schema.ColumnStrategy;
import org.apache.calcite.schema.Table;
import org.apache.calcite.schema.impl.ModifiableViewTable;
import org.apache.calcite.sql.JoinConditionType;
import org.apache.calcite.sql.JoinType;
import org.apache.calcite.sql.SqlAccessEnum;
import org.apache.calcite.sql.SqlAccessType;
import org.apache.calcite.sql.SqlAggFunction;
import org.apache.calcite.sql.SqlBasicCall;
import org.apache.calcite.sql.SqlCall;
import org.apache.calcite.sql.SqlCallBinding;
import org.apache.calcite.sql.SqlDataTypeSpec;
import org.apache.calcite.sql.SqlDelete;
import org.apache.calcite.sql.SqlDynamicParam;
import org.apache.calcite.sql.SqlExplain;
import org.apache.calcite.sql.SqlFunction;
import org.apache.calcite.sql.SqlFunctionCategory;
import org.apache.calcite.sql.SqlIdentifier;
import org.apache.calcite.sql.SqlInsert;
import org.apache.calcite.sql.SqlIntervalLiteral;
import org.apache.calcite.sql.SqlIntervalQualifier;
import org.apache.calcite.sql.SqlJoin;
import org.apache.calcite.sql.SqlKind;
import org.apache.calcite.sql.SqlLiteral;
import org.apache.calcite.sql.SqlMatchRecognize;
import org.apache.calcite.sql.SqlMerge;
import org.apache.calcite.sql.SqlNode;
import org.apache.calcite.sql.SqlNodeList;
import org.apache.calcite.sql.SqlOperator;
import org.apache.calcite.sql.SqlOperatorTable;
import org.apache.calcite.sql.SqlOrderBy;
import org.apache.calcite.sql.SqlPivot;
import org.apache.calcite.sql.SqlSampleSpec;
import org.apache.calcite.sql.SqlSelect;
import org.apache.calcite.sql.SqlSelectKeyword;
import org.apache.calcite.sql.SqlSnapshot;
import org.apache.calcite.sql.SqlSyntax;
import org.apache.calcite.sql.SqlTableFunction;
import org.apache.calcite.sql.SqlUnresolvedFunction;
import org.apache.calcite.sql.SqlUpdate;
import org.apache.calcite.sql.SqlUtil;
import org.apache.calcite.sql.SqlWindow;
import org.apache.calcite.sql.SqlWindowTableFunction;
import org.apache.calcite.sql.SqlWith;
import org.apache.calcite.sql.SqlWithItem;
import org.apache.calcite.sql.fun.SqlCase;
import org.apache.calcite.sql.fun.SqlStdOperatorTable;
import org.apache.calcite.sql.parser.SqlParserPos;
import org.apache.calcite.sql.type.AssignableOperandTypeChecker;
import org.apache.calcite.sql.type.OperandTypes;
import org.apache.calcite.sql.type.ReturnTypes;
import org.apache.calcite.sql.type.SqlOperandTypeChecker;
import org.apache.calcite.sql.type.SqlOperandTypeInference;
import org.apache.calcite.sql.type.SqlTypeCoercionRule;
import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.calcite.sql.type.SqlTypeUtil;
import org.apache.calcite.sql.util.IdPair;
import org.apache.calcite.sql.util.SqlBasicVisitor;
import org.apache.calcite.sql.util.SqlShuttle;
import org.apache.calcite.sql.util.SqlVisitor;
import org.apache.calcite.sql.validate.implicit.TypeCoercion;
import org.apache.calcite.util.BitString;
import org.apache.calcite.util.Bug;
import org.apache.calcite.util.ImmutableBitSet;
import org.apache.calcite.util.ImmutableIntList;
import org.apache.calcite.util.ImmutableNullableList;
import org.apache.calcite.util.Litmus;
import org.apache.calcite.util.Pair;
import org.apache.calcite.util.Static;
import org.apache.calcite.util.Util;
import org.apache.calcite.util.trace.CalciteTrace;
import org.slf4j.Logger;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.AbstractList;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;
import java.util.stream.Collectors;
import static org.apache.calcite.sql.SqlUtil.stripAs;
import static org.apache.calcite.util.Static.RESOURCE;
/**
* Default implementation of {@link SqlValidator}, the class was copied over because of
* CALCITE-4554.
*
* <p>Lines 4697 ~ 4716, Flink enables TIMESTAMP and TIMESTAMP_LTZ for system time period
* specification type.
*
* <p>Lines 5034 ~ 5038, Flink enables TIMESTAMP and TIMESTAMP_LTZ for first orderBy column in
* matchRecognize.
*/
public class SqlValidatorImpl implements SqlValidatorWithHints {
// ~ Static fields/initializers ---------------------------------------------
public static final Logger TRACER = CalciteTrace.PARSER_LOGGER;
/** Alias generated for the source table when rewriting UPDATE to MERGE. */
public static final String UPDATE_SRC_ALIAS = "SYS$SRC";
/**
* Alias generated for the target table when rewriting UPDATE to MERGE if no alias was specified
* by the user.
*/
public static final String UPDATE_TGT_ALIAS = "SYS$TGT";
/** Alias prefix generated for source columns when rewriting UPDATE to MERGE. */
public static final String UPDATE_ANON_PREFIX = "SYS$ANON";
// ~ Instance fields --------------------------------------------------------
private final SqlOperatorTable opTab;
final SqlValidatorCatalogReader catalogReader;
/**
* Maps {@link SqlParserPos} strings to the {@link SqlIdentifier} identifier objects at these
* positions.
*/
protected final Map<String, IdInfo> idPositions = new HashMap<>();
/**
* Maps {@link SqlNode query node} objects to the {@link SqlValidatorScope} scope created from
* them.
*/
protected final Map<SqlNode, SqlValidatorScope> scopes = new IdentityHashMap<>();
/** Maps a {@link SqlSelect} and a clause to the scope used by that clause. */
private final Map<IdPair<SqlSelect, Clause>, SqlValidatorScope> clauseScopes = new HashMap<>();
/** The name-resolution scope of a LATERAL TABLE clause.
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
flink 1.14.4 源码下载 (2000个子文件)
font-awesome.css 34KB
font-awesome.min.css 28KB
github.css 5KB
pyflink.css 906B
glibc_version_fix.h 847B
rest_v1_dispatcher.html 161KB
job-checkpoints.component.html 17KB
kubernetes_config_configuration.html 16KB
common_memory_section.html 15KB
pulsar_consumer_configuration.html 14KB
pulsar_client_configuration.html 14KB
job_manager_configuration.html 13KB
security_configuration.html 13KB
yarn_config_configuration.html 13KB
task_manager_memory_configuration.html 11KB
all_taskmanager_network_section.html 10KB
execution_config_configuration.html 10KB
netty_shuffle_environment_configuration.html 10KB
task-manager-metrics.component.html 9KB
python_configuration.html 8KB
rocksdb_configurable_configuration.html 8KB
rocksdb_native_metric_configuration.html 8KB
pipeline_configuration.html 8KB
task_manager_configuration.html 8KB
job-manager-metrics.component.html 7KB
all_jobmanager_section.html 7KB
execution_checkpointing_configuration.html 7KB
metric_configuration.html 7KB
all_taskmanager_section.html 7KB
akka_configuration.html 7KB
job-checkpoints-subtask.component.html 6KB
security_ssl_section.html 6KB
rest_configuration.html 6KB
expert_scheduling_section.html 6KB
submit.component.html 6KB
core_configuration.html 5KB
high_availability_configuration.html 5KB
resource_manager_configuration.html 5KB
rocksdb_configuration.html 5KB
cluster_configuration.html 5KB
optimizer_config_configuration.html 5KB
common_host_port_section.html 5KB
job-overview-drawer-detail.component.html 5KB
expert_rest_section.html 5KB
checkpointing_configuration.html 4KB
expert_fault_tolerance_section.html 4KB
common_state_backends_section.html 4KB
sql_download_table.html 4KB
app.component.html 4KB
pulsar_source_configuration.html 4KB
baseof.html 4KB
job-overview-drawer-subtasks.component.html 4KB
job-checkpoints-detail.component.html 4KB
environment_configuration.html 4KB
job-overview-list.component.html 4KB
job-overview-drawer-taskmanagers.component.html 4KB
state_backend_rocksdb_section.html 3KB
job-exceptions.component.html 3KB
history_server_configuration.html 3KB
expert_security_ssl_section.html 3KB
table_config_configuration.html 3KB
web_configuration.html 3KB
expert_class_loading_section.html 3KB
execution_configuration.html 3KB
expert_high_availability_zk_section.html 3KB
blob_server_configuration.html 3KB
task-manager-list.component.html 3KB
dagre.component.html 3KB
queryable_state_configuration.html 3KB
exponential_delay_restart_strategy_configuration.html 3KB
sql_optional_connectors.html 3KB
job-overview-drawer-accumulators.component.html 3KB
prometheus_push_gateway_reporter_configuration.html 3KB
influxdb_reporter_configuration.html 3KB
job-overview-drawer-backpressure.component.html 3KB
task-manager-status.component.html 3KB
menu-after.html 3KB
overview-statistic.component.html 3KB
menu-filetree.html 3KB
job-status.component.html 3KB
sql_client_configuration.html 2KB
artifact.html 2KB
security_auth_kerberos_section.html 2KB
state_backend_configuration.html 2KB
node.component.html 2KB
external_resource_configuration.html 2KB
job-configuration.component.html 2KB
job-overview-drawer-flamegraph.component.html 2KB
expert_cluster_section.html 2KB
expert_rocksdb_section.html 2KB
restart_strategy_configuration.html 2KB
refresh-download.component.html 2KB
algorithm_configuration.html 2KB
job-list.component.html 2KB
job-chart.component.html 2KB
deployment_configuration.html 2KB
pulsar_admin_configuration.html 2KB
pythondoc.html 2KB
heartbeat_manager_configuration.html 2KB
sql_optional_formats.html 2KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
多栖艺人
- 粉丝: 1
- 资源: 26
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论5