Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.google.zetasql.resolvedast.ResolvedNodes Maven / Gradle / Ivy
/*
* Copyright 2019 Google LLC
*
* Licensed 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.
*
*/
// ResolvedNodes.java GENERATED FROM ResolvedNodes.java.template
package com.google.zetasql.resolvedast;
import com.google.common.base.Preconditions;
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import com.google.protobuf.Descriptors.FieldDescriptor;
import com.google.protobuf.Descriptors.OneofDescriptor;
import com.google.protobuf.Message;
import com.google.protobuf.ProtocolMessageEnum;
import com.google.zetasql.AnyResolvedNodeProto;
import com.google.zetasql.Column;
import com.google.zetasql.ColumnRefProto;
import com.google.zetasql.Connection;
import com.google.zetasql.ConnectionRefProto;
import com.google.zetasql.Constant;
import com.google.zetasql.ConstantRefProto;
import com.google.zetasql.FieldDescriptorRefProto;
import com.google.zetasql.FileDescriptorSetsBuilder;
import com.google.zetasql.Function;
import com.google.zetasql.FunctionProtos.TVFArgumentProto;
import com.google.zetasql.ZetaSQLAnnotation.AnnotationMapProto;
import com.google.zetasql.OneofDescriptorRefProto;
import com.google.zetasql.ResolvedFunctionCallInfo;
import com.google.zetasql.FunctionProtos.ResolvedFunctionCallInfoProto;
import com.google.zetasql.FunctionProtos.FunctionSignatureProto;
import com.google.zetasql.FunctionProtos.TVFSignatureProto;
import com.google.zetasql.FunctionRefProto;
import com.google.zetasql.FunctionSignature;
import com.google.zetasql.DescriptorPool.ZetaSQLFieldDescriptor;
import com.google.zetasql.DescriptorPool.ZetaSQLOneofDescriptor;
import com.google.zetasql.ZetaSQLResolvedNodeKind.ResolvedNodeKind;
import com.google.zetasql.ZetaSQLStrings;
import com.google.zetasql.ZetaSQLType.ProtoTypeProto;
import com.google.zetasql.ZetaSQLType.TypeProto;
import com.google.zetasql.ZetaSQLTypeModifiers.TypeModifiersProto;
import com.google.zetasql.ZetaSQLTypeParameters.TypeParametersProto;
import com.google.zetasql.GraphElementLabel;
import com.google.zetasql.GraphElementLabelRefProto;
import com.google.zetasql.GraphElementTable;
import com.google.zetasql.GraphElementTableRefProto;
import com.google.zetasql.GraphPropertyDeclaration;
import com.google.zetasql.GraphPropertyDeclarationRefProto;
import com.google.zetasql.Model;
import com.google.zetasql.ModelRefProto;
import com.google.zetasql.Procedure;
import com.google.zetasql.ProcedureRefProto;
import com.google.zetasql.PropertyGraph;
import com.google.zetasql.PropertyGraphRefProto;
import com.google.zetasql.ResolvedCollationProto;
import com.google.zetasql.ResolvedColumnProto;
import com.google.zetasql.ResolvedNodeProto;
import com.google.zetasql.Sequence;
import com.google.zetasql.SequenceRefProto;
import com.google.zetasql.Table;
import com.google.zetasql.TableRefProto;
import com.google.zetasql.TableValuedFunction;
import com.google.zetasql.TableValuedFunctionRefProto;
import com.google.zetasql.TVFSignature;
import com.google.zetasql.Type;
import com.google.zetasql.TypeAnnotationProto.FieldFormat;
import com.google.zetasql.TypeParameters;
import com.google.zetasql.Value;
import com.google.zetasql.ValueWithTypeProto;
import com.google.zetasql.resolvedast.ResolvedColumn;
import com.google.zetasql.resolvedast.ResolvedAggregateHavingModifierEnums.HavingModifierKind;
import com.google.zetasql.resolvedast.ResolvedArgumentDefEnums.ArgumentKind;
import com.google.zetasql.resolvedast.ResolvedAuxLoadDataStmtEnums.InsertionMode;
import com.google.zetasql.resolvedast.ResolvedBeginStmtEnums.ReadWriteMode;
import com.google.zetasql.resolvedast.ResolvedCreateStatementEnums.CreateMode;
import com.google.zetasql.resolvedast.ResolvedCreateStatementEnums.CreateScope;
import com.google.zetasql.resolvedast.ResolvedCreateStatementEnums.DeterminismLevel;
import com.google.zetasql.resolvedast.ResolvedCreateStatementEnums.SqlSecurity;
import com.google.zetasql.resolvedast.ResolvedDropIndexStmtEnums.IndexType;
import com.google.zetasql.resolvedast.ResolvedDropStmtEnums.DropMode;
import com.google.zetasql.resolvedast.ResolvedForeignKeyEnums.ActionOperation;
import com.google.zetasql.resolvedast.ResolvedForeignKeyEnums.MatchMode;
import com.google.zetasql.resolvedast.ResolvedFunctionCallBaseEnums.ErrorMode;
import com.google.zetasql.resolvedast.ResolvedGeneratedColumnInfoEnums.GeneratedMode;
import com.google.zetasql.resolvedast.ResolvedGeneratedColumnInfoEnums.StoredMode;
import com.google.zetasql.resolvedast.ResolvedGraphEdgeScanEnums.EdgeOrientation;
import com.google.zetasql.resolvedast.ResolvedGraphLabelNaryExprEnums.GraphLogicalOpType;
import com.google.zetasql.resolvedast.ResolvedGraphPathModeEnums.PathMode;
import com.google.zetasql.resolvedast.ResolvedGraphPathSearchPrefixEnums.PathSearchPrefixType;
import com.google.zetasql.resolvedast.ResolvedImportStmtEnums.ImportKind;
import com.google.zetasql.resolvedast.ResolvedInsertStmtEnums.InsertMode;
import com.google.zetasql.resolvedast.ResolvedJoinScanEnums.JoinType;
import com.google.zetasql.resolvedast.ResolvedLockModeEnums.LockStrengthType;
import com.google.zetasql.resolvedast.ResolvedMatchRecognizePatternAnchorEnums.Mode;
import com.google.zetasql.resolvedast.ResolvedMatchRecognizePatternOperationEnums.MatchRecognizePatternOperationType;
import com.google.zetasql.resolvedast.ResolvedMatchRecognizeScanEnums.AfterMatchSkipMode;
import com.google.zetasql.resolvedast.ResolvedMergeWhenEnums.ActionType;
import com.google.zetasql.resolvedast.ResolvedMergeWhenEnums.MatchType;
import com.google.zetasql.resolvedast.ResolvedNonScalarFunctionCallBaseEnums.NullHandlingModifier;
import com.google.zetasql.resolvedast.ResolvedOnConflictClauseEnums.ConflictAction;
import com.google.zetasql.resolvedast.ResolvedOptionEnums.AssignmentOp;
import com.google.zetasql.resolvedast.ResolvedOrderByItemEnums.NullOrderMode;
import com.google.zetasql.resolvedast.ResolvedRecursiveScanEnums.RecursiveSetOperationType;
import com.google.zetasql.resolvedast.ResolvedSampleScanEnums.SampleUnit;
import com.google.zetasql.resolvedast.ResolvedSetOperationScanEnums.SetOperationColumnMatchMode;
import com.google.zetasql.resolvedast.ResolvedSetOperationScanEnums.SetOperationColumnPropagationMode;
import com.google.zetasql.resolvedast.ResolvedSetOperationScanEnums.SetOperationType;
import com.google.zetasql.resolvedast.ResolvedStatementEnums.ObjectAccess;
import com.google.zetasql.resolvedast.ResolvedSubqueryExprEnums.SubqueryType;
import com.google.zetasql.resolvedast.ResolvedWindowFrameEnums.FrameUnit;
import com.google.zetasql.resolvedast.ResolvedWindowFrameExprEnums.BoundaryType;
import com.google.zetasql.AnyResolvedAggregateScanBaseProto;
import com.google.zetasql.AnyResolvedAlterActionProto;
import com.google.zetasql.AnyResolvedAlterColumnActionProto;
import com.google.zetasql.AnyResolvedAlterObjectStmtProto;
import com.google.zetasql.AnyResolvedArgumentProto;
import com.google.zetasql.AnyResolvedComputedColumnBaseProto;
import com.google.zetasql.AnyResolvedComputedColumnImplProto;
import com.google.zetasql.AnyResolvedConstraintProto;
import com.google.zetasql.AnyResolvedCreateSchemaStmtBaseProto;
import com.google.zetasql.AnyResolvedCreateStatementProto;
import com.google.zetasql.AnyResolvedCreateTableStmtBaseProto;
import com.google.zetasql.AnyResolvedCreateViewBaseProto;
import com.google.zetasql.AnyResolvedExprProto;
import com.google.zetasql.AnyResolvedFunctionCallBaseProto;
import com.google.zetasql.AnyResolvedGrantOrRevokeStmtProto;
import com.google.zetasql.AnyResolvedGraphElementScanProto;
import com.google.zetasql.AnyResolvedGraphLabelExprProto;
import com.google.zetasql.AnyResolvedGraphPathScanBaseProto;
import com.google.zetasql.AnyResolvedGraphScanBaseProto;
import com.google.zetasql.AnyResolvedGroupingSetBaseProto;
import com.google.zetasql.AnyResolvedMatchRecognizePatternExprProto;
import com.google.zetasql.AnyResolvedNonScalarFunctionCallBaseProto;
import com.google.zetasql.AnyResolvedScanProto;
import com.google.zetasql.AnyResolvedStatementProto;
import com.google.zetasql.ResolvedAbortBatchStmtProto;
import com.google.zetasql.ResolvedAddColumnActionProto;
import com.google.zetasql.ResolvedAddConstraintActionProto;
import com.google.zetasql.ResolvedAddSubEntityActionProto;
import com.google.zetasql.ResolvedAddToRestricteeListActionProto;
import com.google.zetasql.ResolvedAggregateFunctionCallProto;
import com.google.zetasql.ResolvedAggregateHavingModifierProto;
import com.google.zetasql.ResolvedAggregateScanProto;
import com.google.zetasql.ResolvedAggregateScanBaseProto;
import com.google.zetasql.ResolvedAggregationThresholdAggregateScanProto;
import com.google.zetasql.ResolvedAlterActionProto;
import com.google.zetasql.ResolvedAlterAllRowAccessPoliciesStmtProto;
import com.google.zetasql.ResolvedAlterApproxViewStmtProto;
import com.google.zetasql.ResolvedAlterColumnActionProto;
import com.google.zetasql.ResolvedAlterColumnDropDefaultActionProto;
import com.google.zetasql.ResolvedAlterColumnDropGeneratedActionProto;
import com.google.zetasql.ResolvedAlterColumnDropNotNullActionProto;
import com.google.zetasql.ResolvedAlterColumnOptionsActionProto;
import com.google.zetasql.ResolvedAlterColumnSetDataTypeActionProto;
import com.google.zetasql.ResolvedAlterColumnSetDefaultActionProto;
import com.google.zetasql.ResolvedAlterConnectionStmtProto;
import com.google.zetasql.ResolvedAlterDatabaseStmtProto;
import com.google.zetasql.ResolvedAlterEntityStmtProto;
import com.google.zetasql.ResolvedAlterExternalSchemaStmtProto;
import com.google.zetasql.ResolvedAlterMaterializedViewStmtProto;
import com.google.zetasql.ResolvedAlterModelStmtProto;
import com.google.zetasql.ResolvedAlterObjectStmtProto;
import com.google.zetasql.ResolvedAlterPrivilegeRestrictionStmtProto;
import com.google.zetasql.ResolvedAlterRowAccessPolicyStmtProto;
import com.google.zetasql.ResolvedAlterSchemaStmtProto;
import com.google.zetasql.ResolvedAlterSubEntityActionProto;
import com.google.zetasql.ResolvedAlterTableSetOptionsStmtProto;
import com.google.zetasql.ResolvedAlterTableStmtProto;
import com.google.zetasql.ResolvedAlterViewStmtProto;
import com.google.zetasql.ResolvedAnalyticFunctionCallProto;
import com.google.zetasql.ResolvedAnalyticFunctionGroupProto;
import com.google.zetasql.ResolvedAnalyticScanProto;
import com.google.zetasql.ResolvedAnalyzeStmtProto;
import com.google.zetasql.ResolvedAnonymizedAggregateScanProto;
import com.google.zetasql.ResolvedArgumentProto;
import com.google.zetasql.ResolvedArgumentDefProto;
import com.google.zetasql.ResolvedArgumentListProto;
import com.google.zetasql.ResolvedArgumentRefProto;
import com.google.zetasql.ResolvedArrayAggregateProto;
import com.google.zetasql.ResolvedArrayScanProto;
import com.google.zetasql.ResolvedAssertRowsModifiedProto;
import com.google.zetasql.ResolvedAssertScanProto;
import com.google.zetasql.ResolvedAssertStmtProto;
import com.google.zetasql.ResolvedAssignmentStmtProto;
import com.google.zetasql.ResolvedAuxLoadDataPartitionFilterProto;
import com.google.zetasql.ResolvedAuxLoadDataStmtProto;
import com.google.zetasql.ResolvedBarrierScanProto;
import com.google.zetasql.ResolvedBeginStmtProto;
import com.google.zetasql.ResolvedCallStmtProto;
import com.google.zetasql.ResolvedCastProto;
import com.google.zetasql.ResolvedCatalogColumnRefProto;
import com.google.zetasql.ResolvedCheckConstraintProto;
import com.google.zetasql.ResolvedCloneDataStmtProto;
import com.google.zetasql.ResolvedColumnAnnotationsProto;
import com.google.zetasql.ResolvedColumnDefaultValueProto;
import com.google.zetasql.ResolvedColumnDefinitionProto;
import com.google.zetasql.ResolvedColumnHolderProto;
import com.google.zetasql.ResolvedColumnRefProto;
import com.google.zetasql.ResolvedCommitStmtProto;
import com.google.zetasql.ResolvedComputedColumnProto;
import com.google.zetasql.ResolvedComputedColumnBaseProto;
import com.google.zetasql.ResolvedComputedColumnImplProto;
import com.google.zetasql.ResolvedConnectionProto;
import com.google.zetasql.ResolvedConstantProto;
import com.google.zetasql.ResolvedConstraintProto;
import com.google.zetasql.ResolvedCreateApproxViewStmtProto;
import com.google.zetasql.ResolvedCreateConnectionStmtProto;
import com.google.zetasql.ResolvedCreateConstantStmtProto;
import com.google.zetasql.ResolvedCreateDatabaseStmtProto;
import com.google.zetasql.ResolvedCreateEntityStmtProto;
import com.google.zetasql.ResolvedCreateExternalSchemaStmtProto;
import com.google.zetasql.ResolvedCreateExternalTableStmtProto;
import com.google.zetasql.ResolvedCreateFunctionStmtProto;
import com.google.zetasql.ResolvedCreateIndexStmtProto;
import com.google.zetasql.ResolvedCreateMaterializedViewStmtProto;
import com.google.zetasql.ResolvedCreateModelAliasedQueryProto;
import com.google.zetasql.ResolvedCreateModelStmtProto;
import com.google.zetasql.ResolvedCreatePrivilegeRestrictionStmtProto;
import com.google.zetasql.ResolvedCreateProcedureStmtProto;
import com.google.zetasql.ResolvedCreatePropertyGraphStmtProto;
import com.google.zetasql.ResolvedCreateRowAccessPolicyStmtProto;
import com.google.zetasql.ResolvedCreateSchemaStmtProto;
import com.google.zetasql.ResolvedCreateSchemaStmtBaseProto;
import com.google.zetasql.ResolvedCreateSnapshotTableStmtProto;
import com.google.zetasql.ResolvedCreateStatementProto;
import com.google.zetasql.ResolvedCreateTableAsSelectStmtProto;
import com.google.zetasql.ResolvedCreateTableFunctionStmtProto;
import com.google.zetasql.ResolvedCreateTableStmtProto;
import com.google.zetasql.ResolvedCreateTableStmtBaseProto;
import com.google.zetasql.ResolvedCreateViewBaseProto;
import com.google.zetasql.ResolvedCreateViewStmtProto;
import com.google.zetasql.ResolvedCubeProto;
import com.google.zetasql.ResolvedDMLDefaultProto;
import com.google.zetasql.ResolvedDMLValueProto;
import com.google.zetasql.ResolvedDeferredComputedColumnProto;
import com.google.zetasql.ResolvedDefineTableStmtProto;
import com.google.zetasql.ResolvedDeleteStmtProto;
import com.google.zetasql.ResolvedDescribeStmtProto;
import com.google.zetasql.ResolvedDescriptorProto;
import com.google.zetasql.ResolvedDifferentialPrivacyAggregateScanProto;
import com.google.zetasql.ResolvedDropColumnActionProto;
import com.google.zetasql.ResolvedDropConstraintActionProto;
import com.google.zetasql.ResolvedDropFunctionStmtProto;
import com.google.zetasql.ResolvedDropIndexStmtProto;
import com.google.zetasql.ResolvedDropMaterializedViewStmtProto;
import com.google.zetasql.ResolvedDropPrimaryKeyActionProto;
import com.google.zetasql.ResolvedDropPrivilegeRestrictionStmtProto;
import com.google.zetasql.ResolvedDropRowAccessPolicyStmtProto;
import com.google.zetasql.ResolvedDropSnapshotTableStmtProto;
import com.google.zetasql.ResolvedDropStmtProto;
import com.google.zetasql.ResolvedDropSubEntityActionProto;
import com.google.zetasql.ResolvedDropTableFunctionStmtProto;
import com.google.zetasql.ResolvedExecuteAsRoleScanProto;
import com.google.zetasql.ResolvedExecuteImmediateArgumentProto;
import com.google.zetasql.ResolvedExecuteImmediateStmtProto;
import com.google.zetasql.ResolvedExplainStmtProto;
import com.google.zetasql.ResolvedExportDataStmtProto;
import com.google.zetasql.ResolvedExportMetadataStmtProto;
import com.google.zetasql.ResolvedExportModelStmtProto;
import com.google.zetasql.ResolvedExprProto;
import com.google.zetasql.ResolvedExpressionColumnProto;
import com.google.zetasql.ResolvedExtendedCastProto;
import com.google.zetasql.ResolvedExtendedCastElementProto;
import com.google.zetasql.ResolvedFilterFieldProto;
import com.google.zetasql.ResolvedFilterFieldArgProto;
import com.google.zetasql.ResolvedFilterScanProto;
import com.google.zetasql.ResolvedFilterUsingActionProto;
import com.google.zetasql.ResolvedFlattenProto;
import com.google.zetasql.ResolvedFlattenedArgProto;
import com.google.zetasql.ResolvedForeignKeyProto;
import com.google.zetasql.ResolvedFunctionArgumentProto;
import com.google.zetasql.ResolvedFunctionCallProto;
import com.google.zetasql.ResolvedFunctionCallBaseProto;
import com.google.zetasql.ResolvedFunctionSignatureHolderProto;
import com.google.zetasql.ResolvedGeneralizedQueryStmtProto;
import com.google.zetasql.ResolvedGeneralizedQuerySubpipelineProto;
import com.google.zetasql.ResolvedGeneratedColumnInfoProto;
import com.google.zetasql.ResolvedGetJsonFieldProto;
import com.google.zetasql.ResolvedGetProtoFieldProto;
import com.google.zetasql.ResolvedGetProtoOneofProto;
import com.google.zetasql.ResolvedGetStructFieldProto;
import com.google.zetasql.ResolvedGrantOrRevokeStmtProto;
import com.google.zetasql.ResolvedGrantStmtProto;
import com.google.zetasql.ResolvedGrantToActionProto;
import com.google.zetasql.ResolvedGraphEdgeScanProto;
import com.google.zetasql.ResolvedGraphElementIdentifierProto;
import com.google.zetasql.ResolvedGraphElementLabelProto;
import com.google.zetasql.ResolvedGraphElementPropertyProto;
import com.google.zetasql.ResolvedGraphElementScanProto;
import com.google.zetasql.ResolvedGraphElementTableProto;
import com.google.zetasql.ResolvedGraphGetElementPropertyProto;
import com.google.zetasql.ResolvedGraphIsLabeledPredicateProto;
import com.google.zetasql.ResolvedGraphLabelProto;
import com.google.zetasql.ResolvedGraphLabelExprProto;
import com.google.zetasql.ResolvedGraphLabelNaryExprProto;
import com.google.zetasql.ResolvedGraphLinearScanProto;
import com.google.zetasql.ResolvedGraphMakeArrayVariableProto;
import com.google.zetasql.ResolvedGraphMakeElementProto;
import com.google.zetasql.ResolvedGraphNodeScanProto;
import com.google.zetasql.ResolvedGraphNodeTableReferenceProto;
import com.google.zetasql.ResolvedGraphPathModeProto;
import com.google.zetasql.ResolvedGraphPathPatternQuantifierProto;
import com.google.zetasql.ResolvedGraphPathScanProto;
import com.google.zetasql.ResolvedGraphPathScanBaseProto;
import com.google.zetasql.ResolvedGraphPathSearchPrefixProto;
import com.google.zetasql.ResolvedGraphPropertyDeclarationProto;
import com.google.zetasql.ResolvedGraphPropertyDefinitionProto;
import com.google.zetasql.ResolvedGraphRefScanProto;
import com.google.zetasql.ResolvedGraphScanProto;
import com.google.zetasql.ResolvedGraphScanBaseProto;
import com.google.zetasql.ResolvedGraphTableScanProto;
import com.google.zetasql.ResolvedGraphWildCardLabelProto;
import com.google.zetasql.ResolvedGroupRowsScanProto;
import com.google.zetasql.ResolvedGroupingCallProto;
import com.google.zetasql.ResolvedGroupingSetProto;
import com.google.zetasql.ResolvedGroupingSetBaseProto;
import com.google.zetasql.ResolvedGroupingSetMultiColumnProto;
import com.google.zetasql.ResolvedIdentityColumnInfoProto;
import com.google.zetasql.ResolvedImportStmtProto;
import com.google.zetasql.ResolvedIndexItemProto;
import com.google.zetasql.ResolvedInlineLambdaProto;
import com.google.zetasql.ResolvedInsertRowProto;
import com.google.zetasql.ResolvedInsertStmtProto;
import com.google.zetasql.ResolvedJoinScanProto;
import com.google.zetasql.ResolvedLimitOffsetScanProto;
import com.google.zetasql.ResolvedLiteralProto;
import com.google.zetasql.ResolvedLockModeProto;
import com.google.zetasql.ResolvedLogScanProto;
import com.google.zetasql.ResolvedMakeProtoProto;
import com.google.zetasql.ResolvedMakeProtoFieldProto;
import com.google.zetasql.ResolvedMakeStructProto;
import com.google.zetasql.ResolvedMatchRecognizePatternAnchorProto;
import com.google.zetasql.ResolvedMatchRecognizePatternEmptyProto;
import com.google.zetasql.ResolvedMatchRecognizePatternExprProto;
import com.google.zetasql.ResolvedMatchRecognizePatternOperationProto;
import com.google.zetasql.ResolvedMatchRecognizePatternQuantificationProto;
import com.google.zetasql.ResolvedMatchRecognizePatternVariableRefProto;
import com.google.zetasql.ResolvedMatchRecognizeScanProto;
import com.google.zetasql.ResolvedMatchRecognizeVariableDefinitionProto;
import com.google.zetasql.ResolvedMeasureGroupProto;
import com.google.zetasql.ResolvedMergeStmtProto;
import com.google.zetasql.ResolvedMergeWhenProto;
import com.google.zetasql.ResolvedModelProto;
import com.google.zetasql.ResolvedModuleStmtProto;
import com.google.zetasql.ResolvedNonScalarFunctionCallBaseProto;
import com.google.zetasql.ResolvedObjectUnitProto;
import com.google.zetasql.ResolvedOnConflictClauseProto;
import com.google.zetasql.ResolvedOptionProto;
import com.google.zetasql.ResolvedOrderByItemProto;
import com.google.zetasql.ResolvedOrderByScanProto;
import com.google.zetasql.ResolvedOutputColumnProto;
import com.google.zetasql.ResolvedOutputSchemaProto;
import com.google.zetasql.ResolvedParameterProto;
import com.google.zetasql.ResolvedPipeExportDataScanProto;
import com.google.zetasql.ResolvedPipeForkScanProto;
import com.google.zetasql.ResolvedPipeIfCaseProto;
import com.google.zetasql.ResolvedPipeIfScanProto;
import com.google.zetasql.ResolvedPivotColumnProto;
import com.google.zetasql.ResolvedPivotScanProto;
import com.google.zetasql.ResolvedPrimaryKeyProto;
import com.google.zetasql.ResolvedPrivilegeProto;
import com.google.zetasql.ResolvedProjectScanProto;
import com.google.zetasql.ResolvedQueryStmtProto;
import com.google.zetasql.ResolvedRecursionDepthModifierProto;
import com.google.zetasql.ResolvedRecursiveRefScanProto;
import com.google.zetasql.ResolvedRecursiveScanProto;
import com.google.zetasql.ResolvedRelationArgumentScanProto;
import com.google.zetasql.ResolvedRemoveFromRestricteeListActionProto;
import com.google.zetasql.ResolvedRenameColumnActionProto;
import com.google.zetasql.ResolvedRenameStmtProto;
import com.google.zetasql.ResolvedRenameToActionProto;
import com.google.zetasql.ResolvedReplaceFieldProto;
import com.google.zetasql.ResolvedReplaceFieldItemProto;
import com.google.zetasql.ResolvedRestrictToActionProto;
import com.google.zetasql.ResolvedReturningClauseProto;
import com.google.zetasql.ResolvedRevokeFromActionProto;
import com.google.zetasql.ResolvedRevokeStmtProto;
import com.google.zetasql.ResolvedRollbackStmtProto;
import com.google.zetasql.ResolvedRollupProto;
import com.google.zetasql.ResolvedRunBatchStmtProto;
import com.google.zetasql.ResolvedSampleScanProto;
import com.google.zetasql.ResolvedScanProto;
import com.google.zetasql.ResolvedSequenceProto;
import com.google.zetasql.ResolvedSetAsActionProto;
import com.google.zetasql.ResolvedSetCollateClauseProto;
import com.google.zetasql.ResolvedSetOperationItemProto;
import com.google.zetasql.ResolvedSetOperationScanProto;
import com.google.zetasql.ResolvedSetOptionsActionProto;
import com.google.zetasql.ResolvedSetTransactionStmtProto;
import com.google.zetasql.ResolvedShowStmtProto;
import com.google.zetasql.ResolvedSingleRowScanProto;
import com.google.zetasql.ResolvedStartBatchStmtProto;
import com.google.zetasql.ResolvedStatementProto;
import com.google.zetasql.ResolvedStaticDescribeScanProto;
import com.google.zetasql.ResolvedSubpipelineProto;
import com.google.zetasql.ResolvedSubpipelineInputScanProto;
import com.google.zetasql.ResolvedSubqueryExprProto;
import com.google.zetasql.ResolvedSystemVariableProto;
import com.google.zetasql.ResolvedTVFScanProto;
import com.google.zetasql.ResolvedTableAndColumnInfoProto;
import com.google.zetasql.ResolvedTableScanProto;
import com.google.zetasql.ResolvedTruncateStmtProto;
import com.google.zetasql.ResolvedUndropStmtProto;
import com.google.zetasql.ResolvedUnnestItemProto;
import com.google.zetasql.ResolvedUnpivotArgProto;
import com.google.zetasql.ResolvedUnpivotScanProto;
import com.google.zetasql.ResolvedUpdateArrayItemProto;
import com.google.zetasql.ResolvedUpdateItemProto;
import com.google.zetasql.ResolvedUpdateStmtProto;
import com.google.zetasql.ResolvedWindowFrameProto;
import com.google.zetasql.ResolvedWindowFrameExprProto;
import com.google.zetasql.ResolvedWindowOrderingProto;
import com.google.zetasql.ResolvedWindowPartitioningProto;
import com.google.zetasql.ResolvedWithEntryProto;
import com.google.zetasql.ResolvedWithExprProto;
import com.google.zetasql.ResolvedWithPartitionColumnsProto;
import com.google.zetasql.ResolvedWithRefScanProto;
import com.google.zetasql.ResolvedWithScanProto;
import java.util.List;
import javax.annotation.Nullable;
/**
* This is a dummy implementation of AnnotationMap.
* TODO: implement AnnotationMap in
* package com.google.zetasql
*/
final class AnnotationMap {
public AnnotationMap() {
}
public AnnotationMapProto serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return AnnotationMapProto.getDefaultInstance();
}
public String debugString() {
return "";
}
}
/**
* This is a dummy implementation of ResolvedCollation.
* TODO: implement ResolvedCollation in
* package com.google.zetasql
*/
final class ResolvedCollation {
public ResolvedCollation() {
}
public ResolvedCollationProto serialize() {
return ResolvedCollationProto.getDefaultInstance();
}
public static ResolvedCollation deserialize(ResolvedCollationProto proto) {
return new ResolvedCollation();
}
public String debugString() {
return "";
}
}
/**
* This is a dummy implementation of TypeModifiers and currently only support
* type_parameters.
* TODO: implement TypeModifiers in
* package com.google.zetasql
*/
final class TypeModifiers{
private TypeParameters type_parameters;
public TypeModifiers() {
type_parameters = new TypeParameters();
}
public TypeModifiers(TypeParameters type_parameters) {
this.type_parameters = type_parameters;
}
public boolean isEmpty() {
return type_parameters.isEmpty();
}
public TypeModifiersProto serialize() {
TypeModifiersProto.Builder builder = TypeModifiersProto.newBuilder();
builder.setTypeParameters(this.type_parameters.serialize());
return builder.build();
}
public static TypeModifiers deserialize(TypeModifiersProto proto) {
if (proto.hasTypeParameters()) {
return new TypeModifiers(TypeParameters.deserialize(proto.getTypeParameters()));
}
return new TypeModifiers();
}
public String debugString() {
if (isEmpty()) {
return "null";
}
return "type_parameters:" + this.type_parameters.debugString();
}
}
/**
* This class is a container for all subclasses of {@link ResolvedNode}.
*
* HTML documentation for the class hierarchy is generated in resolved_ast.html.
* A viewable copy is available at (broken link).
*
* In this hierarchy, classes are either abstract or leaves.
*/
public final class ResolvedNodes {
private ResolvedNodes() {}
static ConstantRefProto serialize(Constant constant,
@SuppressWarnings("unused") FileDescriptorSetsBuilder unused) {
return
ConstantRefProto.newBuilder().setName(constant.getFullName()).build();
}
static FunctionRefProto serialize(Function function,
@SuppressWarnings("unused") FileDescriptorSetsBuilder unused) {
return FunctionRefProto.newBuilder().setName(function.getFullName()).build();
}
static FunctionSignatureProto serialize(FunctionSignature functionSignature,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
if (functionSignature == null) return null;
return functionSignature.serialize(fileDescriptorSetsBuilder);
}
static FieldDescriptorRefProto serialize(ZetaSQLFieldDescriptor descriptor,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
FieldDescriptorRefProto.Builder fieldDescriptorRef = FieldDescriptorRefProto.newBuilder();
ProtoTypeProto.Builder proto = ProtoTypeProto.newBuilder();
FieldDescriptor fieldDescriptor = descriptor.getDescriptor();
proto.setProtoName(fieldDescriptor.getContainingType().getFullName());
proto.setProtoFileName(fieldDescriptor.getFile().getName());
proto.setFileDescriptorSetIndex(
fileDescriptorSetsBuilder.getOrAddFileDescriptorIndex(
fieldDescriptor.getFile(), descriptor.getDescriptorPool()));
fieldDescriptorRef.setContainingProto(proto.build());
fieldDescriptorRef.setNumber(fieldDescriptor.getNumber());
return fieldDescriptorRef.build();
}
static OneofDescriptorRefProto serialize(ZetaSQLOneofDescriptor descriptor,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
OneofDescriptorRefProto.Builder oneOfDescriptorRef = OneofDescriptorRefProto.newBuilder();
ProtoTypeProto.Builder proto = ProtoTypeProto.newBuilder();
OneofDescriptor oneOfDescriptor = descriptor.getDescriptor();
proto.setProtoName(oneOfDescriptor.getContainingType().getFullName());
proto.setProtoFileName(oneOfDescriptor.getFile().getName());
proto.setFileDescriptorSetIndex(
fileDescriptorSetsBuilder.getOrAddFileDescriptorIndex(
oneOfDescriptor.getFile(), descriptor.getDescriptorPool()));
oneOfDescriptorRef.setContainingProto(proto.build());
oneOfDescriptorRef.setIndex(oneOfDescriptor.getIndex());
return oneOfDescriptorRef.build();
}
static ResolvedFunctionCallInfoProto serialize(
ResolvedFunctionCallInfo functionCallContext,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return ResolvedFunctionCallInfoProto.getDefaultInstance();
}
static TVFSignatureProto serialize(
TVFSignature tvfSignature, FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return tvfSignature.serialize(fileDescriptorSetsBuilder);
}
static TableValuedFunctionRefProto serialize(
TableValuedFunction tvf, FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return TableValuedFunctionRefProto.newBuilder().setName(tvf.getName()).build();
}
static ModelRefProto serialize(Model model, FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return ModelRefProto.newBuilder().setName(model.getName()).setSerializationId(model.getId()).build();
}
static ConnectionRefProto serialize(Connection connection, FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return ConnectionRefProto.newBuilder().setName(connection.getName()).setFullName(connection.getFullName()).build();
}
static SequenceRefProto serialize(Sequence sequence, FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return SequenceRefProto.newBuilder().setName(sequence.getName()).build();
}
static ProcedureRefProto serialize(Procedure procedure,
@SuppressWarnings("unused") FileDescriptorSetsBuilder unused) {
return ProcedureRefProto.newBuilder().setName(procedure.getFullName()).build();
}
static TableRefProto serialize(Table table, FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return TableRefProto.newBuilder()
.setName(table.getName())
.setFullName(table.getFullName())
.setSerializationId(table.getId()).build();
}
static ColumnRefProto serialize(Column column,
@SuppressWarnings("unused") FileDescriptorSetsBuilder unused) {
String colFullName = column.getFullName();
int pos = colFullName.lastIndexOf('.');
TableRefProto table;
if(pos == -1) {
return ColumnRefProto.newBuilder()
.setName(column.getName())
.build();
}
String tableFullName = colFullName.substring(0, pos);
String[] namePath = tableFullName.split("\\.");
return ColumnRefProto.newBuilder()
.setName(column.getName())
.setTableRef(
TableRefProto.newBuilder()
.setName(namePath[namePath.length-1])
.setFullName(tableFullName))
.build();
}
static TypeProto serialize(Type type, FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
TypeProto.Builder builder = TypeProto.newBuilder();
type.serialize(builder, fileDescriptorSetsBuilder);
return builder.build();
}
static ValueWithTypeProto serialize(Value value, FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
ValueWithTypeProto.Builder builder = ValueWithTypeProto.newBuilder();
if (value.isValid()) {
builder.setType(serialize(value.getType(), fileDescriptorSetsBuilder));
builder.setValue(value.getProto());
}
return builder.build();
}
static ResolvedColumnProto serialize(ResolvedColumn col, FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
ResolvedColumnProto.Builder builder = ResolvedColumnProto.newBuilder();
builder.setColumnId(col.getId());
builder.setTableName(col.getTableName());
builder.setName(col.getName());
builder.setType(serialize(col.getType(), fileDescriptorSetsBuilder));
return builder.build();
}
static AnnotationMapProto serialize(
AnnotationMap annotationMap,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return annotationMap.serialize(fileDescriptorSetsBuilder);
}
static ResolvedCollationProto serialize(
ResolvedCollation resolvedCollation,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return resolvedCollation.serialize();
}
static TypeModifiersProto serialize(
TypeModifiers typeModifiers,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return typeModifiers.serialize();
}
static TypeParametersProto serialize(
TypeParameters typeParameters,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return typeParameters.serialize();
}
static PropertyGraphRefProto serialize(
PropertyGraph propertyGraph,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
return PropertyGraphRefProto.newBuilder()
.setFullName(propertyGraph.getFullName()).build();
}
static GraphPropertyDeclarationRefProto serialize(
GraphPropertyDeclaration graphPropertyDeclaration,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
String fullName = graphPropertyDeclaration.getFullName();
int pos = fullName.lastIndexOf('.');
Preconditions.checkArgument(pos != -1);
return GraphPropertyDeclarationRefProto.newBuilder()
.setName(graphPropertyDeclaration.getName())
.setPropertyGraph(
PropertyGraphRefProto.newBuilder()
.setFullName(fullName.substring(0, pos))
)
.build();
}
static GraphElementLabelRefProto serialize(
GraphElementLabel graphElementLabel,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
// The label full name consists of three parts ,
// , and . The property graph full name is
// .. Note the catalog full name
// may be a path containing multiple nested catalogs.
String fullName = graphElementLabel.getFullName();
int pos = fullName.lastIndexOf('.');
Preconditions.checkArgument(pos != -1);
return GraphElementLabelRefProto.newBuilder()
.setName(graphElementLabel.getName())
.setPropertyGraph(
PropertyGraphRefProto.newBuilder()
.setFullName(fullName.substring(0, pos))
)
.build();
}
static GraphElementTableRefProto serialize(
GraphElementTable graphElementTable,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
// The element table full name consists of three parts ,
// , and . The property graph full
// name is .. Note the catalog full
// name may be a path containing multiple nested catalogs.
String fullName = graphElementTable.getFullName();
int pos = fullName.lastIndexOf('.');
Preconditions.checkArgument(pos != -1);
return GraphElementTableRefProto.newBuilder()
.setName(graphElementTable.getName())
.setPropertyGraph(
PropertyGraphRefProto.newBuilder()
.setFullName(fullName.substring(0, pos))
)
.build();
}
public static ResolvedNode deserialize(
AnyResolvedNodeProto proto, AbstractDeserializationHelper helper) {
switch (proto.getNodeCase()) {
case RESOLVED_ARGUMENT_NODE:
return ResolvedArgument.deserialize(proto.getResolvedArgumentNode(), helper);
case RESOLVED_EXPR_NODE:
return ResolvedExpr.deserialize(proto.getResolvedExprNode(), helper);
case RESOLVED_SCAN_NODE:
return ResolvedScan.deserialize(proto.getResolvedScanNode(), helper);
case RESOLVED_STATEMENT_NODE:
return ResolvedStatement.deserialize(proto.getResolvedStatementNode(), helper);
default:
throw new IllegalArgumentException("Invalid Node kind: " + proto.getNodeCase());
}
}
public static AnyResolvedNodeProto serialize(
ResolvedArgument node,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedNodeProto.Builder proto = AnyResolvedNodeProto.newBuilder();
AnyResolvedArgumentProto.Builder builder = AnyResolvedArgumentProto.newBuilder();
node.serialize(fileDescriptorSetsBuilder, builder);
proto.setResolvedArgumentNode(builder.build());
return proto.build();
}
public static AnyResolvedNodeProto serialize(
ResolvedExpr node,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedNodeProto.Builder proto = AnyResolvedNodeProto.newBuilder();
AnyResolvedExprProto.Builder builder = AnyResolvedExprProto.newBuilder();
node.serialize(fileDescriptorSetsBuilder, builder);
proto.setResolvedExprNode(builder.build());
return proto.build();
}
public static AnyResolvedNodeProto serialize(
ResolvedScan node,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedNodeProto.Builder proto = AnyResolvedNodeProto.newBuilder();
AnyResolvedScanProto.Builder builder = AnyResolvedScanProto.newBuilder();
node.serialize(fileDescriptorSetsBuilder, builder);
proto.setResolvedScanNode(builder.build());
return proto.build();
}
public static AnyResolvedNodeProto serialize(
ResolvedStatement node,
FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedNodeProto.Builder proto = AnyResolvedNodeProto.newBuilder();
AnyResolvedStatementProto.Builder builder = AnyResolvedStatementProto.newBuilder();
node.serialize(fileDescriptorSetsBuilder, builder);
proto.setResolvedStatementNode(builder.build());
return proto.build();
}
/**
* A visitor that ResolvedNodes accepts. The default implementation of each
* method is to descend into the AST graph and redispatch to each child node.
* Clients are expected to override {@code visit} methods corresponding
* to the types they are interested in.
*/
public static abstract class Visitor {
protected void defaultVisit(ResolvedNode node) {
node.acceptChildren(this);
}
// private helper method to visit a list of nodes
private void descend(ImmutableList extends ResolvedNode> children) {
children.stream().forEach((child) -> child.accept(this));
}
// private helper method to check for null before visiting a node
private void descend(ResolvedNode child) {
if (child != null) {
child.accept(this);
}
}
public void visit(ResolvedLiteral node) {
defaultVisit(node);
}
public void visit(ResolvedParameter node) {
defaultVisit(node);
}
public void visit(ResolvedExpressionColumn node) {
defaultVisit(node);
}
public void visit(ResolvedCatalogColumnRef node) {
defaultVisit(node);
}
public void visit(ResolvedColumnRef node) {
defaultVisit(node);
}
public void visit(ResolvedGroupingSetMultiColumn node) {
defaultVisit(node);
}
public void visit(ResolvedConstant node) {
defaultVisit(node);
}
public void visit(ResolvedSystemVariable node) {
defaultVisit(node);
}
public void visit(ResolvedInlineLambda node) {
defaultVisit(node);
}
public void visit(ResolvedSequence node) {
defaultVisit(node);
}
public void visit(ResolvedFilterFieldArg node) {
defaultVisit(node);
}
public void visit(ResolvedFilterField node) {
defaultVisit(node);
}
public void visit(ResolvedFunctionCall node) {
defaultVisit(node);
}
public void visit(ResolvedAggregateFunctionCall node) {
defaultVisit(node);
}
public void visit(ResolvedAnalyticFunctionCall node) {
defaultVisit(node);
}
public void visit(ResolvedExtendedCastElement node) {
defaultVisit(node);
}
public void visit(ResolvedExtendedCast node) {
defaultVisit(node);
}
public void visit(ResolvedCast node) {
defaultVisit(node);
}
public void visit(ResolvedMakeStruct node) {
defaultVisit(node);
}
public void visit(ResolvedMakeProto node) {
defaultVisit(node);
}
public void visit(ResolvedMakeProtoField node) {
defaultVisit(node);
}
public void visit(ResolvedGetStructField node) {
defaultVisit(node);
}
public void visit(ResolvedGetProtoField node) {
defaultVisit(node);
}
public void visit(ResolvedGetJsonField node) {
defaultVisit(node);
}
public void visit(ResolvedFlatten node) {
defaultVisit(node);
}
public void visit(ResolvedFlattenedArg node) {
defaultVisit(node);
}
public void visit(ResolvedReplaceFieldItem node) {
defaultVisit(node);
}
public void visit(ResolvedReplaceField node) {
defaultVisit(node);
}
public void visit(ResolvedGetProtoOneof node) {
defaultVisit(node);
}
public void visit(ResolvedSubqueryExpr node) {
defaultVisit(node);
}
public void visit(ResolvedWithExpr node) {
defaultVisit(node);
}
public void visit(ResolvedExecuteAsRoleScan node) {
defaultVisit(node);
}
public void visit(ResolvedModel node) {
defaultVisit(node);
}
public void visit(ResolvedConnection node) {
defaultVisit(node);
}
public void visit(ResolvedDescriptor node) {
defaultVisit(node);
}
public void visit(ResolvedSingleRowScan node) {
defaultVisit(node);
}
public void visit(ResolvedTableScan node) {
defaultVisit(node);
}
public void visit(ResolvedJoinScan node) {
defaultVisit(node);
}
public void visit(ResolvedArrayScan node) {
defaultVisit(node);
}
public void visit(ResolvedColumnHolder node) {
defaultVisit(node);
}
public void visit(ResolvedFilterScan node) {
defaultVisit(node);
}
public void visit(ResolvedGroupingCall node) {
defaultVisit(node);
}
public void visit(ResolvedGroupingSet node) {
defaultVisit(node);
}
public void visit(ResolvedRollup node) {
defaultVisit(node);
}
public void visit(ResolvedCube node) {
defaultVisit(node);
}
public void visit(ResolvedAggregateScan node) {
defaultVisit(node);
}
public void visit(ResolvedAnonymizedAggregateScan node) {
defaultVisit(node);
}
public void visit(ResolvedDifferentialPrivacyAggregateScan node) {
defaultVisit(node);
}
public void visit(ResolvedAggregationThresholdAggregateScan node) {
defaultVisit(node);
}
public void visit(ResolvedSetOperationItem node) {
defaultVisit(node);
}
public void visit(ResolvedSetOperationScan node) {
defaultVisit(node);
}
public void visit(ResolvedOrderByScan node) {
defaultVisit(node);
}
public void visit(ResolvedLimitOffsetScan node) {
defaultVisit(node);
}
public void visit(ResolvedWithRefScan node) {
defaultVisit(node);
}
public void visit(ResolvedAnalyticScan node) {
defaultVisit(node);
}
public void visit(ResolvedSampleScan node) {
defaultVisit(node);
}
public void visit(ResolvedComputedColumn node) {
defaultVisit(node);
}
public void visit(ResolvedDeferredComputedColumn node) {
defaultVisit(node);
}
public void visit(ResolvedOrderByItem node) {
defaultVisit(node);
}
public void visit(ResolvedColumnAnnotations node) {
defaultVisit(node);
}
public void visit(ResolvedGeneratedColumnInfo node) {
defaultVisit(node);
}
public void visit(ResolvedColumnDefaultValue node) {
defaultVisit(node);
}
public void visit(ResolvedColumnDefinition node) {
defaultVisit(node);
}
public void visit(ResolvedPrimaryKey node) {
defaultVisit(node);
}
public void visit(ResolvedForeignKey node) {
defaultVisit(node);
}
public void visit(ResolvedCheckConstraint node) {
defaultVisit(node);
}
public void visit(ResolvedOutputColumn node) {
defaultVisit(node);
}
public void visit(ResolvedOutputSchema node) {
defaultVisit(node);
}
public void visit(ResolvedProjectScan node) {
defaultVisit(node);
}
public void visit(ResolvedTVFScan node) {
defaultVisit(node);
}
public void visit(ResolvedGroupRowsScan node) {
defaultVisit(node);
}
public void visit(ResolvedFunctionArgument node) {
defaultVisit(node);
}
public void visit(ResolvedExplainStmt node) {
defaultVisit(node);
}
public void visit(ResolvedQueryStmt node) {
defaultVisit(node);
}
public void visit(ResolvedGeneralizedQueryStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateDatabaseStmt node) {
defaultVisit(node);
}
public void visit(ResolvedIndexItem node) {
defaultVisit(node);
}
public void visit(ResolvedUnnestItem node) {
defaultVisit(node);
}
public void visit(ResolvedCreateIndexStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateSchemaStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateExternalSchemaStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateTableStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateTableAsSelectStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateModelAliasedQuery node) {
defaultVisit(node);
}
public void visit(ResolvedCreateModelStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateViewStmt node) {
defaultVisit(node);
}
public void visit(ResolvedWithPartitionColumns node) {
defaultVisit(node);
}
public void visit(ResolvedCreateSnapshotTableStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateExternalTableStmt node) {
defaultVisit(node);
}
public void visit(ResolvedExportModelStmt node) {
defaultVisit(node);
}
public void visit(ResolvedExportDataStmt node) {
defaultVisit(node);
}
public void visit(ResolvedExportMetadataStmt node) {
defaultVisit(node);
}
public void visit(ResolvedDefineTableStmt node) {
defaultVisit(node);
}
public void visit(ResolvedDescribeStmt node) {
defaultVisit(node);
}
public void visit(ResolvedShowStmt node) {
defaultVisit(node);
}
public void visit(ResolvedBeginStmt node) {
defaultVisit(node);
}
public void visit(ResolvedSetTransactionStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCommitStmt node) {
defaultVisit(node);
}
public void visit(ResolvedRollbackStmt node) {
defaultVisit(node);
}
public void visit(ResolvedStartBatchStmt node) {
defaultVisit(node);
}
public void visit(ResolvedRunBatchStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAbortBatchStmt node) {
defaultVisit(node);
}
public void visit(ResolvedDropStmt node) {
defaultVisit(node);
}
public void visit(ResolvedDropMaterializedViewStmt node) {
defaultVisit(node);
}
public void visit(ResolvedDropSnapshotTableStmt node) {
defaultVisit(node);
}
public void visit(ResolvedRecursiveRefScan node) {
defaultVisit(node);
}
public void visit(ResolvedRecursionDepthModifier node) {
defaultVisit(node);
}
public void visit(ResolvedRecursiveScan node) {
defaultVisit(node);
}
public void visit(ResolvedWithScan node) {
defaultVisit(node);
}
public void visit(ResolvedWithEntry node) {
defaultVisit(node);
}
public void visit(ResolvedOption node) {
defaultVisit(node);
}
public void visit(ResolvedWindowPartitioning node) {
defaultVisit(node);
}
public void visit(ResolvedWindowOrdering node) {
defaultVisit(node);
}
public void visit(ResolvedWindowFrame node) {
defaultVisit(node);
}
public void visit(ResolvedAnalyticFunctionGroup node) {
defaultVisit(node);
}
public void visit(ResolvedWindowFrameExpr node) {
defaultVisit(node);
}
public void visit(ResolvedDMLValue node) {
defaultVisit(node);
}
public void visit(ResolvedDMLDefault node) {
defaultVisit(node);
}
public void visit(ResolvedAssertStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAssertRowsModified node) {
defaultVisit(node);
}
public void visit(ResolvedOnConflictClause node) {
defaultVisit(node);
}
public void visit(ResolvedInsertRow node) {
defaultVisit(node);
}
public void visit(ResolvedInsertStmt node) {
defaultVisit(node);
}
public void visit(ResolvedDeleteStmt node) {
defaultVisit(node);
}
public void visit(ResolvedUpdateItem node) {
defaultVisit(node);
}
public void visit(ResolvedUpdateArrayItem node) {
defaultVisit(node);
}
public void visit(ResolvedUpdateStmt node) {
defaultVisit(node);
}
public void visit(ResolvedMergeWhen node) {
defaultVisit(node);
}
public void visit(ResolvedMergeStmt node) {
defaultVisit(node);
}
public void visit(ResolvedTruncateStmt node) {
defaultVisit(node);
}
public void visit(ResolvedObjectUnit node) {
defaultVisit(node);
}
public void visit(ResolvedPrivilege node) {
defaultVisit(node);
}
public void visit(ResolvedGrantStmt node) {
defaultVisit(node);
}
public void visit(ResolvedRevokeStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterDatabaseStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterMaterializedViewStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterApproxViewStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterSchemaStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterExternalSchemaStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterModelStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterTableStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterViewStmt node) {
defaultVisit(node);
}
public void visit(ResolvedSetOptionsAction node) {
defaultVisit(node);
}
public void visit(ResolvedAlterSubEntityAction node) {
defaultVisit(node);
}
public void visit(ResolvedAddSubEntityAction node) {
defaultVisit(node);
}
public void visit(ResolvedDropSubEntityAction node) {
defaultVisit(node);
}
public void visit(ResolvedAddColumnAction node) {
defaultVisit(node);
}
public void visit(ResolvedAddConstraintAction node) {
defaultVisit(node);
}
public void visit(ResolvedDropConstraintAction node) {
defaultVisit(node);
}
public void visit(ResolvedDropPrimaryKeyAction node) {
defaultVisit(node);
}
public void visit(ResolvedAlterColumnOptionsAction node) {
defaultVisit(node);
}
public void visit(ResolvedAlterColumnDropNotNullAction node) {
defaultVisit(node);
}
public void visit(ResolvedAlterColumnDropGeneratedAction node) {
defaultVisit(node);
}
public void visit(ResolvedAlterColumnSetDataTypeAction node) {
defaultVisit(node);
}
public void visit(ResolvedAlterColumnSetDefaultAction node) {
defaultVisit(node);
}
public void visit(ResolvedAlterColumnDropDefaultAction node) {
defaultVisit(node);
}
public void visit(ResolvedDropColumnAction node) {
defaultVisit(node);
}
public void visit(ResolvedRenameColumnAction node) {
defaultVisit(node);
}
public void visit(ResolvedSetAsAction node) {
defaultVisit(node);
}
public void visit(ResolvedSetCollateClause node) {
defaultVisit(node);
}
public void visit(ResolvedAlterTableSetOptionsStmt node) {
defaultVisit(node);
}
public void visit(ResolvedRenameStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreatePrivilegeRestrictionStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateRowAccessPolicyStmt node) {
defaultVisit(node);
}
public void visit(ResolvedDropPrivilegeRestrictionStmt node) {
defaultVisit(node);
}
public void visit(ResolvedDropRowAccessPolicyStmt node) {
defaultVisit(node);
}
public void visit(ResolvedDropIndexStmt node) {
defaultVisit(node);
}
public void visit(ResolvedGrantToAction node) {
defaultVisit(node);
}
public void visit(ResolvedRestrictToAction node) {
defaultVisit(node);
}
public void visit(ResolvedAddToRestricteeListAction node) {
defaultVisit(node);
}
public void visit(ResolvedRemoveFromRestricteeListAction node) {
defaultVisit(node);
}
public void visit(ResolvedFilterUsingAction node) {
defaultVisit(node);
}
public void visit(ResolvedRevokeFromAction node) {
defaultVisit(node);
}
public void visit(ResolvedRenameToAction node) {
defaultVisit(node);
}
public void visit(ResolvedAlterPrivilegeRestrictionStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterRowAccessPolicyStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterAllRowAccessPoliciesStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateConstantStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateFunctionStmt node) {
defaultVisit(node);
}
public void visit(ResolvedArgumentDef node) {
defaultVisit(node);
}
public void visit(ResolvedArgumentRef node) {
defaultVisit(node);
}
public void visit(ResolvedCreateTableFunctionStmt node) {
defaultVisit(node);
}
public void visit(ResolvedRelationArgumentScan node) {
defaultVisit(node);
}
public void visit(ResolvedArgumentList node) {
defaultVisit(node);
}
public void visit(ResolvedFunctionSignatureHolder node) {
defaultVisit(node);
}
public void visit(ResolvedDropFunctionStmt node) {
defaultVisit(node);
}
public void visit(ResolvedDropTableFunctionStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCallStmt node) {
defaultVisit(node);
}
public void visit(ResolvedImportStmt node) {
defaultVisit(node);
}
public void visit(ResolvedModuleStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAggregateHavingModifier node) {
defaultVisit(node);
}
public void visit(ResolvedCreateMaterializedViewStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateApproxViewStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateProcedureStmt node) {
defaultVisit(node);
}
public void visit(ResolvedExecuteImmediateArgument node) {
defaultVisit(node);
}
public void visit(ResolvedExecuteImmediateStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAssignmentStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreateEntityStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterEntityStmt node) {
defaultVisit(node);
}
public void visit(ResolvedPivotColumn node) {
defaultVisit(node);
}
public void visit(ResolvedPivotScan node) {
defaultVisit(node);
}
public void visit(ResolvedReturningClause node) {
defaultVisit(node);
}
public void visit(ResolvedUnpivotArg node) {
defaultVisit(node);
}
public void visit(ResolvedUnpivotScan node) {
defaultVisit(node);
}
public void visit(ResolvedMatchRecognizeScan node) {
defaultVisit(node);
}
public void visit(ResolvedMeasureGroup node) {
defaultVisit(node);
}
public void visit(ResolvedMatchRecognizeVariableDefinition node) {
defaultVisit(node);
}
public void visit(ResolvedMatchRecognizePatternEmpty node) {
defaultVisit(node);
}
public void visit(ResolvedMatchRecognizePatternAnchor node) {
defaultVisit(node);
}
public void visit(ResolvedMatchRecognizePatternVariableRef node) {
defaultVisit(node);
}
public void visit(ResolvedMatchRecognizePatternOperation node) {
defaultVisit(node);
}
public void visit(ResolvedMatchRecognizePatternQuantification node) {
defaultVisit(node);
}
public void visit(ResolvedCloneDataStmt node) {
defaultVisit(node);
}
public void visit(ResolvedTableAndColumnInfo node) {
defaultVisit(node);
}
public void visit(ResolvedAnalyzeStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAuxLoadDataPartitionFilter node) {
defaultVisit(node);
}
public void visit(ResolvedAuxLoadDataStmt node) {
defaultVisit(node);
}
public void visit(ResolvedCreatePropertyGraphStmt node) {
defaultVisit(node);
}
public void visit(ResolvedGraphElementTable node) {
defaultVisit(node);
}
public void visit(ResolvedGraphNodeTableReference node) {
defaultVisit(node);
}
public void visit(ResolvedGraphElementLabel node) {
defaultVisit(node);
}
public void visit(ResolvedGraphPropertyDeclaration node) {
defaultVisit(node);
}
public void visit(ResolvedGraphPropertyDefinition node) {
defaultVisit(node);
}
public void visit(ResolvedGraphRefScan node) {
defaultVisit(node);
}
public void visit(ResolvedGraphLinearScan node) {
defaultVisit(node);
}
public void visit(ResolvedGraphTableScan node) {
defaultVisit(node);
}
public void visit(ResolvedGraphScan node) {
defaultVisit(node);
}
public void visit(ResolvedGraphPathPatternQuantifier node) {
defaultVisit(node);
}
public void visit(ResolvedGraphPathSearchPrefix node) {
defaultVisit(node);
}
public void visit(ResolvedGraphNodeScan node) {
defaultVisit(node);
}
public void visit(ResolvedGraphEdgeScan node) {
defaultVisit(node);
}
public void visit(ResolvedGraphGetElementProperty node) {
defaultVisit(node);
}
public void visit(ResolvedGraphLabelNaryExpr node) {
defaultVisit(node);
}
public void visit(ResolvedGraphLabel node) {
defaultVisit(node);
}
public void visit(ResolvedGraphWildCardLabel node) {
defaultVisit(node);
}
public void visit(ResolvedGraphElementIdentifier node) {
defaultVisit(node);
}
public void visit(ResolvedGraphElementProperty node) {
defaultVisit(node);
}
public void visit(ResolvedGraphMakeElement node) {
defaultVisit(node);
}
public void visit(ResolvedArrayAggregate node) {
defaultVisit(node);
}
public void visit(ResolvedGraphMakeArrayVariable node) {
defaultVisit(node);
}
public void visit(ResolvedGraphPathMode node) {
defaultVisit(node);
}
public void visit(ResolvedGraphPathScan node) {
defaultVisit(node);
}
public void visit(ResolvedGraphIsLabeledPredicate node) {
defaultVisit(node);
}
public void visit(ResolvedUndropStmt node) {
defaultVisit(node);
}
public void visit(ResolvedIdentityColumnInfo node) {
defaultVisit(node);
}
public void visit(ResolvedStaticDescribeScan node) {
defaultVisit(node);
}
public void visit(ResolvedAssertScan node) {
defaultVisit(node);
}
public void visit(ResolvedLogScan node) {
defaultVisit(node);
}
public void visit(ResolvedPipeIfScan node) {
defaultVisit(node);
}
public void visit(ResolvedPipeIfCase node) {
defaultVisit(node);
}
public void visit(ResolvedPipeForkScan node) {
defaultVisit(node);
}
public void visit(ResolvedPipeExportDataScan node) {
defaultVisit(node);
}
public void visit(ResolvedSubpipeline node) {
defaultVisit(node);
}
public void visit(ResolvedSubpipelineInputScan node) {
defaultVisit(node);
}
public void visit(ResolvedGeneralizedQuerySubpipeline node) {
defaultVisit(node);
}
public void visit(ResolvedBarrierScan node) {
defaultVisit(node);
}
public void visit(ResolvedCreateConnectionStmt node) {
defaultVisit(node);
}
public void visit(ResolvedAlterConnectionStmt node) {
defaultVisit(node);
}
public void visit(ResolvedLockMode node) {
defaultVisit(node);
}
}
/**
* Argument nodes are not self-contained nodes in the tree. They exist
* only to describe parameters to another node (e.g. columns in an OrderBy).
* This node is here for organizational purposes only, to cluster these
* argument nodes.
*/
public static abstract class ResolvedArgument extends ResolvedNode {
ResolvedArgument(ResolvedArgumentProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
}
ResolvedArgument() {
super();
}
@Override
public abstract Builder toBuilder();
public static abstract class Builder extends ResolvedNode.Builder {
private Builder() {}
@Override
public abstract ResolvedArgument build();
@Override
protected void validate() {
super.validate();
}
}
public static ResolvedArgument deserialize(
AnyResolvedArgumentProto proto, AbstractDeserializationHelper helper) {
switch (proto.getNodeCase()) {
case RESOLVED_MAKE_PROTO_FIELD_NODE:
return ResolvedMakeProtoField.deserialize(
proto.getResolvedMakeProtoFieldNode(), helper);
case RESOLVED_COLUMN_HOLDER_NODE:
return ResolvedColumnHolder.deserialize(
proto.getResolvedColumnHolderNode(), helper);
case RESOLVED_ORDER_BY_ITEM_NODE:
return ResolvedOrderByItem.deserialize(
proto.getResolvedOrderByItemNode(), helper);
case RESOLVED_OUTPUT_COLUMN_NODE:
return ResolvedOutputColumn.deserialize(
proto.getResolvedOutputColumnNode(), helper);
case RESOLVED_WITH_ENTRY_NODE:
return ResolvedWithEntry.deserialize(
proto.getResolvedWithEntryNode(), helper);
case RESOLVED_OPTION_NODE:
return ResolvedOption.deserialize(
proto.getResolvedOptionNode(), helper);
case RESOLVED_WINDOW_PARTITIONING_NODE:
return ResolvedWindowPartitioning.deserialize(
proto.getResolvedWindowPartitioningNode(), helper);
case RESOLVED_WINDOW_ORDERING_NODE:
return ResolvedWindowOrdering.deserialize(
proto.getResolvedWindowOrderingNode(), helper);
case RESOLVED_WINDOW_FRAME_NODE:
return ResolvedWindowFrame.deserialize(
proto.getResolvedWindowFrameNode(), helper);
case RESOLVED_ANALYTIC_FUNCTION_GROUP_NODE:
return ResolvedAnalyticFunctionGroup.deserialize(
proto.getResolvedAnalyticFunctionGroupNode(), helper);
case RESOLVED_WINDOW_FRAME_EXPR_NODE:
return ResolvedWindowFrameExpr.deserialize(
proto.getResolvedWindowFrameExprNode(), helper);
case RESOLVED_DMLVALUE_NODE:
return ResolvedDMLValue.deserialize(
proto.getResolvedDmlvalueNode(), helper);
case RESOLVED_ASSERT_ROWS_MODIFIED_NODE:
return ResolvedAssertRowsModified.deserialize(
proto.getResolvedAssertRowsModifiedNode(), helper);
case RESOLVED_INSERT_ROW_NODE:
return ResolvedInsertRow.deserialize(
proto.getResolvedInsertRowNode(), helper);
case RESOLVED_UPDATE_ITEM_NODE:
return ResolvedUpdateItem.deserialize(
proto.getResolvedUpdateItemNode(), helper);
case RESOLVED_PRIVILEGE_NODE:
return ResolvedPrivilege.deserialize(
proto.getResolvedPrivilegeNode(), helper);
case RESOLVED_ARGUMENT_DEF_NODE:
return ResolvedArgumentDef.deserialize(
proto.getResolvedArgumentDefNode(), helper);
case RESOLVED_ARGUMENT_LIST_NODE:
return ResolvedArgumentList.deserialize(
proto.getResolvedArgumentListNode(), helper);
case RESOLVED_FUNCTION_ARGUMENT_NODE:
return ResolvedFunctionArgument.deserialize(
proto.getResolvedFunctionArgumentNode(), helper);
case RESOLVED_FUNCTION_SIGNATURE_HOLDER_NODE:
return ResolvedFunctionSignatureHolder.deserialize(
proto.getResolvedFunctionSignatureHolderNode(), helper);
case RESOLVED_AGGREGATE_HAVING_MODIFIER_NODE:
return ResolvedAggregateHavingModifier.deserialize(
proto.getResolvedAggregateHavingModifierNode(), helper);
case RESOLVED_COLUMN_DEFINITION_NODE:
return ResolvedColumnDefinition.deserialize(
proto.getResolvedColumnDefinitionNode(), helper);
case RESOLVED_SET_OPERATION_ITEM_NODE:
return ResolvedSetOperationItem.deserialize(
proto.getResolvedSetOperationItemNode(), helper);
case RESOLVED_INDEX_ITEM_NODE:
return ResolvedIndexItem.deserialize(
proto.getResolvedIndexItemNode(), helper);
case RESOLVED_MERGE_WHEN_NODE:
return ResolvedMergeWhen.deserialize(
proto.getResolvedMergeWhenNode(), helper);
case RESOLVED_UPDATE_ARRAY_ITEM_NODE:
return ResolvedUpdateArrayItem.deserialize(
proto.getResolvedUpdateArrayItemNode(), helper);
case RESOLVED_COLUMN_ANNOTATIONS_NODE:
return ResolvedColumnAnnotations.deserialize(
proto.getResolvedColumnAnnotationsNode(), helper);
case RESOLVED_GENERATED_COLUMN_INFO_NODE:
return ResolvedGeneratedColumnInfo.deserialize(
proto.getResolvedGeneratedColumnInfoNode(), helper);
case RESOLVED_MODEL_NODE:
return ResolvedModel.deserialize(
proto.getResolvedModelNode(), helper);
case RESOLVED_ALTER_ACTION_NODE:
return ResolvedAlterAction.deserialize(
proto.getResolvedAlterActionNode(), helper);
case RESOLVED_UNNEST_ITEM_NODE:
return ResolvedUnnestItem.deserialize(
proto.getResolvedUnnestItemNode(), helper);
case RESOLVED_REPLACE_FIELD_ITEM_NODE:
return ResolvedReplaceFieldItem.deserialize(
proto.getResolvedReplaceFieldItemNode(), helper);
case RESOLVED_CONNECTION_NODE:
return ResolvedConnection.deserialize(
proto.getResolvedConnectionNode(), helper);
case RESOLVED_EXECUTE_IMMEDIATE_ARGUMENT_NODE:
return ResolvedExecuteImmediateArgument.deserialize(
proto.getResolvedExecuteImmediateArgumentNode(), helper);
case RESOLVED_DESCRIPTOR_NODE:
return ResolvedDescriptor.deserialize(
proto.getResolvedDescriptorNode(), helper);
case RESOLVED_EXTENDED_CAST_ELEMENT_NODE:
return ResolvedExtendedCastElement.deserialize(
proto.getResolvedExtendedCastElementNode(), helper);
case RESOLVED_WITH_PARTITION_COLUMNS_NODE:
return ResolvedWithPartitionColumns.deserialize(
proto.getResolvedWithPartitionColumnsNode(), helper);
case RESOLVED_EXTENDED_CAST_NODE:
return ResolvedExtendedCast.deserialize(
proto.getResolvedExtendedCastNode(), helper);
case RESOLVED_INLINE_LAMBDA_NODE:
return ResolvedInlineLambda.deserialize(
proto.getResolvedInlineLambdaNode(), helper);
case RESOLVED_CONSTRAINT_NODE:
return ResolvedConstraint.deserialize(
proto.getResolvedConstraintNode(), helper);
case RESOLVED_PIVOT_COLUMN_NODE:
return ResolvedPivotColumn.deserialize(
proto.getResolvedPivotColumnNode(), helper);
case RESOLVED_RETURNING_CLAUSE_NODE:
return ResolvedReturningClause.deserialize(
proto.getResolvedReturningClauseNode(), helper);
case RESOLVED_UNPIVOT_ARG_NODE:
return ResolvedUnpivotArg.deserialize(
proto.getResolvedUnpivotArgNode(), helper);
case RESOLVED_FILTER_FIELD_ARG_NODE:
return ResolvedFilterFieldArg.deserialize(
proto.getResolvedFilterFieldArgNode(), helper);
case RESOLVED_TABLE_AND_COLUMN_INFO_NODE:
return ResolvedTableAndColumnInfo.deserialize(
proto.getResolvedTableAndColumnInfoNode(), helper);
case RESOLVED_COLUMN_DEFAULT_VALUE_NODE:
return ResolvedColumnDefaultValue.deserialize(
proto.getResolvedColumnDefaultValueNode(), helper);
case RESOLVED_OBJECT_UNIT_NODE:
return ResolvedObjectUnit.deserialize(
proto.getResolvedObjectUnitNode(), helper);
case RESOLVED_GRAPH_LABEL_EXPR_NODE:
return ResolvedGraphLabelExpr.deserialize(
proto.getResolvedGraphLabelExprNode(), helper);
case RESOLVED_GRAPH_ELEMENT_IDENTIFIER_NODE:
return ResolvedGraphElementIdentifier.deserialize(
proto.getResolvedGraphElementIdentifierNode(), helper);
case RESOLVED_GRAPH_ELEMENT_PROPERTY_NODE:
return ResolvedGraphElementProperty.deserialize(
proto.getResolvedGraphElementPropertyNode(), helper);
case RESOLVED_AUX_LOAD_DATA_PARTITION_FILTER_NODE:
return ResolvedAuxLoadDataPartitionFilter.deserialize(
proto.getResolvedAuxLoadDataPartitionFilterNode(), helper);
case RESOLVED_GRAPH_ELEMENT_TABLE_NODE:
return ResolvedGraphElementTable.deserialize(
proto.getResolvedGraphElementTableNode(), helper);
case RESOLVED_GRAPH_NODE_TABLE_REFERENCE_NODE:
return ResolvedGraphNodeTableReference.deserialize(
proto.getResolvedGraphNodeTableReferenceNode(), helper);
case RESOLVED_CREATE_MODEL_ALIASED_QUERY_NODE:
return ResolvedCreateModelAliasedQuery.deserialize(
proto.getResolvedCreateModelAliasedQueryNode(), helper);
case RESOLVED_GRAPH_ELEMENT_LABEL_NODE:
return ResolvedGraphElementLabel.deserialize(
proto.getResolvedGraphElementLabelNode(), helper);
case RESOLVED_GRAPH_PROPERTY_DECLARATION_NODE:
return ResolvedGraphPropertyDeclaration.deserialize(
proto.getResolvedGraphPropertyDeclarationNode(), helper);
case RESOLVED_GRAPH_PROPERTY_DEFINITION_NODE:
return ResolvedGraphPropertyDefinition.deserialize(
proto.getResolvedGraphPropertyDefinitionNode(), helper);
case RESOLVED_SEQUENCE_NODE:
return ResolvedSequence.deserialize(
proto.getResolvedSequenceNode(), helper);
case RESOLVED_GROUPING_SET_MULTI_COLUMN_NODE:
return ResolvedGroupingSetMultiColumn.deserialize(
proto.getResolvedGroupingSetMultiColumnNode(), helper);
case RESOLVED_GROUPING_SET_BASE_NODE:
return ResolvedGroupingSetBase.deserialize(
proto.getResolvedGroupingSetBaseNode(), helper);
case RESOLVED_GROUPING_CALL_NODE:
return ResolvedGroupingCall.deserialize(
proto.getResolvedGroupingCallNode(), helper);
case RESOLVED_IDENTITY_COLUMN_INFO_NODE:
return ResolvedIdentityColumnInfo.deserialize(
proto.getResolvedIdentityColumnInfoNode(), helper);
case RESOLVED_GRAPH_PATH_PATTERN_QUANTIFIER_NODE:
return ResolvedGraphPathPatternQuantifier.deserialize(
proto.getResolvedGraphPathPatternQuantifierNode(), helper);
case RESOLVED_COMPUTED_COLUMN_BASE_NODE:
return ResolvedComputedColumnBase.deserialize(
proto.getResolvedComputedColumnBaseNode(), helper);
case RESOLVED_RECURSION_DEPTH_MODIFIER_NODE:
return ResolvedRecursionDepthModifier.deserialize(
proto.getResolvedRecursionDepthModifierNode(), helper);
case RESOLVED_GRAPH_MAKE_ARRAY_VARIABLE_NODE:
return ResolvedGraphMakeArrayVariable.deserialize(
proto.getResolvedGraphMakeArrayVariableNode(), helper);
case RESOLVED_GRAPH_PATH_MODE_NODE:
return ResolvedGraphPathMode.deserialize(
proto.getResolvedGraphPathModeNode(), helper);
case RESOLVED_GRAPH_PATH_SEARCH_PREFIX_NODE:
return ResolvedGraphPathSearchPrefix.deserialize(
proto.getResolvedGraphPathSearchPrefixNode(), helper);
case RESOLVED_MATCH_RECOGNIZE_VARIABLE_DEFINITION_NODE:
return ResolvedMatchRecognizeVariableDefinition.deserialize(
proto.getResolvedMatchRecognizeVariableDefinitionNode(), helper);
case RESOLVED_MATCH_RECOGNIZE_PATTERN_EXPR_NODE:
return ResolvedMatchRecognizePatternExpr.deserialize(
proto.getResolvedMatchRecognizePatternExprNode(), helper);
case RESOLVED_SUBPIPELINE_NODE:
return ResolvedSubpipeline.deserialize(
proto.getResolvedSubpipelineNode(), helper);
case RESOLVED_LOCK_MODE_NODE:
return ResolvedLockMode.deserialize(
proto.getResolvedLockModeNode(), helper);
case RESOLVED_PIPE_IF_CASE_NODE:
return ResolvedPipeIfCase.deserialize(
proto.getResolvedPipeIfCaseNode(), helper);
case RESOLVED_OUTPUT_SCHEMA_NODE:
return ResolvedOutputSchema.deserialize(
proto.getResolvedOutputSchemaNode(), helper);
case RESOLVED_MEASURE_GROUP_NODE:
return ResolvedMeasureGroup.deserialize(
proto.getResolvedMeasureGroupNode(), helper);
case RESOLVED_ON_CONFLICT_CLAUSE_NODE:
return ResolvedOnConflictClause.deserialize(
proto.getResolvedOnConflictClauseNode(), helper);
case RESOLVED_GENERALIZED_QUERY_SUBPIPELINE_NODE:
return ResolvedGeneralizedQuerySubpipeline.deserialize(
proto.getResolvedGeneralizedQuerySubpipelineNode(), helper);
default:
throw new IllegalArgumentException("Invalid Node kind: " + proto.getNodeCase());
}
}
/**
* Serializes this node into a {@link ResolvedArgumentProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
ResolvedArgumentProto.Builder builder = ResolvedArgumentProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedNodeProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedNodeProto.Builder builder) {
builder.clear();
AnyResolvedArgumentProto.Builder childBuilder = AnyResolvedArgumentProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedArgumentNode(childBuilder.build());
}
/**
* Serializes this node into the appropriate field type proto builder
* ({@link AnyResolvedArgumentProto.Builder}) for its parent proto container type.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public abstract void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedArgumentProto.Builder builder);
/**
* Serializes this node into the given {@link ResolvedArgumentProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedArgumentProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedNodeProto parent =
(ResolvedNodeProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
}
@Override
public abstract ResolvedArgument accept(RewritingVisitor visitor);
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
}
}
public static abstract class ResolvedExpr extends ResolvedNode {
private final Type type;
private final AnnotationMap typeAnnotationMap;
ResolvedExpr(ResolvedExprProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
type = helper.deserialize(proto.getType());
typeAnnotationMap = helper.deserialize(proto.getTypeAnnotationMap());
}
ResolvedExpr(
Type type,
AnnotationMap typeAnnotationMap) {
super();
this.type = type;
this.typeAnnotationMap = typeAnnotationMap;
}
@Override
public abstract Builder toBuilder();
public static abstract class Builder extends ResolvedNode.Builder {
protected Type type = null;
protected AnnotationMap typeAnnotationMap = null;
private Builder() {}
@CanIgnoreReturnValue
public Builder setType(Type v) {
this.type = v;
return this;
}
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
this.typeAnnotationMap = v;
return this;
}
@Override
public abstract ResolvedExpr build();
@Override
protected void validate() {
super.validate();
}
}
public static ResolvedExpr deserialize(
AnyResolvedExprProto proto, AbstractDeserializationHelper helper) {
switch (proto.getNodeCase()) {
case RESOLVED_LITERAL_NODE:
return ResolvedLiteral.deserialize(
proto.getResolvedLiteralNode(), helper);
case RESOLVED_PARAMETER_NODE:
return ResolvedParameter.deserialize(
proto.getResolvedParameterNode(), helper);
case RESOLVED_EXPRESSION_COLUMN_NODE:
return ResolvedExpressionColumn.deserialize(
proto.getResolvedExpressionColumnNode(), helper);
case RESOLVED_COLUMN_REF_NODE:
return ResolvedColumnRef.deserialize(
proto.getResolvedColumnRefNode(), helper);
case RESOLVED_FUNCTION_CALL_BASE_NODE:
return ResolvedFunctionCallBase.deserialize(
proto.getResolvedFunctionCallBaseNode(), helper);
case RESOLVED_CAST_NODE:
return ResolvedCast.deserialize(
proto.getResolvedCastNode(), helper);
case RESOLVED_MAKE_STRUCT_NODE:
return ResolvedMakeStruct.deserialize(
proto.getResolvedMakeStructNode(), helper);
case RESOLVED_MAKE_PROTO_NODE:
return ResolvedMakeProto.deserialize(
proto.getResolvedMakeProtoNode(), helper);
case RESOLVED_GET_STRUCT_FIELD_NODE:
return ResolvedGetStructField.deserialize(
proto.getResolvedGetStructFieldNode(), helper);
case RESOLVED_GET_PROTO_FIELD_NODE:
return ResolvedGetProtoField.deserialize(
proto.getResolvedGetProtoFieldNode(), helper);
case RESOLVED_SUBQUERY_EXPR_NODE:
return ResolvedSubqueryExpr.deserialize(
proto.getResolvedSubqueryExprNode(), helper);
case RESOLVED_DMLDEFAULT_NODE:
return ResolvedDMLDefault.deserialize(
proto.getResolvedDmldefaultNode(), helper);
case RESOLVED_ARGUMENT_REF_NODE:
return ResolvedArgumentRef.deserialize(
proto.getResolvedArgumentRefNode(), helper);
case RESOLVED_CONSTANT_NODE:
return ResolvedConstant.deserialize(
proto.getResolvedConstantNode(), helper);
case RESOLVED_REPLACE_FIELD_NODE:
return ResolvedReplaceField.deserialize(
proto.getResolvedReplaceFieldNode(), helper);
case RESOLVED_GET_PROTO_ONEOF_NODE:
return ResolvedGetProtoOneof.deserialize(
proto.getResolvedGetProtoOneofNode(), helper);
case RESOLVED_SYSTEM_VARIABLE_NODE:
return ResolvedSystemVariable.deserialize(
proto.getResolvedSystemVariableNode(), helper);
case RESOLVED_FLATTEN_NODE:
return ResolvedFlatten.deserialize(
proto.getResolvedFlattenNode(), helper);
case RESOLVED_FLATTENED_ARG_NODE:
return ResolvedFlattenedArg.deserialize(
proto.getResolvedFlattenedArgNode(), helper);
case RESOLVED_GET_JSON_FIELD_NODE:
return ResolvedGetJsonField.deserialize(
proto.getResolvedGetJsonFieldNode(), helper);
case RESOLVED_FILTER_FIELD_NODE:
return ResolvedFilterField.deserialize(
proto.getResolvedFilterFieldNode(), helper);
case RESOLVED_WITH_EXPR_NODE:
return ResolvedWithExpr.deserialize(
proto.getResolvedWithExprNode(), helper);
case RESOLVED_CATALOG_COLUMN_REF_NODE:
return ResolvedCatalogColumnRef.deserialize(
proto.getResolvedCatalogColumnRefNode(), helper);
case RESOLVED_GRAPH_GET_ELEMENT_PROPERTY_NODE:
return ResolvedGraphGetElementProperty.deserialize(
proto.getResolvedGraphGetElementPropertyNode(), helper);
case RESOLVED_GRAPH_MAKE_ELEMENT_NODE:
return ResolvedGraphMakeElement.deserialize(
proto.getResolvedGraphMakeElementNode(), helper);
case RESOLVED_ARRAY_AGGREGATE_NODE:
return ResolvedArrayAggregate.deserialize(
proto.getResolvedArrayAggregateNode(), helper);
case RESOLVED_GRAPH_IS_LABELED_PREDICATE_NODE:
return ResolvedGraphIsLabeledPredicate.deserialize(
proto.getResolvedGraphIsLabeledPredicateNode(), helper);
default:
throw new IllegalArgumentException("Invalid Node kind: " + proto.getNodeCase());
}
}
/**
* Serializes this node into a {@link ResolvedExprProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
ResolvedExprProto.Builder builder = ResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedNodeProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedNodeProto.Builder builder) {
builder.clear();
AnyResolvedExprProto.Builder childBuilder = AnyResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedExprNode(childBuilder.build());
}
/**
* Serializes this node into the appropriate field type proto builder
* ({@link AnyResolvedExprProto.Builder}) for its parent proto container type.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public abstract void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder);
/**
* Serializes this node into the given {@link ResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedExprProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedNodeProto parent =
(ResolvedNodeProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// type is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getType() != null) {
proto.setType(
ResolvedNodes.serialize(this.getType(),
fileDescriptorSetsBuilder));
}
// typeAnnotationMap is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getTypeAnnotationMap() != null) {
proto.setTypeAnnotationMap(
ResolvedNodes.serialize(this.getTypeAnnotationMap(),
fileDescriptorSetsBuilder));
}
}
public final Type getType() {
return type;
}
public final AnnotationMap getTypeAnnotationMap() {
return typeAnnotationMap;
}
@Override
public abstract ResolvedExpr accept(RewritingVisitor visitor);
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
if (!DebugStrings.isDefaultValue(type)) {
fields.add(new DebugStringField("type", DebugStrings.toStringImpl(type)));
}
if (!DebugStrings.isDefaultValue(typeAnnotationMap)) {
fields.add(new DebugStringField("type_annotation_map", DebugStrings.toStringImpl(typeAnnotationMap)));
}
}
}
/**
* Any literal value, including NULL literals.
* There is a special-cased constructor here that gets the type from the
* Value.
*/
public static final class ResolvedLiteral extends ResolvedExpr {
private final Value value;
/**
* If true, then the literal is explicitly typed and cannot be used
* for literal coercions.
*
* This exists mainly for resolver bookkeeping and should be ignored
* by engines.
*/
private final boolean hasExplicitType;
/**
* Distinct ID of the literal, if it is a floating point value,
* within the resolved AST. When coercing from floating point
* to NUMERIC, the resolver uses the float_literal_id to find the
* original image of the literal to avoid precision loss. An ID of 0
* represents a literal without a cached image.
*/
private final long floatLiteralId;
/**
* Indicates whether ReplaceLiteralsByParameters() should leave
* this literal value in place, rather than replace it with a query
* parameter.
*/
private final boolean preserveInLiteralRemover;
ResolvedLiteral(ResolvedLiteralProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
value = helper.deserialize(proto.getValue());
hasExplicitType = proto.getHasExplicitType();
floatLiteralId = proto.getFloatLiteralId();
preserveInLiteralRemover = proto.getPreserveInLiteralRemover();
}
ResolvedLiteral(
Type type,
AnnotationMap typeAnnotationMap,
Value value,
boolean hasExplicitType,
long floatLiteralId,
boolean preserveInLiteralRemover) {
super(
type,
typeAnnotationMap);
this.value = value;
this.hasExplicitType = hasExplicitType;
this.floatLiteralId = floatLiteralId;
this.preserveInLiteralRemover = preserveInLiteralRemover;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.value = this.getValue();
builder.hasExplicitType = this.getHasExplicitType();
builder.floatLiteralId = this.getFloatLiteralId();
builder.preserveInLiteralRemover = this.getPreserveInLiteralRemover();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedExpr.Builder {
protected Value value = null;
protected boolean hasExplicitType = false;
protected long floatLiteralId = 0;
protected boolean preserveInLiteralRemover = false;
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
@CanIgnoreReturnValue
public Builder setValue(Value v) {
this.value = v;
Preconditions.checkNotNull(v, "value must not be null");
return this;
}
/**
* If true, then the literal is explicitly typed and cannot be used
* for literal coercions.
*
*
This exists mainly for resolver bookkeeping and should be ignored
* by engines.
*/ @CanIgnoreReturnValue
public Builder setHasExplicitType(boolean v) {
this.hasExplicitType = v;
return this;
}
/**
* Distinct ID of the literal, if it is a floating point value,
* within the resolved AST. When coercing from floating point
* to NUMERIC, the resolver uses the float_literal_id to find the
* original image of the literal to avoid precision loss. An ID of 0
* represents a literal without a cached image.
*/ @CanIgnoreReturnValue
public Builder setFloatLiteralId(long v) {
this.floatLiteralId = v;
return this;
}
/**
* Indicates whether ReplaceLiteralsByParameters() should leave
* this literal value in place, rather than replace it with a query
* parameter.
*/ @CanIgnoreReturnValue
public Builder setPreserveInLiteralRemover(boolean v) {
this.preserveInLiteralRemover = v;
return this;
}
@Override
public final ResolvedLiteral build() {
validate();
return new ResolvedLiteral(
type,
typeAnnotationMap,
value,
hasExplicitType,
floatLiteralId,
preserveInLiteralRemover);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
value != null, "value must be set");
}
}
public static final ResolvedLiteral deserialize(
ResolvedLiteralProto proto, AbstractDeserializationHelper helper) {
return new ResolvedLiteral(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_LITERAL;
}
@Override
public final String nodeKindString() {
return "Literal";
}
/**
* Serializes this node into a {@link AnyResolvedExprProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedExprProto.Builder builder =
AnyResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder) {
builder.clear();
ResolvedLiteralProto.Builder childBuilder = ResolvedLiteralProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedLiteralNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedLiteralProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedLiteralProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedExprProto parent =
(ResolvedExprProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// value is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getValue() != null) {
proto.setValue(
ResolvedNodes.serialize(this.getValue(),
fileDescriptorSetsBuilder));
}
// hasExplicitType is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setHasExplicitType(this.getHasExplicitType());
// floatLiteralId is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setFloatLiteralId(this.getFloatLiteralId());
// preserveInLiteralRemover is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setPreserveInLiteralRemover(this.getPreserveInLiteralRemover());
}
public final Value getValue() {
return value;
}
/**
* If true, then the literal is explicitly typed and cannot be used
* for literal coercions.
*
*
This exists mainly for resolver bookkeeping and should be ignored
* by engines.
*/
public final boolean getHasExplicitType() {
return hasExplicitType;
}
/**
* Distinct ID of the literal, if it is a floating point value,
* within the resolved AST. When coercing from floating point
* to NUMERIC, the resolver uses the float_literal_id to find the
* original image of the literal to avoid precision loss. An ID of 0
* represents a literal without a cached image.
*/
public final long getFloatLiteralId() {
return floatLiteralId;
}
/**
* Indicates whether ReplaceLiteralsByParameters() should leave
* this literal value in place, rather than replace it with a query
* parameter.
*/
public final boolean getPreserveInLiteralRemover() {
return preserveInLiteralRemover;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedLiteral accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
{
fields.add(new DebugStringField("value", DebugStrings.toStringImpl(value)));
}
if (!DebugStrings.isDefaultValue(hasExplicitType)) {
fields.add(new DebugStringField("has_explicit_type", DebugStrings.toStringImpl(hasExplicitType)));
}
if (!DebugStrings.isDefaultValue(floatLiteralId)) {
fields.add(new DebugStringField("float_literal_id", DebugStrings.toStringImpl(floatLiteralId)));
}
if (!DebugStrings.isDefaultValue(preserveInLiteralRemover)) {
fields.add(new DebugStringField("preserve_in_literal_remover", DebugStrings.toStringImpl(preserveInLiteralRemover)));
}
}
}
public static final class ResolvedParameter extends ResolvedExpr {
/**
* If non-empty, the name of the parameter.
*
* A ResolvedParameter will have either a name or a position but not
* both.
*/
private final String name;
/**
* If non-zero, the 1-based position of the positional parameter.
*
*
A ResolvedParameter will have either a name or a position but not
* both.
*/
private final long position;
/**
* If true, then the parameter has no specified type.
*
*
This exists mainly for resolver bookkeeping and should be ignored
* by engines.
*/
private final boolean isUntyped;
ResolvedParameter(ResolvedParameterProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
name = proto.getName();
position = proto.getPosition();
isUntyped = proto.getIsUntyped();
}
ResolvedParameter(
Type type,
AnnotationMap typeAnnotationMap,
String name,
long position,
boolean isUntyped) {
super(
type,
typeAnnotationMap);
this.name = name;
this.position = position;
this.isUntyped = isUntyped;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.name = this.getName();
builder.position = this.getPosition();
builder.isUntyped = this.getIsUntyped();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedExpr.Builder {
protected String name = null;
protected long position = 0;
protected boolean isUntyped = false;
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
/**
* If non-empty, the name of the parameter.
*
*
A ResolvedParameter will have either a name or a position but not
* both.
*/ @CanIgnoreReturnValue
public Builder setName(String v) {
this.name = v;
return this;
}
/**
* If non-zero, the 1-based position of the positional parameter.
*
*
A ResolvedParameter will have either a name or a position but not
* both.
*/ @CanIgnoreReturnValue
public Builder setPosition(long v) {
this.position = v;
return this;
}
/**
* If true, then the parameter has no specified type.
*
*
This exists mainly for resolver bookkeeping and should be ignored
* by engines.
*/ @CanIgnoreReturnValue
public Builder setIsUntyped(boolean v) {
this.isUntyped = v;
return this;
}
@Override
public final ResolvedParameter build() {
validate();
return new ResolvedParameter(
type,
typeAnnotationMap,
name,
position,
isUntyped);
}
@Override
protected void validate() {
super.validate();
}
}
public static final ResolvedParameter deserialize(
ResolvedParameterProto proto, AbstractDeserializationHelper helper) {
return new ResolvedParameter(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_PARAMETER;
}
@Override
public final String nodeKindString() {
return "Parameter";
}
/**
* Serializes this node into a {@link AnyResolvedExprProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedExprProto.Builder builder =
AnyResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder) {
builder.clear();
ResolvedParameterProto.Builder childBuilder = ResolvedParameterProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedParameterNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedParameterProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedParameterProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedExprProto parent =
(ResolvedExprProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// name is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setName(this.getName());
// position is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setPosition(this.getPosition());
// isUntyped is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setIsUntyped(this.getIsUntyped());
}
/**
* If non-empty, the name of the parameter.
*
*
A ResolvedParameter will have either a name or a position but not
* both.
*/
public final String getName() {
return name;
}
/**
* If non-zero, the 1-based position of the positional parameter.
*
*
A ResolvedParameter will have either a name or a position but not
* both.
*/
public final long getPosition() {
return position;
}
/**
* If true, then the parameter has no specified type.
*
*
This exists mainly for resolver bookkeeping and should be ignored
* by engines.
*/
public final boolean getIsUntyped() {
return isUntyped;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedParameter accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
if (!DebugStrings.isDefaultValue(name)) {
fields.add(new DebugStringField("name", DebugStrings.toStringImpl(name)));
}
if (!DebugStrings.isDefaultValue(position)) {
fields.add(new DebugStringField("position", DebugStrings.toStringImpl(position)));
}
if (!DebugStrings.isDefaultValue(isUntyped)) {
fields.add(new DebugStringField("is_untyped", DebugStrings.toStringImpl(isUntyped)));
}
}
}
/**
* This represents a column when analyzing a standalone expression.
* This is only used when the analyzer was called using AnalyzeExpression.
* Expression column names and types come from
* AnalyzerOptions::AddExpressionColumn.
* will always be in lowercase.
*/
public static final class ResolvedExpressionColumn extends ResolvedExpr {
private final String name;
ResolvedExpressionColumn(ResolvedExpressionColumnProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
name = proto.getName();
}
ResolvedExpressionColumn(
Type type,
AnnotationMap typeAnnotationMap,
String name) {
super(
type,
typeAnnotationMap);
this.name = name;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.name = this.getName();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedExpr.Builder {
protected String name = null;
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
@CanIgnoreReturnValue
public Builder setName(String v) {
this.name = v;
Preconditions.checkNotNull(v, "name must not be null");
return this;
}
@Override
public final ResolvedExpressionColumn build() {
validate();
return new ResolvedExpressionColumn(
type,
typeAnnotationMap,
name);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
name != null, "name must be set");
}
}
public static final ResolvedExpressionColumn deserialize(
ResolvedExpressionColumnProto proto, AbstractDeserializationHelper helper) {
return new ResolvedExpressionColumn(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_EXPRESSION_COLUMN;
}
@Override
public final String nodeKindString() {
return "ExpressionColumn";
}
/**
* Serializes this node into a {@link AnyResolvedExprProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedExprProto.Builder builder =
AnyResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder) {
builder.clear();
ResolvedExpressionColumnProto.Builder childBuilder = ResolvedExpressionColumnProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedExpressionColumnNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedExpressionColumnProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedExpressionColumnProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedExprProto parent =
(ResolvedExprProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// name is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setName(this.getName());
}
public final String getName() {
return name;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedExpressionColumn accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
{
fields.add(new DebugStringField("name", DebugStrings.toStringImpl(name)));
}
}
}
/**
* An expression referencing a Column from the Catalog. This is used to
* represent a column reference in an expression inside a DDL statement.
* The DDL statement will normally define the Table context, and the
* referenced Column should be a Column of that Table.
*/
public static final class ResolvedCatalogColumnRef extends ResolvedExpr {
private final Column column;
ResolvedCatalogColumnRef(ResolvedCatalogColumnRefProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
column = helper.deserialize(proto.getColumn());
}
ResolvedCatalogColumnRef(
Type type,
AnnotationMap typeAnnotationMap,
Column column) {
super(
type,
typeAnnotationMap);
this.column = column;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.column = this.getColumn();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedExpr.Builder {
protected Column column = null;
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
@CanIgnoreReturnValue
public Builder setColumn(Column v) {
this.column = v;
Preconditions.checkNotNull(v, "column must not be null");
return this;
}
@Override
public final ResolvedCatalogColumnRef build() {
validate();
return new ResolvedCatalogColumnRef(
type,
typeAnnotationMap,
column);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
column != null, "column must be set");
}
}
public static final ResolvedCatalogColumnRef deserialize(
ResolvedCatalogColumnRefProto proto, AbstractDeserializationHelper helper) {
return new ResolvedCatalogColumnRef(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_CATALOG_COLUMN_REF;
}
@Override
public final String nodeKindString() {
return "CatalogColumnRef";
}
/**
* Serializes this node into a {@link AnyResolvedExprProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedExprProto.Builder builder =
AnyResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder) {
builder.clear();
ResolvedCatalogColumnRefProto.Builder childBuilder = ResolvedCatalogColumnRefProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedCatalogColumnRefNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedCatalogColumnRefProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedCatalogColumnRefProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedExprProto parent =
(ResolvedExprProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// column is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getColumn() != null) {
proto.setColumn(
ResolvedNodes.serialize(this.getColumn(),
fileDescriptorSetsBuilder));
}
}
public final Column getColumn() {
return column;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedCatalogColumnRef accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
{
fields.add(new DebugStringField("column", DebugStrings.toStringImpl(column)));
}
}
}
/**
* An expression referencing the value of some column visible in the
* current Scan node.
*
* If is false, this must be a column visible in the Scan
* containing this expression, either because it was produced inside that
* Scan or it is on the of some child of this Scan.
*
* If is true, this references a column from outside a
* subquery that is visible as a correlated column inside.
* The column referenced here must show up on the parameters list for the
* subquery. See ResolvedSubqueryExpr.
*/
public static final class ResolvedColumnRef extends ResolvedExpr {
private final ResolvedColumn column;
private final boolean isCorrelated;
ResolvedColumnRef(ResolvedColumnRefProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
column = helper.deserialize(proto.getColumn());
isCorrelated = proto.getIsCorrelated();
}
ResolvedColumnRef(
Type type,
AnnotationMap typeAnnotationMap,
ResolvedColumn column,
boolean isCorrelated) {
super(
type,
typeAnnotationMap);
this.column = column;
this.isCorrelated = isCorrelated;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.column = this.getColumn();
builder.isCorrelated = this.getIsCorrelated();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedExpr.Builder {
protected ResolvedColumn column = null;
protected Boolean isCorrelated = null;
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
@CanIgnoreReturnValue
public Builder setColumn(ResolvedColumn v) {
this.column = v;
Preconditions.checkNotNull(v, "column must not be null");
return this;
}
@CanIgnoreReturnValue
public Builder setIsCorrelated(boolean v) {
this.isCorrelated = v;
return this;
}
@Override
public final ResolvedColumnRef build() {
validate();
return new ResolvedColumnRef(
type,
typeAnnotationMap,
column,
isCorrelated);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
column != null, "column must be set");
}
}
public static final ResolvedColumnRef deserialize(
ResolvedColumnRefProto proto, AbstractDeserializationHelper helper) {
return new ResolvedColumnRef(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_COLUMN_REF;
}
@Override
public final String nodeKindString() {
return "ColumnRef";
}
/**
* Serializes this node into a {@link AnyResolvedExprProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedExprProto.Builder builder =
AnyResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder) {
builder.clear();
ResolvedColumnRefProto.Builder childBuilder = ResolvedColumnRefProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedColumnRefNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedColumnRefProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedColumnRefProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedExprProto parent =
(ResolvedExprProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// column is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getColumn() != null) {
proto.setColumn(
ResolvedNodes.serialize(this.getColumn(),
fileDescriptorSetsBuilder));
}
// isCorrelated is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setIsCorrelated(this.getIsCorrelated());
}
public final ResolvedColumn getColumn() {
return column;
}
public final boolean getIsCorrelated() {
return isCorrelated;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedColumnRef accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
{
fields.add(new DebugStringField("column", DebugStrings.toStringImpl(column)));
}
if (!DebugStrings.isDefaultValue(isCorrelated)) {
fields.add(new DebugStringField("is_correlated", DebugStrings.toStringImpl(isCorrelated)));
}
}
}
/**
* A list of ResolvedColumnRef expression references that will be batched
* together in rollup/cube when being expanded to grouping sets. For
* example, ROLLUP((a, b), c) will be expanded to 3 grouping sets [(a, b, c),
* (a, b), ()], (a, b) is a multi-column.
*
* Duplicated columns are not allowed in the ResolvedGroupingSetMultiColumn
* as they are equivalent to deduplicated columns. column_list must have
* at least one element inside.
*/
public static final class ResolvedGroupingSetMultiColumn extends ResolvedArgument {
private final ImmutableList columnList;
ResolvedGroupingSetMultiColumn(ResolvedGroupingSetMultiColumnProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
ImmutableList.Builder columnListBuilder =
ImmutableList.builder();
for (ResolvedColumnRefProto element : proto.getColumnListList()) {
columnListBuilder
.add(ResolvedColumnRef.deserialize(element, helper));
}
columnList = columnListBuilder.build();
}
ResolvedGroupingSetMultiColumn(
ImmutableList columnList) {
super();
this.columnList = columnList;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.columnList = this.getColumnList();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedArgument.Builder {
protected ImmutableList columnList = null;
private Builder() {}
@CanIgnoreReturnValue
public Builder setColumnList(List v) {
this.columnList = ImmutableList.copyOf(v);
return this;
}
@Override
public final ResolvedGroupingSetMultiColumn build() {
validate();
return new ResolvedGroupingSetMultiColumn(
columnList);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
columnList != null, "columnList must be set");
}
}
public static final ResolvedGroupingSetMultiColumn deserialize(
ResolvedGroupingSetMultiColumnProto proto, AbstractDeserializationHelper helper) {
return new ResolvedGroupingSetMultiColumn(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_GROUPING_SET_MULTI_COLUMN;
}
@Override
public final String nodeKindString() {
return "GroupingSetMultiColumn";
}
/**
* Serializes this node into a {@link AnyResolvedArgumentProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedArgumentProto.Builder builder =
AnyResolvedArgumentProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedArgumentProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedArgumentProto.Builder builder) {
builder.clear();
ResolvedGroupingSetMultiColumnProto.Builder childBuilder = ResolvedGroupingSetMultiColumnProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedGroupingSetMultiColumnNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedGroupingSetMultiColumnProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedGroupingSetMultiColumnProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedArgumentProto parent =
(ResolvedArgumentProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// columnList is a collection of AST nodes. Serialize each of them.
ImmutableList columnLists =
this.getColumnList();
for (ResolvedColumnRef element : columnLists) {
ResolvedColumnRefProto.Builder columnListBuilder =
ResolvedColumnRefProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, columnListBuilder);
proto.addColumnList(columnListBuilder.build());
}
}
public final ImmutableList getColumnList() {
return columnList;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedGroupingSetMultiColumn accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
visitor.descend(columnList);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
if (!columnList.isEmpty()) {
fields.add(new DebugStringField("column_list", columnList));
}
}
}
/**
* A reference to a named constant.
*/
public static final class ResolvedConstant extends ResolvedExpr {
/**
* The matching Constant from the Catalog.
*/
private final Constant constant;
ResolvedConstant(ResolvedConstantProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
constant = helper.deserialize(proto.getConstant());
}
ResolvedConstant(
Type type,
AnnotationMap typeAnnotationMap,
Constant constant) {
super(
type,
typeAnnotationMap);
this.constant = constant;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.constant = this.getConstant();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedExpr.Builder {
protected Constant constant = null;
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
/**
* The matching Constant from the Catalog.
*/ @CanIgnoreReturnValue
public Builder setConstant(Constant v) {
this.constant = v;
Preconditions.checkNotNull(v, "constant must not be null");
return this;
}
@Override
public final ResolvedConstant build() {
validate();
return new ResolvedConstant(
type,
typeAnnotationMap,
constant);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
constant != null, "constant must be set");
}
}
public static final ResolvedConstant deserialize(
ResolvedConstantProto proto, AbstractDeserializationHelper helper) {
return new ResolvedConstant(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_CONSTANT;
}
@Override
public final String nodeKindString() {
return "Constant";
}
/**
* Serializes this node into a {@link AnyResolvedExprProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedExprProto.Builder builder =
AnyResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder) {
builder.clear();
ResolvedConstantProto.Builder childBuilder = ResolvedConstantProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedConstantNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedConstantProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedConstantProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedExprProto parent =
(ResolvedExprProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// constant is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getConstant() != null) {
proto.setConstant(
ResolvedNodes.serialize(this.getConstant(),
fileDescriptorSetsBuilder));
}
}
/**
* The matching Constant from the Catalog.
*/
public final Constant getConstant() {
return constant;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedConstant accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
DebugStrings.collectDebugStringFields(this, fields);
}
public String getNameForDebugString() {
return DebugStrings.getNameForDebugString(this);
}
}
/**
* A reference to a system variable.
*/
public static final class ResolvedSystemVariable extends ResolvedExpr {
/**
* Path to system variable.
*/
private final ImmutableList namePath;
ResolvedSystemVariable(ResolvedSystemVariableProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
namePath =
ImmutableList.copyOf(proto.getNamePathList());
}
ResolvedSystemVariable(
Type type,
AnnotationMap typeAnnotationMap,
ImmutableList namePath) {
super(
type,
typeAnnotationMap);
this.namePath = namePath;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.namePath = this.getNamePath();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedExpr.Builder {
protected ImmutableList namePath = null;
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
/**
* Path to system variable.
*/ @CanIgnoreReturnValue
public Builder setNamePath(List v) {
this.namePath = ImmutableList.copyOf(v);
return this;
}
@Override
public final ResolvedSystemVariable build() {
validate();
return new ResolvedSystemVariable(
type,
typeAnnotationMap,
namePath);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
namePath != null, "namePath must be set");
}
}
public static final ResolvedSystemVariable deserialize(
ResolvedSystemVariableProto proto, AbstractDeserializationHelper helper) {
return new ResolvedSystemVariable(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_SYSTEM_VARIABLE;
}
@Override
public final String nodeKindString() {
return "SystemVariable";
}
/**
* Serializes this node into a {@link AnyResolvedExprProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedExprProto.Builder builder =
AnyResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder) {
builder.clear();
ResolvedSystemVariableProto.Builder childBuilder = ResolvedSystemVariableProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedSystemVariableNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedSystemVariableProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedSystemVariableProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedExprProto parent =
(ResolvedExprProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// namePath is a collection of leaf types that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.addAllNamePath(this.getNamePath());
}
/**
* Path to system variable.
*/
public final ImmutableList getNamePath() {
return namePath;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedSystemVariable accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
DebugStrings.collectDebugStringFields(this, fields);
}
public String getNameForDebugString() {
return DebugStrings.getNameForDebugString(this);
}
}
/**
* A lambda expression, used inline as a function argument.
* This represents both the definition of the lambda and the resolution of
* its templated signature and body for this function call.
* Currently can only be used as an argument of a function.
*
* defines the argument types and names for the lambda, and
* creates new ResolvedColumns which can be used to reference the arguments
* inside .
*
* The return type of the lambda function is the type of
.
*
* In addition to the , the body of a lambda expression can
* reference columns visible to the scope of the function call for which this
* lambda is provided as an argument. Columns in this scope accessed by the
* body are stored in .
*
* For example, the following query
* SELECT ARRAY_FILTER([1,2,3], e -> e = key) FROM KeyValue;
* would have a lambda with ['key'] and
* ['e'].
*
*
is the body expression of the lambda. The expression can only
* reference columns in and .
*/
public static final class ResolvedInlineLambda extends ResolvedArgument {
private final ImmutableList argumentList;
private final ImmutableList parameterList;
private final ResolvedExpr body;
ResolvedInlineLambda(ResolvedInlineLambdaProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
ImmutableList.Builder argumentListBuilder =
ImmutableList.builder();
for (ResolvedColumnProto element : proto.getArgumentListList()) {
argumentListBuilder.add(helper.deserialize(element));
}
argumentList = argumentListBuilder.build();
ImmutableList.Builder parameterListBuilder =
ImmutableList.builder();
for (ResolvedColumnRefProto element : proto.getParameterListList()) {
parameterListBuilder
.add(ResolvedColumnRef.deserialize(element, helper));
}
parameterList = parameterListBuilder.build();
if (proto.hasBody()) {
body =
ResolvedExpr.deserialize(proto.getBody(), helper);
} else {
body = null;
}
}
ResolvedInlineLambda(
ImmutableList argumentList,
ImmutableList parameterList,
ResolvedExpr body) {
super();
this.argumentList = argumentList;
this.parameterList = parameterList;
this.body = body;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.argumentList = this.getArgumentList();
builder.parameterList = this.getParameterList();
builder.body = this.getBody();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedArgument.Builder {
protected ImmutableList argumentList = null;
protected ImmutableList parameterList = null;
protected ResolvedExpr body = null;
private Builder() {}
@CanIgnoreReturnValue
public Builder setArgumentList(List v) {
this.argumentList = ImmutableList.copyOf(v);
return this;
}
@CanIgnoreReturnValue
public Builder setParameterList(List v) {
this.parameterList = ImmutableList.copyOf(v);
return this;
}
@CanIgnoreReturnValue
public Builder setBody(ResolvedExpr v) {
this.body = v;
Preconditions.checkNotNull(v, "body must not be null");
return this;
}
@Override
public final ResolvedInlineLambda build() {
validate();
return new ResolvedInlineLambda(
argumentList,
parameterList,
body);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
argumentList != null, "argumentList must be set");
Preconditions.checkArgument(
parameterList != null, "parameterList must be set");
Preconditions.checkArgument(
body != null, "body must be set");
}
}
public static final ResolvedInlineLambda deserialize(
ResolvedInlineLambdaProto proto, AbstractDeserializationHelper helper) {
return new ResolvedInlineLambda(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_INLINE_LAMBDA;
}
@Override
public final String nodeKindString() {
return "InlineLambda";
}
/**
* Serializes this node into a {@link AnyResolvedArgumentProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedArgumentProto.Builder builder =
AnyResolvedArgumentProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedArgumentProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedArgumentProto.Builder builder) {
builder.clear();
ResolvedInlineLambdaProto.Builder childBuilder = ResolvedInlineLambdaProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedInlineLambdaNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedInlineLambdaProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedInlineLambdaProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedArgumentProto parent =
(ResolvedArgumentProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// argumentList is a collection of leaf types that require a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
ImmutableList argumentLists =
this.getArgumentList();
for (ResolvedColumn element : argumentLists) {
proto.addArgumentList(ResolvedNodes.serialize(element, fileDescriptorSetsBuilder));
}
// parameterList is a collection of AST nodes. Serialize each of them.
ImmutableList parameterLists =
this.getParameterList();
for (ResolvedColumnRef element : parameterLists) {
ResolvedColumnRefProto.Builder parameterListBuilder =
ResolvedColumnRefProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, parameterListBuilder);
proto.addParameterList(parameterListBuilder.build());
}
// body is an AST node. Call its serialization chain.
if (this.getBody() != null) {
AnyResolvedExprProto.Builder bodyBuilder =
AnyResolvedExprProto.newBuilder();
this.getBody().serialize(
fileDescriptorSetsBuilder, bodyBuilder);
proto.setBody(
bodyBuilder.build());
}
}
public final ImmutableList getArgumentList() {
return argumentList;
}
public final ImmutableList getParameterList() {
return parameterList;
}
public final ResolvedExpr getBody() {
return body;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedInlineLambda accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
visitor.descend(parameterList);
visitor.descend(body);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
{
fields.add(new DebugStringField("argument_list", DebugStrings.toStringImpl(argumentList)));
}
if (!parameterList.isEmpty()) {
fields.add(new DebugStringField("parameter_list", parameterList));
}
if (body != null) {
fields.add(new DebugStringField("body", body));
}
}
}
/**
* Represents a sequence as a function argument
*/
public static final class ResolvedSequence extends ResolvedArgument {
private final Sequence sequence;
ResolvedSequence(ResolvedSequenceProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
sequence = helper.deserialize(proto.getSequence());
}
ResolvedSequence(
Sequence sequence) {
super();
this.sequence = sequence;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.sequence = this.getSequence();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedArgument.Builder {
protected Sequence sequence = null;
private Builder() {}
@CanIgnoreReturnValue
public Builder setSequence(Sequence v) {
this.sequence = v;
Preconditions.checkNotNull(v, "sequence must not be null");
return this;
}
@Override
public final ResolvedSequence build() {
validate();
return new ResolvedSequence(
sequence);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
sequence != null, "sequence must be set");
}
}
public static final ResolvedSequence deserialize(
ResolvedSequenceProto proto, AbstractDeserializationHelper helper) {
return new ResolvedSequence(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_SEQUENCE;
}
@Override
public final String nodeKindString() {
return "Sequence";
}
/**
* Serializes this node into a {@link AnyResolvedArgumentProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedArgumentProto.Builder builder =
AnyResolvedArgumentProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedArgumentProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedArgumentProto.Builder builder) {
builder.clear();
ResolvedSequenceProto.Builder childBuilder = ResolvedSequenceProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedSequenceNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedSequenceProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedSequenceProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedArgumentProto parent =
(ResolvedArgumentProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// sequence is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getSequence() != null) {
proto.setSequence(
ResolvedNodes.serialize(this.getSequence(),
fileDescriptorSetsBuilder));
}
}
public final Sequence getSequence() {
return sequence;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedSequence accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
{
fields.add(new DebugStringField("sequence", DebugStrings.toStringImpl(sequence)));
}
}
}
/**
* An argument to the FILTER_FIELDS() function which specifies a sign to show
* inclusion/exclusion status and a field path to include or exclude.
*/
public static final class ResolvedFilterFieldArg extends ResolvedArgument {
/**
* True if we want to include this proto path in the resulting proto
* (though we may still remove paths below it).
* If False, we will remove this path (but may still include paths
* below it).
*/
private final boolean include;
/**
* A vector of FieldDescriptors that denotes the path to a proto
* field that will be include or exclude.
*/
private final ImmutableList fieldDescriptorPath;
ResolvedFilterFieldArg(ResolvedFilterFieldArgProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
include = proto.getInclude();
ImmutableList.Builder fieldDescriptorPathBuilder =
ImmutableList.builder();
for (FieldDescriptorRefProto element : proto.getFieldDescriptorPathList()) {
fieldDescriptorPathBuilder.add(helper.deserialize(element));
}
fieldDescriptorPath = fieldDescriptorPathBuilder.build();
}
ResolvedFilterFieldArg(
boolean include,
ImmutableList fieldDescriptorPath) {
super();
this.include = include;
this.fieldDescriptorPath = fieldDescriptorPath;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.include = this.getInclude();
builder.fieldDescriptorPath = this.getFieldDescriptorPath();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedArgument.Builder {
protected Boolean include = null;
protected ImmutableList fieldDescriptorPath = null;
private Builder() {}
/**
* True if we want to include this proto path in the resulting proto
* (though we may still remove paths below it).
* If False, we will remove this path (but may still include paths
* below it).
*/ @CanIgnoreReturnValue
public Builder setInclude(boolean v) {
this.include = v;
return this;
}
/**
* A vector of FieldDescriptors that denotes the path to a proto
* field that will be include or exclude.
*/ @CanIgnoreReturnValue
public Builder setFieldDescriptorPath(List v) {
this.fieldDescriptorPath = ImmutableList.copyOf(v);
return this;
}
@Override
public final ResolvedFilterFieldArg build() {
validate();
return new ResolvedFilterFieldArg(
include,
fieldDescriptorPath);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
include != null, "include must be set");
Preconditions.checkArgument(
fieldDescriptorPath != null, "fieldDescriptorPath must be set");
}
}
public static final ResolvedFilterFieldArg deserialize(
ResolvedFilterFieldArgProto proto, AbstractDeserializationHelper helper) {
return new ResolvedFilterFieldArg(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_FILTER_FIELD_ARG;
}
@Override
public final String nodeKindString() {
return "FilterFieldArg";
}
/**
* Serializes this node into a {@link AnyResolvedArgumentProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedArgumentProto.Builder builder =
AnyResolvedArgumentProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedArgumentProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedArgumentProto.Builder builder) {
builder.clear();
ResolvedFilterFieldArgProto.Builder childBuilder = ResolvedFilterFieldArgProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedFilterFieldArgNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedFilterFieldArgProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedFilterFieldArgProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedArgumentProto parent =
(ResolvedArgumentProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// include is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setInclude(this.getInclude());
// fieldDescriptorPath is a collection of leaf types that require a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
ImmutableList fieldDescriptorPaths =
this.getFieldDescriptorPath();
for (ZetaSQLFieldDescriptor element : fieldDescriptorPaths) {
proto.addFieldDescriptorPath(ResolvedNodes.serialize(element, fileDescriptorSetsBuilder));
}
}
/**
* True if we want to include this proto path in the resulting proto
* (though we may still remove paths below it).
* If False, we will remove this path (but may still include paths
* below it).
*/
public final boolean getInclude() {
return include;
}
/**
* A vector of FieldDescriptors that denotes the path to a proto
* field that will be include or exclude.
*/
public final ImmutableList getFieldDescriptorPath() {
return fieldDescriptorPath;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedFilterFieldArg accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
{
fields.add(new DebugStringField("include", DebugStrings.toStringImpl(include)));
}
{
fields.add(new DebugStringField("field_descriptor_path", DebugStrings.toStringPeriodSeparatedForFieldDescriptors(fieldDescriptorPath)));
}
}
}
/**
* Represents a call to the FILTER_FIELDS() function. This function can be
* used to modify a proto, prune fields and output the resulting proto. The
* SQL syntax for this function is
* FILTER_FIELDS(, ).
*
* must have proto type. contains a sign ('+' or
* '-') and a field path starting from the proto.
*
* For example:
* FILTER_FIELDS(proto, +field1, -field1.field2)
* means the resulting proto only contains field1.* except field1.field2.*.
*
*
Field paths are evaluated and processed in order,
* ```
* IF filter_field_arg_list[0].include:
* CLEAR all fields
* FOR filter_field_arg IN filter_field_arg_list:
* IF filter_field_arg.include:
* UNCLEAR filter_field_arg.field_descriptor_path (and all children)
* ELSE:
* CLEAR filter_field_arg.field_descriptor_path (and all children)
* ```
*
*
The order of field_field args have following constraints:
* 1. There must be at least one filter_field arg.
* 2. Args for ancestor fields must precede descendants.
* 3. Each arg must have opposite `include` compared to the last preceding
* ancestor field.
*
*
See (broken link) for more detail.
*/
public static final class ResolvedFilterField extends ResolvedExpr {
/**
* The proto to modify.
*/
private final ResolvedExpr expr;
/**
* The list of field paths to include or exclude. The path starts
* from the proto type of .
*/
private final ImmutableList filterFieldArgList;
/**
* If true, will reset cleared required fields into a
* default value.
*/
private final boolean resetClearedRequiredFields;
ResolvedFilterField(ResolvedFilterFieldProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
if (proto.hasExpr()) {
expr =
ResolvedExpr.deserialize(proto.getExpr(), helper);
} else {
expr = null;
}
ImmutableList.Builder filterFieldArgListBuilder =
ImmutableList.builder();
for (ResolvedFilterFieldArgProto element : proto.getFilterFieldArgListList()) {
filterFieldArgListBuilder
.add(ResolvedFilterFieldArg.deserialize(element, helper));
}
filterFieldArgList = filterFieldArgListBuilder.build();
resetClearedRequiredFields = proto.getResetClearedRequiredFields();
}
ResolvedFilterField(
Type type,
AnnotationMap typeAnnotationMap,
ResolvedExpr expr,
ImmutableList filterFieldArgList,
boolean resetClearedRequiredFields) {
super(
type,
typeAnnotationMap);
this.expr = expr;
this.filterFieldArgList = filterFieldArgList;
this.resetClearedRequiredFields = resetClearedRequiredFields;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.expr = this.getExpr();
builder.filterFieldArgList = this.getFilterFieldArgList();
builder.resetClearedRequiredFields = this.getResetClearedRequiredFields();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedExpr.Builder {
protected ResolvedExpr expr = null;
protected ImmutableList filterFieldArgList = null;
protected Boolean resetClearedRequiredFields = null;
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
/**
* The proto to modify.
*/ @CanIgnoreReturnValue
public Builder setExpr(ResolvedExpr v) {
this.expr = v;
Preconditions.checkNotNull(v, "expr must not be null");
return this;
}
/**
* The list of field paths to include or exclude. The path starts
* from the proto type of .
*/ @CanIgnoreReturnValue
public Builder setFilterFieldArgList(List v) {
this.filterFieldArgList = ImmutableList.copyOf(v);
return this;
}
/**
* If true, will reset cleared required fields into a
* default value.
*/ @CanIgnoreReturnValue
public Builder setResetClearedRequiredFields(boolean v) {
this.resetClearedRequiredFields = v;
return this;
}
@Override
public final ResolvedFilterField build() {
validate();
return new ResolvedFilterField(
type,
typeAnnotationMap,
expr,
filterFieldArgList,
resetClearedRequiredFields);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
expr != null, "expr must be set");
Preconditions.checkArgument(
filterFieldArgList != null, "filterFieldArgList must be set");
Preconditions.checkArgument(
resetClearedRequiredFields != null, "resetClearedRequiredFields must be set");
}
}
public static final ResolvedFilterField deserialize(
ResolvedFilterFieldProto proto, AbstractDeserializationHelper helper) {
return new ResolvedFilterField(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_FILTER_FIELD;
}
@Override
public final String nodeKindString() {
return "FilterField";
}
/**
* Serializes this node into a {@link AnyResolvedExprProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedExprProto.Builder builder =
AnyResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder) {
builder.clear();
ResolvedFilterFieldProto.Builder childBuilder = ResolvedFilterFieldProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedFilterFieldNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedFilterFieldProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedFilterFieldProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedExprProto parent =
(ResolvedExprProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// expr is an AST node. Call its serialization chain.
if (this.getExpr() != null) {
AnyResolvedExprProto.Builder exprBuilder =
AnyResolvedExprProto.newBuilder();
this.getExpr().serialize(
fileDescriptorSetsBuilder, exprBuilder);
proto.setExpr(
exprBuilder.build());
}
// filterFieldArgList is a collection of AST nodes. Serialize each of them.
ImmutableList filterFieldArgLists =
this.getFilterFieldArgList();
for (ResolvedFilterFieldArg element : filterFieldArgLists) {
ResolvedFilterFieldArgProto.Builder filterFieldArgListBuilder =
ResolvedFilterFieldArgProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, filterFieldArgListBuilder);
proto.addFilterFieldArgList(filterFieldArgListBuilder.build());
}
// resetClearedRequiredFields is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setResetClearedRequiredFields(this.getResetClearedRequiredFields());
}
/**
* The proto to modify.
*/
public final ResolvedExpr getExpr() {
return expr;
}
/**
* The list of field paths to include or exclude. The path starts
* from the proto type of .
*/
public final ImmutableList getFilterFieldArgList() {
return filterFieldArgList;
}
/**
* If true, will reset cleared required fields into a
* default value.
*/
public final boolean getResetClearedRequiredFields() {
return resetClearedRequiredFields;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedFilterField accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
visitor.descend(expr);
visitor.descend(filterFieldArgList);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
if (expr != null) {
fields.add(new DebugStringField("expr", expr));
}
if (!filterFieldArgList.isEmpty()) {
fields.add(new DebugStringField("filter_field_arg_list", filterFieldArgList));
}
{
fields.add(new DebugStringField("reset_cleared_required_fields", DebugStrings.toStringImpl(resetClearedRequiredFields)));
}
}
}
/**
* Common base class for scalar and aggregate function calls.
*
* contains a list of arguments of type ResolvedExpr.
*
* contains an alternative list of generic arguments.
* This is used for function calls that accept non-expression arguments (i.e.
* arguments that aren't part of the type system, like lambdas).
*
* If all arguments of this function call are ResolvedExprs,
* is used. If any of the argument is not a ResolvedExpr,
* will be used. Only one of or
* can be non-empty.
*
* (only set when FEATURE_V_1_3_COLLATION_SUPPORT is
* enabled) is the operation collation to use.
* (broken link) lists the functions affected by
* collation, where this can show up.
* is a vector for future extension. For now, functions
* could have at most one element in the .
*/
public static abstract class ResolvedFunctionCallBase extends ResolvedExpr {
/**
* The matching Function from the Catalog.
*/
private final Function function;
/**
* The concrete FunctionSignature reflecting the matching Function
* signature and the function's resolved input .
* The function has the mode AGGREGATE iff it is an aggregate
* function, in which case this node must be either
* ResolvedAggregateFunctionCall or ResolvedAnalyticFunctionCall.
*/
private final FunctionSignature signature;
private final ImmutableList argumentList;
private final ImmutableList genericArgumentList;
/**
* If error_mode=SAFE_ERROR_MODE, and if this function call returns a
* semantic error (based on input data, not transient server
* problems), return NULL instead of an error. This is used for
* functions called using SAFE, as in SAFE.FUNCTION(...).
*/
private final ErrorMode errorMode;
/**
* Function call hints.
*/
private final ImmutableList hintList;
private final ImmutableList collationList;
ResolvedFunctionCallBase(ResolvedFunctionCallBaseProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
function = helper.deserialize(proto.getFunction());
signature = helper.deserialize(proto.getSignature());
ImmutableList.Builder argumentListBuilder =
ImmutableList.builder();
for (AnyResolvedExprProto element : proto.getArgumentListList()) {
argumentListBuilder
.add(ResolvedExpr.deserialize(element, helper));
}
argumentList = argumentListBuilder.build();
ImmutableList.Builder genericArgumentListBuilder =
ImmutableList.builder();
for (ResolvedFunctionArgumentProto element : proto.getGenericArgumentListList()) {
genericArgumentListBuilder
.add(ResolvedFunctionArgument.deserialize(element, helper));
}
genericArgumentList = genericArgumentListBuilder.build();
errorMode = proto.getErrorMode();
ImmutableList.Builder hintListBuilder =
ImmutableList.builder();
for (ResolvedOptionProto element : proto.getHintListList()) {
hintListBuilder
.add(ResolvedOption.deserialize(element, helper));
}
hintList = hintListBuilder.build();
ImmutableList.Builder collationListBuilder =
ImmutableList.builder();
for (ResolvedCollationProto element : proto.getCollationListList()) {
collationListBuilder.add(helper.deserialize(element));
}
collationList = collationListBuilder.build();
}
ResolvedFunctionCallBase(
Type type,
AnnotationMap typeAnnotationMap,
Function function,
FunctionSignature signature,
ImmutableList argumentList,
ImmutableList genericArgumentList,
ErrorMode errorMode,
ImmutableList hintList,
ImmutableList collationList) {
super(
type,
typeAnnotationMap);
this.function = function;
this.signature = signature;
this.argumentList = argumentList;
this.genericArgumentList = genericArgumentList;
this.errorMode = errorMode;
this.hintList = hintList;
this.collationList = collationList;
}
@Override
public abstract Builder toBuilder();
public static abstract class Builder extends ResolvedExpr.Builder {
protected Function function = null;
protected FunctionSignature signature = null;
protected ImmutableList argumentList = null;
protected ImmutableList genericArgumentList = ImmutableList.of();
protected ErrorMode errorMode = null;
protected ImmutableList hintList = ImmutableList.of();
protected ImmutableList collationList = ImmutableList.of();
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
/**
* The matching Function from the Catalog.
*/ @CanIgnoreReturnValue
public Builder setFunction(Function v) {
this.function = v;
Preconditions.checkNotNull(v, "function must not be null");
return this;
}
/**
* The concrete FunctionSignature reflecting the matching Function
* signature and the function's resolved input .
* The function has the mode AGGREGATE iff it is an aggregate
* function, in which case this node must be either
* ResolvedAggregateFunctionCall or ResolvedAnalyticFunctionCall.
*/ @CanIgnoreReturnValue
public Builder setSignature(FunctionSignature v) {
this.signature = v;
return this;
}
@CanIgnoreReturnValue
public Builder setArgumentList(List v) {
this.argumentList = ImmutableList.copyOf(v);
return this;
}
@CanIgnoreReturnValue
public Builder setGenericArgumentList(List v) {
this.genericArgumentList = ImmutableList.copyOf(v);
return this;
}
/**
* If error_mode=SAFE_ERROR_MODE, and if this function call returns a
* semantic error (based on input data, not transient server
* problems), return NULL instead of an error. This is used for
* functions called using SAFE, as in SAFE.FUNCTION(...).
*/ @CanIgnoreReturnValue
public Builder setErrorMode(ErrorMode v) {
this.errorMode = v;
return this;
}
/**
* Function call hints.
*/ @CanIgnoreReturnValue
public Builder setHintList(List v) {
this.hintList = ImmutableList.copyOf(v);
return this;
}
@CanIgnoreReturnValue
public Builder setCollationList(List v) {
this.collationList = ImmutableList.copyOf(v);
return this;
}
@Override
public abstract ResolvedFunctionCallBase build();
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
function != null, "function must be set");
}
}
public static ResolvedFunctionCallBase deserialize(
AnyResolvedFunctionCallBaseProto proto, AbstractDeserializationHelper helper) {
switch (proto.getNodeCase()) {
case RESOLVED_FUNCTION_CALL_NODE:
return ResolvedFunctionCall.deserialize(
proto.getResolvedFunctionCallNode(), helper);
case RESOLVED_NON_SCALAR_FUNCTION_CALL_BASE_NODE:
return ResolvedNonScalarFunctionCallBase.deserialize(
proto.getResolvedNonScalarFunctionCallBaseNode(), helper);
default:
throw new IllegalArgumentException("Invalid Node kind: " + proto.getNodeCase());
}
}
/**
* Serializes this node into a {@link ResolvedFunctionCallBaseProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
ResolvedFunctionCallBaseProto.Builder builder = ResolvedFunctionCallBaseProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder) {
builder.clear();
AnyResolvedFunctionCallBaseProto.Builder childBuilder = AnyResolvedFunctionCallBaseProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedFunctionCallBaseNode(childBuilder.build());
}
/**
* Serializes this node into the appropriate field type proto builder
* ({@link AnyResolvedFunctionCallBaseProto.Builder}) for its parent proto container type.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public abstract void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedFunctionCallBaseProto.Builder builder);
/**
* Serializes this node into the given {@link ResolvedFunctionCallBaseProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedFunctionCallBaseProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedExprProto parent =
(ResolvedExprProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// function is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getFunction() != null) {
proto.setFunction(
ResolvedNodes.serialize(this.getFunction(),
fileDescriptorSetsBuilder));
}
// signature is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getSignature() != null) {
proto.setSignature(
ResolvedNodes.serialize(this.getSignature(),
fileDescriptorSetsBuilder));
}
// argumentList is a collection of AST nodes. Serialize each of them.
ImmutableList argumentLists =
this.getArgumentList();
for (ResolvedExpr element : argumentLists) {
AnyResolvedExprProto.Builder argumentListBuilder =
AnyResolvedExprProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, argumentListBuilder);
proto.addArgumentList(argumentListBuilder.build());
}
// genericArgumentList is a collection of AST nodes. Serialize each of them.
ImmutableList genericArgumentLists =
this.getGenericArgumentList();
for (ResolvedFunctionArgument element : genericArgumentLists) {
ResolvedFunctionArgumentProto.Builder genericArgumentListBuilder =
ResolvedFunctionArgumentProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, genericArgumentListBuilder);
proto.addGenericArgumentList(genericArgumentListBuilder.build());
}
// errorMode is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setErrorMode(this.getErrorMode());
// hintList is a collection of AST nodes. Serialize each of them.
ImmutableList hintLists =
this.getHintList();
for (ResolvedOption element : hintLists) {
ResolvedOptionProto.Builder hintListBuilder =
ResolvedOptionProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, hintListBuilder);
proto.addHintList(hintListBuilder.build());
}
// collationList is a collection of leaf types that require a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
ImmutableList collationLists =
this.getCollationList();
for (ResolvedCollation element : collationLists) {
proto.addCollationList(ResolvedNodes.serialize(element, fileDescriptorSetsBuilder));
}
}
/**
* The matching Function from the Catalog.
*/
public final Function getFunction() {
return function;
}
/**
* The concrete FunctionSignature reflecting the matching Function
* signature and the function's resolved input .
* The function has the mode AGGREGATE iff it is an aggregate
* function, in which case this node must be either
* ResolvedAggregateFunctionCall or ResolvedAnalyticFunctionCall.
*/
public final FunctionSignature getSignature() {
return signature;
}
public final ImmutableList getArgumentList() {
return argumentList;
}
public final ImmutableList getGenericArgumentList() {
return genericArgumentList;
}
/**
* If error_mode=SAFE_ERROR_MODE, and if this function call returns a
* semantic error (based on input data, not transient server
* problems), return NULL instead of an error. This is used for
* functions called using SAFE, as in SAFE.FUNCTION(...).
*/
public final ErrorMode getErrorMode() {
return errorMode;
}
/**
* Function call hints.
*/
public final ImmutableList getHintList() {
return hintList;
}
public final ImmutableList getCollationList() {
return collationList;
}
@Override
public abstract ResolvedFunctionCallBase accept(RewritingVisitor visitor);
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
visitor.descend(argumentList);
visitor.descend(genericArgumentList);
visitor.descend(hintList);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
DebugStrings.collectDebugStringFields(this, fields);
}
public String getNameForDebugString() {
return DebugStrings.getNameForDebugString(this);
}
}
/**
* A regular function call. The signature will always have mode SCALAR.
* Most scalar expressions show up as FunctionCalls using builtin signatures.
*/
public static final class ResolvedFunctionCall extends ResolvedFunctionCallBase {
/**
* This contains optional custom information about a particular
* function call.
*
* If some Function subclass requires computing additional
* information at resolving time, that extra information can be
* stored as a subclass of ResolvedFunctionCallInfo here.
* For example, TemplatedSQLFunction stores the resolved template
* body here as a TemplatedSQLFunctionCall.
*
*
This field is ignorable because for most types of function calls,
* there is no extra information to consider besides the arguments
* and other fields from ResolvedFunctionCallBase.
*/
private final ResolvedFunctionCallInfo functionCallInfo;
ResolvedFunctionCall(ResolvedFunctionCallProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
functionCallInfo = helper.deserialize(proto.getFunctionCallInfo());
}
ResolvedFunctionCall(
Type type,
AnnotationMap typeAnnotationMap,
Function function,
FunctionSignature signature,
ImmutableList argumentList,
ImmutableList genericArgumentList,
ErrorMode errorMode,
ImmutableList hintList,
ImmutableList collationList,
ResolvedFunctionCallInfo functionCallInfo) {
super(
type,
typeAnnotationMap,
function,
signature,
argumentList,
genericArgumentList,
errorMode,
hintList,
collationList);
this.functionCallInfo = functionCallInfo;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.function = this.getFunction();
builder.signature = this.getSignature();
builder.argumentList = this.getArgumentList();
builder.genericArgumentList = this.getGenericArgumentList();
builder.errorMode = this.getErrorMode();
builder.hintList = this.getHintList();
builder.collationList = this.getCollationList();
builder.functionCallInfo = this.getFunctionCallInfo();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedFunctionCallBase.Builder {
protected ResolvedFunctionCallInfo functionCallInfo = new ResolvedFunctionCallInfo();
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setFunction(Function v) {
super.setFunction(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setSignature(FunctionSignature v) {
super.setSignature(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setArgumentList(List v) {
super.setArgumentList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setGenericArgumentList(List v) {
super.setGenericArgumentList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setErrorMode(ErrorMode v) {
super.setErrorMode(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setHintList(List v) {
super.setHintList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setCollationList(List v) {
super.setCollationList(v);
return this;
}
/**
* This contains optional custom information about a particular
* function call.
*
* If some Function subclass requires computing additional
* information at resolving time, that extra information can be
* stored as a subclass of ResolvedFunctionCallInfo here.
* For example, TemplatedSQLFunction stores the resolved template
* body here as a TemplatedSQLFunctionCall.
*
*
This field is ignorable because for most types of function calls,
* there is no extra information to consider besides the arguments
* and other fields from ResolvedFunctionCallBase.
*/ @CanIgnoreReturnValue
public Builder setFunctionCallInfo(ResolvedFunctionCallInfo v) {
this.functionCallInfo = v;
return this;
}
@Override
public final ResolvedFunctionCall build() {
validate();
return new ResolvedFunctionCall(
type,
typeAnnotationMap,
function,
signature,
argumentList,
genericArgumentList,
errorMode,
hintList,
collationList,
functionCallInfo);
}
@Override
protected void validate() {
super.validate();
}
}
public static final ResolvedFunctionCall deserialize(
ResolvedFunctionCallProto proto, AbstractDeserializationHelper helper) {
return new ResolvedFunctionCall(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_FUNCTION_CALL;
}
@Override
public final String nodeKindString() {
return "FunctionCall";
}
/**
* Serializes this node into a {@link AnyResolvedFunctionCallBaseProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedFunctionCallBaseProto.Builder builder =
AnyResolvedFunctionCallBaseProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedFunctionCallBaseProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedFunctionCallBaseProto.Builder builder) {
builder.clear();
ResolvedFunctionCallProto.Builder childBuilder = ResolvedFunctionCallProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedFunctionCallNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedFunctionCallProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedFunctionCallProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedFunctionCallBaseProto parent =
(ResolvedFunctionCallBaseProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// functionCallInfo is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getFunctionCallInfo() != null) {
proto.setFunctionCallInfo(
ResolvedNodes.serialize(this.getFunctionCallInfo(),
fileDescriptorSetsBuilder));
}
}
/**
* This contains optional custom information about a particular
* function call.
*
*
If some Function subclass requires computing additional
* information at resolving time, that extra information can be
* stored as a subclass of ResolvedFunctionCallInfo here.
* For example, TemplatedSQLFunction stores the resolved template
* body here as a TemplatedSQLFunctionCall.
*
*
This field is ignorable because for most types of function calls,
* there is no extra information to consider besides the arguments
* and other fields from ResolvedFunctionCallBase.
*/
public final ResolvedFunctionCallInfo getFunctionCallInfo() {
return functionCallInfo;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedFunctionCall accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
if (!DebugStrings.isDefaultValue(functionCallInfo)) {
fields.add(new DebugStringField("function_call_info", DebugStrings.toStringImpl(functionCallInfo)));
}
}
}
/**
* Common base class for analytic and aggregate function calls.
*/
public static abstract class ResolvedNonScalarFunctionCallBase extends ResolvedFunctionCallBase {
/**
* Apply DISTINCT to the stream of input values before calling
* function.
*/
private final boolean distinct;
/**
* Apply IGNORE/RESPECT NULLS filtering to the stream of input
* values.
*/
private final NullHandlingModifier nullHandlingModifier;
/**
* Holds a table subquery defined in WITH GROUP ROWS(...) that is
* evaluated over the input rows of a ResolvedAggregateScan
* corresponding to the current group. The function itself is
* evaluated over the rows returned from the subquery.
*
* The subquery should refer to a special TVF GROUP_ROWS(), which
* resolves as ResolvedGroupRowsScan. The subquery will be run for
* each group produced by ResolvedAggregateScan.
*
*
GROUP_ROWS() produces a row for each source row in the
* ResolvedAggregateScan's input that matches current group.
*
*
The subquery cannot reference any ResolvedColumns from the outer
* query except what comes in via ,
* and GROUP_ROWS().
*
* The subquery can return more than one column, and these columns
* can be referenced by the function.
*
*
The subquery can be correlated. In this case the
* gives the set of ResolvedColumns
* from outside the subquery that are used inside. The subuery cannot
* refer to correlated columns that are used as aggregation input in
* the immediate outer query. The same rules apply to
* as in ResolvedSubqueryExpr.
*/
private final ResolvedScan withGroupRowsSubquery;
/**
* Correlated parameters to
*/
private final ImmutableList withGroupRowsParameterList;
ResolvedNonScalarFunctionCallBase(ResolvedNonScalarFunctionCallBaseProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
distinct = proto.getDistinct();
nullHandlingModifier = proto.getNullHandlingModifier();
if (proto.hasWithGroupRowsSubquery()) {
withGroupRowsSubquery =
ResolvedScan.deserialize(proto.getWithGroupRowsSubquery(), helper);
} else {
withGroupRowsSubquery = null;
}
ImmutableList.Builder withGroupRowsParameterListBuilder =
ImmutableList.builder();
for (ResolvedColumnRefProto element : proto.getWithGroupRowsParameterListList()) {
withGroupRowsParameterListBuilder
.add(ResolvedColumnRef.deserialize(element, helper));
}
withGroupRowsParameterList = withGroupRowsParameterListBuilder.build();
}
ResolvedNonScalarFunctionCallBase(
Type type,
AnnotationMap typeAnnotationMap,
Function function,
FunctionSignature signature,
ImmutableList argumentList,
ImmutableList genericArgumentList,
ErrorMode errorMode,
ImmutableList hintList,
ImmutableList collationList,
boolean distinct,
NullHandlingModifier nullHandlingModifier,
ResolvedScan withGroupRowsSubquery,
ImmutableList withGroupRowsParameterList) {
super(
type,
typeAnnotationMap,
function,
signature,
argumentList,
genericArgumentList,
errorMode,
hintList,
collationList);
this.distinct = distinct;
this.nullHandlingModifier = nullHandlingModifier;
this.withGroupRowsSubquery = withGroupRowsSubquery;
this.withGroupRowsParameterList = withGroupRowsParameterList;
}
@Override
public abstract Builder toBuilder();
public static abstract class Builder extends ResolvedFunctionCallBase.Builder {
protected Boolean distinct = null;
protected NullHandlingModifier nullHandlingModifier = null;
protected ResolvedScan withGroupRowsSubquery = null;
protected ImmutableList withGroupRowsParameterList = ImmutableList.of();
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setFunction(Function v) {
super.setFunction(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setSignature(FunctionSignature v) {
super.setSignature(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setArgumentList(List v) {
super.setArgumentList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setGenericArgumentList(List v) {
super.setGenericArgumentList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setErrorMode(ErrorMode v) {
super.setErrorMode(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setHintList(List v) {
super.setHintList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setCollationList(List v) {
super.setCollationList(v);
return this;
}
/**
* Apply DISTINCT to the stream of input values before calling
* function.
*/ @CanIgnoreReturnValue
public Builder setDistinct(boolean v) {
this.distinct = v;
return this;
}
/**
* Apply IGNORE/RESPECT NULLS filtering to the stream of input
* values.
*/ @CanIgnoreReturnValue
public Builder setNullHandlingModifier(NullHandlingModifier v) {
this.nullHandlingModifier = v;
return this;
}
/**
* Holds a table subquery defined in WITH GROUP ROWS(...) that is
* evaluated over the input rows of a ResolvedAggregateScan
* corresponding to the current group. The function itself is
* evaluated over the rows returned from the subquery.
*
* The subquery should refer to a special TVF GROUP_ROWS(), which
* resolves as ResolvedGroupRowsScan. The subquery will be run for
* each group produced by ResolvedAggregateScan.
*
*
GROUP_ROWS() produces a row for each source row in the
* ResolvedAggregateScan's input that matches current group.
*
*
The subquery cannot reference any ResolvedColumns from the outer
* query except what comes in via ,
* and GROUP_ROWS().
*
* The subquery can return more than one column, and these columns
* can be referenced by the function.
*
*
The subquery can be correlated. In this case the
* gives the set of ResolvedColumns
* from outside the subquery that are used inside. The subuery cannot
* refer to correlated columns that are used as aggregation input in
* the immediate outer query. The same rules apply to
* as in ResolvedSubqueryExpr.
*/ @CanIgnoreReturnValue
public Builder setWithGroupRowsSubquery(ResolvedScan v) {
this.withGroupRowsSubquery = v;
return this;
}
/**
* Correlated parameters to
*/ @CanIgnoreReturnValue
public Builder setWithGroupRowsParameterList(List v) {
this.withGroupRowsParameterList = ImmutableList.copyOf(v);
return this;
}
@Override
public abstract ResolvedNonScalarFunctionCallBase build();
@Override
protected void validate() {
super.validate();
}
}
public static ResolvedNonScalarFunctionCallBase deserialize(
AnyResolvedNonScalarFunctionCallBaseProto proto, AbstractDeserializationHelper helper) {
switch (proto.getNodeCase()) {
case RESOLVED_AGGREGATE_FUNCTION_CALL_NODE:
return ResolvedAggregateFunctionCall.deserialize(
proto.getResolvedAggregateFunctionCallNode(), helper);
case RESOLVED_ANALYTIC_FUNCTION_CALL_NODE:
return ResolvedAnalyticFunctionCall.deserialize(
proto.getResolvedAnalyticFunctionCallNode(), helper);
default:
throw new IllegalArgumentException("Invalid Node kind: " + proto.getNodeCase());
}
}
/**
* Serializes this node into a {@link ResolvedNonScalarFunctionCallBaseProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
ResolvedNonScalarFunctionCallBaseProto.Builder builder = ResolvedNonScalarFunctionCallBaseProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedFunctionCallBaseProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedFunctionCallBaseProto.Builder builder) {
builder.clear();
AnyResolvedNonScalarFunctionCallBaseProto.Builder childBuilder = AnyResolvedNonScalarFunctionCallBaseProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedNonScalarFunctionCallBaseNode(childBuilder.build());
}
/**
* Serializes this node into the appropriate field type proto builder
* ({@link AnyResolvedNonScalarFunctionCallBaseProto.Builder}) for its parent proto container type.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public abstract void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedNonScalarFunctionCallBaseProto.Builder builder);
/**
* Serializes this node into the given {@link ResolvedNonScalarFunctionCallBaseProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedNonScalarFunctionCallBaseProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedFunctionCallBaseProto parent =
(ResolvedFunctionCallBaseProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// distinct is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setDistinct(this.getDistinct());
// nullHandlingModifier is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setNullHandlingModifier(this.getNullHandlingModifier());
// withGroupRowsSubquery is an AST node. Call its serialization chain.
if (this.getWithGroupRowsSubquery() != null) {
AnyResolvedScanProto.Builder withGroupRowsSubqueryBuilder =
AnyResolvedScanProto.newBuilder();
this.getWithGroupRowsSubquery().serialize(
fileDescriptorSetsBuilder, withGroupRowsSubqueryBuilder);
proto.setWithGroupRowsSubquery(
withGroupRowsSubqueryBuilder.build());
}
// withGroupRowsParameterList is a collection of AST nodes. Serialize each of them.
ImmutableList withGroupRowsParameterLists =
this.getWithGroupRowsParameterList();
for (ResolvedColumnRef element : withGroupRowsParameterLists) {
ResolvedColumnRefProto.Builder withGroupRowsParameterListBuilder =
ResolvedColumnRefProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, withGroupRowsParameterListBuilder);
proto.addWithGroupRowsParameterList(withGroupRowsParameterListBuilder.build());
}
}
/**
* Apply DISTINCT to the stream of input values before calling
* function.
*/
public final boolean getDistinct() {
return distinct;
}
/**
* Apply IGNORE/RESPECT NULLS filtering to the stream of input
* values.
*/
public final NullHandlingModifier getNullHandlingModifier() {
return nullHandlingModifier;
}
/**
* Holds a table subquery defined in WITH GROUP ROWS(...) that is
* evaluated over the input rows of a ResolvedAggregateScan
* corresponding to the current group. The function itself is
* evaluated over the rows returned from the subquery.
*
* The subquery should refer to a special TVF GROUP_ROWS(), which
* resolves as ResolvedGroupRowsScan. The subquery will be run for
* each group produced by ResolvedAggregateScan.
*
*
GROUP_ROWS() produces a row for each source row in the
* ResolvedAggregateScan's input that matches current group.
*
*
The subquery cannot reference any ResolvedColumns from the outer
* query except what comes in via ,
* and GROUP_ROWS().
*
* The subquery can return more than one column, and these columns
* can be referenced by the function.
*
*
The subquery can be correlated. In this case the
* gives the set of ResolvedColumns
* from outside the subquery that are used inside. The subuery cannot
* refer to correlated columns that are used as aggregation input in
* the immediate outer query. The same rules apply to
* as in ResolvedSubqueryExpr.
*/
public final ResolvedScan getWithGroupRowsSubquery() {
return withGroupRowsSubquery;
}
/**
* Correlated parameters to
*/
public final ImmutableList getWithGroupRowsParameterList() {
return withGroupRowsParameterList;
}
@Override
public abstract ResolvedNonScalarFunctionCallBase accept(RewritingVisitor visitor);
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
visitor.descend(withGroupRowsSubquery);
visitor.descend(withGroupRowsParameterList);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
if (!DebugStrings.isDefaultValue(distinct)) {
fields.add(new DebugStringField("distinct", DebugStrings.toStringImpl(distinct)));
}
if (!DebugStrings.isDefaultValue(nullHandlingModifier)) {
fields.add(new DebugStringField("null_handling_modifier", DebugStrings.toStringImpl(nullHandlingModifier)));
}
if (withGroupRowsSubquery != null) {
fields.add(new DebugStringField("with_group_rows_subquery", withGroupRowsSubquery));
}
if (!withGroupRowsParameterList.isEmpty()) {
fields.add(new DebugStringField("with_group_rows_parameter_list", withGroupRowsParameterList));
}
}
}
/**
* An aggregate function call. The signature always has mode AGGREGATE.
*
* FEATURE_V_1_4_MULTILEVEL_AGGREGATION enables multi-level aggregate
* expressions (e.g. 'SUM(AVG(1 + X) GROUP BY key)' ). The GROUP BY modifier
* within an aggregate function body indicates the presence of a multi-level
* aggregate expression.
*
*
`group_by_aggregate_list` can only be present if `group_by_list` is
* present. `group_by_list` and `group_by_aggregate_list` are mutually
* exclusive with `having_modifier`.
*
*
If `group_by_list` is empty, then standard column visibility rules apply
* (i.e. columns supplied by input scan to the enclosing AggregateScan are
* visible to argument expressions and aggregate function modifiers, as are
* correlated columns).
*
*
If `group_by_list` is non-empty, the initial aggregation is applied first,
* computing the aggregate and grouping columns in `group_by_aggregate_list`
* `group_by_list`. Only these computed columns (plus correlated columns)
* are visible to argument expressions and aggregate function modifiers
* (e.g. DISTINCT, IGNORE / RESPECT NULLS, LIMIT, ORDER BY). These
* modifiers are applied on the output rows from the initial aggregation,
* as input to the final aggregation.
*/
public static final class ResolvedAggregateFunctionCall extends ResolvedNonScalarFunctionCallBase {
/**
* Apply HAVING MAX/MIN filtering to the stream of input values.
*/
private final ResolvedAggregateHavingModifier havingModifier;
/**
* Apply ordering to the stream of input values before calling
* function.
*/
private final ImmutableList orderByItemList;
private final ResolvedExpr limit;
/**
* This contains optional custom information about a particular
* function call. Functions may introduce subclasses of this class to
* add custom information as needed on a per-function basis.
*
* This field is ignorable because for most types of function calls,
* there is no extra information to consider besides the arguments
* and other fields from ResolvedFunctionCallBase. However, for
* example, the TemplateSQLFunction in
* zetasql/public/templated_sql_function.h defines the
* TemplatedSQLFunctionCall subclass which includes the
* fully-resolved function body in context of the actual concrete
* types of the arguments provided to the function call.
*/
private final ResolvedFunctionCallInfo functionCallInfo;
/**
* Group the stream of input values by columns in this list, and
* compute the aggregates defined in `group_by_aggregate_list`.
* Used only for multi-level aggregation, when
* FEATURE_V_1_4_MULTILEVEL_AGGREGATION is enabled.
*/
private final ImmutableList groupByList;
/**
* Aggregate columns to compute over the grouping keys defined in
* `group_by_list`. Used only for multi-level aggregation, when
* FEATURE_V_1_4_MULTILEVEL_AGGREGATION is enabled.
*/
private final ImmutableList groupByAggregateList;
ResolvedAggregateFunctionCall(ResolvedAggregateFunctionCallProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
if (proto.hasHavingModifier()) {
havingModifier =
ResolvedAggregateHavingModifier.deserialize(proto.getHavingModifier(), helper);
} else {
havingModifier = null;
}
ImmutableList.Builder orderByItemListBuilder =
ImmutableList.builder();
for (ResolvedOrderByItemProto element : proto.getOrderByItemListList()) {
orderByItemListBuilder
.add(ResolvedOrderByItem.deserialize(element, helper));
}
orderByItemList = orderByItemListBuilder.build();
if (proto.hasLimit()) {
limit =
ResolvedExpr.deserialize(proto.getLimit(), helper);
} else {
limit = null;
}
functionCallInfo = helper.deserialize(proto.getFunctionCallInfo());
ImmutableList.Builder groupByListBuilder =
ImmutableList.builder();
for (ResolvedComputedColumnProto element : proto.getGroupByListList()) {
groupByListBuilder
.add(ResolvedComputedColumn.deserialize(element, helper));
}
groupByList = groupByListBuilder.build();
ImmutableList.Builder groupByAggregateListBuilder =
ImmutableList.builder();
for (AnyResolvedComputedColumnBaseProto element : proto.getGroupByAggregateListList()) {
groupByAggregateListBuilder
.add(ResolvedComputedColumnBase.deserialize(element, helper));
}
groupByAggregateList = groupByAggregateListBuilder.build();
}
ResolvedAggregateFunctionCall(
Type type,
AnnotationMap typeAnnotationMap,
Function function,
FunctionSignature signature,
ImmutableList argumentList,
ImmutableList genericArgumentList,
ErrorMode errorMode,
ImmutableList hintList,
ImmutableList collationList,
boolean distinct,
NullHandlingModifier nullHandlingModifier,
ResolvedScan withGroupRowsSubquery,
ImmutableList withGroupRowsParameterList,
ResolvedAggregateHavingModifier havingModifier,
ImmutableList orderByItemList,
ResolvedExpr limit,
ResolvedFunctionCallInfo functionCallInfo,
ImmutableList groupByList,
ImmutableList groupByAggregateList) {
super(
type,
typeAnnotationMap,
function,
signature,
argumentList,
genericArgumentList,
errorMode,
hintList,
collationList,
distinct,
nullHandlingModifier,
withGroupRowsSubquery,
withGroupRowsParameterList);
this.havingModifier = havingModifier;
this.orderByItemList = orderByItemList;
this.limit = limit;
this.functionCallInfo = functionCallInfo;
this.groupByList = groupByList;
this.groupByAggregateList = groupByAggregateList;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.function = this.getFunction();
builder.signature = this.getSignature();
builder.argumentList = this.getArgumentList();
builder.genericArgumentList = this.getGenericArgumentList();
builder.errorMode = this.getErrorMode();
builder.hintList = this.getHintList();
builder.collationList = this.getCollationList();
builder.distinct = this.getDistinct();
builder.nullHandlingModifier = this.getNullHandlingModifier();
builder.withGroupRowsSubquery = this.getWithGroupRowsSubquery();
builder.withGroupRowsParameterList = this.getWithGroupRowsParameterList();
builder.havingModifier = this.getHavingModifier();
builder.orderByItemList = this.getOrderByItemList();
builder.limit = this.getLimit();
builder.functionCallInfo = this.getFunctionCallInfo();
builder.groupByList = this.getGroupByList();
builder.groupByAggregateList = this.getGroupByAggregateList();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedNonScalarFunctionCallBase.Builder {
protected ResolvedAggregateHavingModifier havingModifier = null;
protected ImmutableList orderByItemList = null;
protected ResolvedExpr limit = null;
protected ResolvedFunctionCallInfo functionCallInfo = new ResolvedFunctionCallInfo();
protected ImmutableList groupByList = ImmutableList.of();
protected ImmutableList groupByAggregateList = ImmutableList.of();
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setFunction(Function v) {
super.setFunction(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setSignature(FunctionSignature v) {
super.setSignature(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setArgumentList(List v) {
super.setArgumentList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setGenericArgumentList(List v) {
super.setGenericArgumentList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setErrorMode(ErrorMode v) {
super.setErrorMode(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setHintList(List v) {
super.setHintList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setCollationList(List v) {
super.setCollationList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setDistinct(boolean v) {
super.setDistinct(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setNullHandlingModifier(NullHandlingModifier v) {
super.setNullHandlingModifier(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setWithGroupRowsSubquery(ResolvedScan v) {
super.setWithGroupRowsSubquery(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setWithGroupRowsParameterList(List v) {
super.setWithGroupRowsParameterList(v);
return this;
}
/**
* Apply HAVING MAX/MIN filtering to the stream of input values.
*/ @CanIgnoreReturnValue
public Builder setHavingModifier(ResolvedAggregateHavingModifier v) {
this.havingModifier = v;
return this;
}
/**
* Apply ordering to the stream of input values before calling
* function.
*/ @CanIgnoreReturnValue
public Builder setOrderByItemList(List v) {
this.orderByItemList = ImmutableList.copyOf(v);
return this;
}
@CanIgnoreReturnValue
public Builder setLimit(ResolvedExpr v) {
this.limit = v;
return this;
}
/**
* This contains optional custom information about a particular
* function call. Functions may introduce subclasses of this class to
* add custom information as needed on a per-function basis.
*
* This field is ignorable because for most types of function calls,
* there is no extra information to consider besides the arguments
* and other fields from ResolvedFunctionCallBase. However, for
* example, the TemplateSQLFunction in
* zetasql/public/templated_sql_function.h defines the
* TemplatedSQLFunctionCall subclass which includes the
* fully-resolved function body in context of the actual concrete
* types of the arguments provided to the function call.
*/ @CanIgnoreReturnValue
public Builder setFunctionCallInfo(ResolvedFunctionCallInfo v) {
this.functionCallInfo = v;
return this;
}
/**
* Group the stream of input values by columns in this list, and
* compute the aggregates defined in `group_by_aggregate_list`.
* Used only for multi-level aggregation, when
* FEATURE_V_1_4_MULTILEVEL_AGGREGATION is enabled.
*/ @CanIgnoreReturnValue
public Builder setGroupByList(List v) {
this.groupByList = ImmutableList.copyOf(v);
return this;
}
/**
* Aggregate columns to compute over the grouping keys defined in
* `group_by_list`. Used only for multi-level aggregation, when
* FEATURE_V_1_4_MULTILEVEL_AGGREGATION is enabled.
*/ @CanIgnoreReturnValue
public Builder setGroupByAggregateList(List v) {
this.groupByAggregateList = ImmutableList.copyOf(v);
return this;
}
@Override
public final ResolvedAggregateFunctionCall build() {
validate();
return new ResolvedAggregateFunctionCall(
type,
typeAnnotationMap,
function,
signature,
argumentList,
genericArgumentList,
errorMode,
hintList,
collationList,
distinct,
nullHandlingModifier,
withGroupRowsSubquery,
withGroupRowsParameterList,
havingModifier,
orderByItemList,
limit,
functionCallInfo,
groupByList,
groupByAggregateList);
}
@Override
protected void validate() {
super.validate();
}
}
public static final ResolvedAggregateFunctionCall deserialize(
ResolvedAggregateFunctionCallProto proto, AbstractDeserializationHelper helper) {
return new ResolvedAggregateFunctionCall(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_AGGREGATE_FUNCTION_CALL;
}
@Override
public final String nodeKindString() {
return "AggregateFunctionCall";
}
/**
* Serializes this node into a {@link AnyResolvedNonScalarFunctionCallBaseProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedNonScalarFunctionCallBaseProto.Builder builder =
AnyResolvedNonScalarFunctionCallBaseProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedNonScalarFunctionCallBaseProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedNonScalarFunctionCallBaseProto.Builder builder) {
builder.clear();
ResolvedAggregateFunctionCallProto.Builder childBuilder = ResolvedAggregateFunctionCallProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedAggregateFunctionCallNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedAggregateFunctionCallProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedAggregateFunctionCallProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedNonScalarFunctionCallBaseProto parent =
(ResolvedNonScalarFunctionCallBaseProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// havingModifier is an AST node. Call its serialization chain.
if (this.getHavingModifier() != null) {
ResolvedAggregateHavingModifierProto.Builder havingModifierBuilder =
ResolvedAggregateHavingModifierProto.newBuilder();
this.getHavingModifier().serialize(
fileDescriptorSetsBuilder, havingModifierBuilder);
proto.setHavingModifier(
havingModifierBuilder.build());
}
// orderByItemList is a collection of AST nodes. Serialize each of them.
ImmutableList orderByItemLists =
this.getOrderByItemList();
for (ResolvedOrderByItem element : orderByItemLists) {
ResolvedOrderByItemProto.Builder orderByItemListBuilder =
ResolvedOrderByItemProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, orderByItemListBuilder);
proto.addOrderByItemList(orderByItemListBuilder.build());
}
// limit is an AST node. Call its serialization chain.
if (this.getLimit() != null) {
AnyResolvedExprProto.Builder limitBuilder =
AnyResolvedExprProto.newBuilder();
this.getLimit().serialize(
fileDescriptorSetsBuilder, limitBuilder);
proto.setLimit(
limitBuilder.build());
}
// functionCallInfo is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getFunctionCallInfo() != null) {
proto.setFunctionCallInfo(
ResolvedNodes.serialize(this.getFunctionCallInfo(),
fileDescriptorSetsBuilder));
}
// groupByList is a collection of AST nodes. Serialize each of them.
ImmutableList groupByLists =
this.getGroupByList();
for (ResolvedComputedColumn element : groupByLists) {
ResolvedComputedColumnProto.Builder groupByListBuilder =
ResolvedComputedColumnProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, groupByListBuilder);
proto.addGroupByList(groupByListBuilder.build());
}
// groupByAggregateList is a collection of AST nodes. Serialize each of them.
ImmutableList groupByAggregateLists =
this.getGroupByAggregateList();
for (ResolvedComputedColumnBase element : groupByAggregateLists) {
AnyResolvedComputedColumnBaseProto.Builder groupByAggregateListBuilder =
AnyResolvedComputedColumnBaseProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, groupByAggregateListBuilder);
proto.addGroupByAggregateList(groupByAggregateListBuilder.build());
}
}
/**
* Apply HAVING MAX/MIN filtering to the stream of input values.
*/
public final ResolvedAggregateHavingModifier getHavingModifier() {
return havingModifier;
}
/**
* Apply ordering to the stream of input values before calling
* function.
*/
public final ImmutableList getOrderByItemList() {
return orderByItemList;
}
public final ResolvedExpr getLimit() {
return limit;
}
/**
* This contains optional custom information about a particular
* function call. Functions may introduce subclasses of this class to
* add custom information as needed on a per-function basis.
*
* This field is ignorable because for most types of function calls,
* there is no extra information to consider besides the arguments
* and other fields from ResolvedFunctionCallBase. However, for
* example, the TemplateSQLFunction in
* zetasql/public/templated_sql_function.h defines the
* TemplatedSQLFunctionCall subclass which includes the
* fully-resolved function body in context of the actual concrete
* types of the arguments provided to the function call.
*/
public final ResolvedFunctionCallInfo getFunctionCallInfo() {
return functionCallInfo;
}
/**
* Group the stream of input values by columns in this list, and
* compute the aggregates defined in `group_by_aggregate_list`.
* Used only for multi-level aggregation, when
* FEATURE_V_1_4_MULTILEVEL_AGGREGATION is enabled.
*/
public final ImmutableList getGroupByList() {
return groupByList;
}
/**
* Aggregate columns to compute over the grouping keys defined in
* `group_by_list`. Used only for multi-level aggregation, when
* FEATURE_V_1_4_MULTILEVEL_AGGREGATION is enabled.
*/
public final ImmutableList getGroupByAggregateList() {
return groupByAggregateList;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedAggregateFunctionCall accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
visitor.descend(havingModifier);
visitor.descend(orderByItemList);
visitor.descend(limit);
visitor.descend(groupByList);
visitor.descend(groupByAggregateList);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
if (havingModifier != null) {
fields.add(new DebugStringField("having_modifier", havingModifier));
}
if (!orderByItemList.isEmpty()) {
fields.add(new DebugStringField("order_by_item_list", orderByItemList));
}
if (limit != null) {
fields.add(new DebugStringField("limit", limit));
}
if (!DebugStrings.isDefaultValue(functionCallInfo)) {
fields.add(new DebugStringField("function_call_info", DebugStrings.toStringImpl(functionCallInfo)));
}
if (!groupByList.isEmpty()) {
fields.add(new DebugStringField("group_by_list", groupByList));
}
if (!groupByAggregateList.isEmpty()) {
fields.add(new DebugStringField("group_by_aggregate_list", groupByAggregateList));
}
}
}
/**
* An analytic function call. The mode of the function is either AGGREGATE
* or ANALYTIC. This node only ever shows up as a function call in a
* ResolvedAnalyticFunctionGroup::analytic_function_list. Its associated
* window is not under this node but as a sibling of its parent node.
*
* can be NULL.
*/
public static final class ResolvedAnalyticFunctionCall extends ResolvedNonScalarFunctionCallBase {
private final ResolvedWindowFrame windowFrame;
ResolvedAnalyticFunctionCall(ResolvedAnalyticFunctionCallProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
if (proto.hasWindowFrame()) {
windowFrame =
ResolvedWindowFrame.deserialize(proto.getWindowFrame(), helper);
} else {
windowFrame = null;
}
}
ResolvedAnalyticFunctionCall(
Type type,
AnnotationMap typeAnnotationMap,
Function function,
FunctionSignature signature,
ImmutableList argumentList,
ImmutableList genericArgumentList,
ErrorMode errorMode,
ImmutableList hintList,
ImmutableList collationList,
boolean distinct,
NullHandlingModifier nullHandlingModifier,
ResolvedScan withGroupRowsSubquery,
ImmutableList withGroupRowsParameterList,
ResolvedWindowFrame windowFrame) {
super(
type,
typeAnnotationMap,
function,
signature,
argumentList,
genericArgumentList,
errorMode,
hintList,
collationList,
distinct,
nullHandlingModifier,
withGroupRowsSubquery,
withGroupRowsParameterList);
this.windowFrame = windowFrame;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.function = this.getFunction();
builder.signature = this.getSignature();
builder.argumentList = this.getArgumentList();
builder.genericArgumentList = this.getGenericArgumentList();
builder.errorMode = this.getErrorMode();
builder.hintList = this.getHintList();
builder.collationList = this.getCollationList();
builder.distinct = this.getDistinct();
builder.nullHandlingModifier = this.getNullHandlingModifier();
builder.withGroupRowsSubquery = this.getWithGroupRowsSubquery();
builder.withGroupRowsParameterList = this.getWithGroupRowsParameterList();
builder.windowFrame = this.getWindowFrame();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedNonScalarFunctionCallBase.Builder {
protected ResolvedWindowFrame windowFrame = null;
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setFunction(Function v) {
super.setFunction(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setSignature(FunctionSignature v) {
super.setSignature(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setArgumentList(List v) {
super.setArgumentList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setGenericArgumentList(List v) {
super.setGenericArgumentList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setErrorMode(ErrorMode v) {
super.setErrorMode(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setHintList(List v) {
super.setHintList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setCollationList(List v) {
super.setCollationList(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setDistinct(boolean v) {
super.setDistinct(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setNullHandlingModifier(NullHandlingModifier v) {
super.setNullHandlingModifier(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setWithGroupRowsSubquery(ResolvedScan v) {
super.setWithGroupRowsSubquery(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setWithGroupRowsParameterList(List v) {
super.setWithGroupRowsParameterList(v);
return this;
}
@CanIgnoreReturnValue
public Builder setWindowFrame(ResolvedWindowFrame v) {
this.windowFrame = v;
Preconditions.checkNotNull(v, "windowFrame must not be null");
return this;
}
@Override
public final ResolvedAnalyticFunctionCall build() {
validate();
return new ResolvedAnalyticFunctionCall(
type,
typeAnnotationMap,
function,
signature,
argumentList,
genericArgumentList,
errorMode,
hintList,
collationList,
distinct,
nullHandlingModifier,
withGroupRowsSubquery,
withGroupRowsParameterList,
windowFrame);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
windowFrame != null, "windowFrame must be set");
}
}
public static final ResolvedAnalyticFunctionCall deserialize(
ResolvedAnalyticFunctionCallProto proto, AbstractDeserializationHelper helper) {
return new ResolvedAnalyticFunctionCall(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_ANALYTIC_FUNCTION_CALL;
}
@Override
public final String nodeKindString() {
return "AnalyticFunctionCall";
}
/**
* Serializes this node into a {@link AnyResolvedNonScalarFunctionCallBaseProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedNonScalarFunctionCallBaseProto.Builder builder =
AnyResolvedNonScalarFunctionCallBaseProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedNonScalarFunctionCallBaseProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedNonScalarFunctionCallBaseProto.Builder builder) {
builder.clear();
ResolvedAnalyticFunctionCallProto.Builder childBuilder = ResolvedAnalyticFunctionCallProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedAnalyticFunctionCallNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedAnalyticFunctionCallProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedAnalyticFunctionCallProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedNonScalarFunctionCallBaseProto parent =
(ResolvedNonScalarFunctionCallBaseProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// windowFrame is an AST node. Call its serialization chain.
if (this.getWindowFrame() != null) {
ResolvedWindowFrameProto.Builder windowFrameBuilder =
ResolvedWindowFrameProto.newBuilder();
this.getWindowFrame().serialize(
fileDescriptorSetsBuilder, windowFrameBuilder);
proto.setWindowFrame(
windowFrameBuilder.build());
}
}
public final ResolvedWindowFrame getWindowFrame() {
return windowFrame;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedAnalyticFunctionCall accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
visitor.descend(windowFrame);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
if (windowFrame != null) {
fields.add(new DebugStringField("window_frame", windowFrame));
}
}
}
/**
* Describes a leaf extended cast of ResolvedExtendedCast. See the comment
* for element_list field of ResolvedExtendedCast for more details.
*/
public static final class ResolvedExtendedCastElement extends ResolvedArgument {
private final Type fromType;
private final Type toType;
private final Function function;
ResolvedExtendedCastElement(ResolvedExtendedCastElementProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
fromType = helper.deserialize(proto.getFromType());
toType = helper.deserialize(proto.getToType());
function = helper.deserialize(proto.getFunction());
}
ResolvedExtendedCastElement(
Type fromType,
Type toType,
Function function) {
super();
this.fromType = fromType;
this.toType = toType;
this.function = function;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.fromType = this.getFromType();
builder.toType = this.getToType();
builder.function = this.getFunction();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedArgument.Builder {
protected Type fromType = null;
protected Type toType = null;
protected Function function = null;
private Builder() {}
@CanIgnoreReturnValue
public Builder setFromType(Type v) {
this.fromType = v;
return this;
}
@CanIgnoreReturnValue
public Builder setToType(Type v) {
this.toType = v;
return this;
}
@CanIgnoreReturnValue
public Builder setFunction(Function v) {
this.function = v;
return this;
}
@Override
public final ResolvedExtendedCastElement build() {
validate();
return new ResolvedExtendedCastElement(
fromType,
toType,
function);
}
@Override
protected void validate() {
super.validate();
}
}
public static final ResolvedExtendedCastElement deserialize(
ResolvedExtendedCastElementProto proto, AbstractDeserializationHelper helper) {
return new ResolvedExtendedCastElement(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_EXTENDED_CAST_ELEMENT;
}
@Override
public final String nodeKindString() {
return "ExtendedCastElement";
}
/**
* Serializes this node into a {@link AnyResolvedArgumentProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedArgumentProto.Builder builder =
AnyResolvedArgumentProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedArgumentProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedArgumentProto.Builder builder) {
builder.clear();
ResolvedExtendedCastElementProto.Builder childBuilder = ResolvedExtendedCastElementProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedExtendedCastElementNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedExtendedCastElementProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedExtendedCastElementProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedArgumentProto parent =
(ResolvedArgumentProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// fromType is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getFromType() != null) {
proto.setFromType(
ResolvedNodes.serialize(this.getFromType(),
fileDescriptorSetsBuilder));
}
// toType is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getToType() != null) {
proto.setToType(
ResolvedNodes.serialize(this.getToType(),
fileDescriptorSetsBuilder));
}
// function is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getFunction() != null) {
proto.setFunction(
ResolvedNodes.serialize(this.getFunction(),
fileDescriptorSetsBuilder));
}
}
public final Type getFromType() {
return fromType;
}
public final Type getToType() {
return toType;
}
public final Function getFunction() {
return function;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedExtendedCastElement accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
DebugStrings.collectDebugStringFields(this, fields);
}
public String getNameForDebugString() {
return DebugStrings.getNameForDebugString(this);
}
}
/**
* Describes overall cast operation between two values where at least one
* value's type is or contains an extended type (e.g. on a struct field).
*/
public static final class ResolvedExtendedCast extends ResolvedArgument {
/**
* Stores the list of leaf extended casts required as elements of
* this cast. Each element is a cast where at least one of the input
* or output is an extended type. For structs or arrays, the elements
* will be casts for the field or element types. For structs, there
* can be multiple cast elements (one for each distinct pair of field
* types). For non-struct types, there will be just a single element.
*/
private final ImmutableList elementList;
ResolvedExtendedCast(ResolvedExtendedCastProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
ImmutableList.Builder elementListBuilder =
ImmutableList.builder();
for (ResolvedExtendedCastElementProto element : proto.getElementListList()) {
elementListBuilder
.add(ResolvedExtendedCastElement.deserialize(element, helper));
}
elementList = elementListBuilder.build();
}
ResolvedExtendedCast(
ImmutableList elementList) {
super();
this.elementList = elementList;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.elementList = this.getElementList();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedArgument.Builder {
protected ImmutableList elementList = null;
private Builder() {}
/**
* Stores the list of leaf extended casts required as elements of
* this cast. Each element is a cast where at least one of the input
* or output is an extended type. For structs or arrays, the elements
* will be casts for the field or element types. For structs, there
* can be multiple cast elements (one for each distinct pair of field
* types). For non-struct types, there will be just a single element.
*/ @CanIgnoreReturnValue
public Builder setElementList(List v) {
this.elementList = ImmutableList.copyOf(v);
return this;
}
@Override
public final ResolvedExtendedCast build() {
validate();
return new ResolvedExtendedCast(
elementList);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
elementList != null, "elementList must be set");
}
}
public static final ResolvedExtendedCast deserialize(
ResolvedExtendedCastProto proto, AbstractDeserializationHelper helper) {
return new ResolvedExtendedCast(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_EXTENDED_CAST;
}
@Override
public final String nodeKindString() {
return "ExtendedCast";
}
/**
* Serializes this node into a {@link AnyResolvedArgumentProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedArgumentProto.Builder builder =
AnyResolvedArgumentProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedArgumentProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedArgumentProto.Builder builder) {
builder.clear();
ResolvedExtendedCastProto.Builder childBuilder = ResolvedExtendedCastProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedExtendedCastNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedExtendedCastProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedExtendedCastProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedArgumentProto parent =
(ResolvedArgumentProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// elementList is a collection of AST nodes. Serialize each of them.
ImmutableList elementLists =
this.getElementList();
for (ResolvedExtendedCastElement element : elementLists) {
ResolvedExtendedCastElementProto.Builder elementListBuilder =
ResolvedExtendedCastElementProto.newBuilder();
element.serialize(fileDescriptorSetsBuilder, elementListBuilder);
proto.addElementList(elementListBuilder.build());
}
}
/**
* Stores the list of leaf extended casts required as elements of
* this cast. Each element is a cast where at least one of the input
* or output is an extended type. For structs or arrays, the elements
* will be casts for the field or element types. For structs, there
* can be multiple cast elements (one for each distinct pair of field
* types). For non-struct types, there will be just a single element.
*/
public final ImmutableList getElementList() {
return elementList;
}
@Override
public void accept(Visitor visitor) {
visitor.visit(this);
}
@Override
public ResolvedExtendedCast accept(RewritingVisitor visitor) {
return visitor.visit(this);
}
@Override
protected void acceptChildren(Visitor visitor) {
super.acceptChildren(visitor);
visitor.descend(elementList);
}
public void collectDebugStringFields(List fields) {
super.collectDebugStringFields(fields);
if (!elementList.isEmpty()) {
fields.add(new DebugStringField("element_list", elementList));
}
}
}
/**
* A cast expression, casting the result of an input expression to the
* target Type.
*
* Valid casts are defined in the CastHashMap (see cast.cc), which identifies
* valid from-Type, to-Type pairs. Consumers can access it through
* GetZetaSQLCasts().
*/
public static final class ResolvedCast extends ResolvedExpr {
private final ResolvedExpr expr;
/**
* Whether to return NULL if the cast fails. This is set to true for
* SAFE_CAST.
*/
private final boolean returnNullOnError;
/**
* If at least one of types involved in this cast is or contains an
* extended (TYPE_EXTENDED) type, this field contains information
* necessary to execute this cast.
*/
private final ResolvedExtendedCast extendedCast;
/**
* The format string specified by the optional FORMAT clause. It is
* nullptr when the clause does not exist.
*/
private final ResolvedExpr format;
/**
* The time zone expression by the optional AT TIME ZONE clause. It
* is nullptr when the clause does not exist.
*/
private final ResolvedExpr timeZone;
/**
* Contains the TypeModifiers object which wraps all modifiers
* following the type name in a type string (e.g. type parameters,
* collation) in a cast. If there are no type modifiers specified,
* this object will be empty.
*
*
Type parameters can be specified inside parentheses following the
* type name (e.g. STRING(2)). If specified, the result of the cast
* should conform to the type parameters. Engines are expected to
* enforce type parameter constraints by erroring out or truncating
* the cast result, depending on the output type. See
* (broken link) for more details.
*
*
For example:
* CAST("ABC" as STRING(2)) should error out
* CAST(1234 as NUMERIC(2)) should error out
* CAST(1.234 as NUMERIC(2,1)) should return a NumericValue of 1.2
*
*
Collation can be specified with the COLLATE keyword on a string
* type, e.g. STRING COLLATE 'und:ci'. If specified, the
* of the ResolvedCast node will have equal
* collation annotations. See
* (broken link) for more details.
*
* For example:
* CAST("abc" AS STRING COLLATE "und:ci") should return value "abc"
* in STRING type with collation "und:ci".
* CAST(["abc"] AS ARRAY) should return
* the array ["abc"] with collation "und:ci" at the element type.
*/
private final TypeModifiers typeModifiers;
ResolvedCast(ResolvedCastProto proto, AbstractDeserializationHelper helper) {
super(proto.getParent(), helper);
if (proto.hasExpr()) {
expr =
ResolvedExpr.deserialize(proto.getExpr(), helper);
} else {
expr = null;
}
returnNullOnError = proto.getReturnNullOnError();
if (proto.hasExtendedCast()) {
extendedCast =
ResolvedExtendedCast.deserialize(proto.getExtendedCast(), helper);
} else {
extendedCast = null;
}
if (proto.hasFormat()) {
format =
ResolvedExpr.deserialize(proto.getFormat(), helper);
} else {
format = null;
}
if (proto.hasTimeZone()) {
timeZone =
ResolvedExpr.deserialize(proto.getTimeZone(), helper);
} else {
timeZone = null;
}
typeModifiers = helper.deserialize(proto.getTypeModifiers());
}
ResolvedCast(
Type type,
AnnotationMap typeAnnotationMap,
ResolvedExpr expr,
boolean returnNullOnError,
ResolvedExtendedCast extendedCast,
ResolvedExpr format,
ResolvedExpr timeZone,
TypeModifiers typeModifiers) {
super(
type,
typeAnnotationMap);
this.expr = expr;
this.returnNullOnError = returnNullOnError;
this.extendedCast = extendedCast;
this.format = format;
this.timeZone = timeZone;
this.typeModifiers = typeModifiers;
}
@Override
public Builder toBuilder() {
Builder builder = builder();
builder.type = this.getType();
builder.typeAnnotationMap = this.getTypeAnnotationMap();
builder.expr = this.getExpr();
builder.returnNullOnError = this.getReturnNullOnError();
builder.extendedCast = this.getExtendedCast();
builder.format = this.getFormat();
builder.timeZone = this.getTimeZone();
builder.typeModifiers = this.getTypeModifiers();
return builder;
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends ResolvedExpr.Builder {
protected ResolvedExpr expr = null;
protected Boolean returnNullOnError = null;
protected ResolvedExtendedCast extendedCast = null;
protected ResolvedExpr format = null;
protected ResolvedExpr timeZone = null;
protected TypeModifiers typeModifiers = null;
private Builder() {}
@Override
@CanIgnoreReturnValue
public Builder setType(Type v) {
super.setType(v);
return this;
}
@Override
@CanIgnoreReturnValue
public Builder setTypeAnnotationMap(AnnotationMap v) {
super.setTypeAnnotationMap(v);
return this;
}
@CanIgnoreReturnValue
public Builder setExpr(ResolvedExpr v) {
this.expr = v;
Preconditions.checkNotNull(v, "expr must not be null");
return this;
}
/**
* Whether to return NULL if the cast fails. This is set to true for
* SAFE_CAST.
*/ @CanIgnoreReturnValue
public Builder setReturnNullOnError(boolean v) {
this.returnNullOnError = v;
return this;
}
/**
* If at least one of types involved in this cast is or contains an
* extended (TYPE_EXTENDED) type, this field contains information
* necessary to execute this cast.
*/ @CanIgnoreReturnValue
public Builder setExtendedCast(ResolvedExtendedCast v) {
this.extendedCast = v;
return this;
}
/**
* The format string specified by the optional FORMAT clause. It is
* nullptr when the clause does not exist.
*/ @CanIgnoreReturnValue
public Builder setFormat(ResolvedExpr v) {
this.format = v;
return this;
}
/**
* The time zone expression by the optional AT TIME ZONE clause. It
* is nullptr when the clause does not exist.
*/ @CanIgnoreReturnValue
public Builder setTimeZone(ResolvedExpr v) {
this.timeZone = v;
return this;
}
/**
* Contains the TypeModifiers object which wraps all modifiers
* following the type name in a type string (e.g. type parameters,
* collation) in a cast. If there are no type modifiers specified,
* this object will be empty.
*
* Type parameters can be specified inside parentheses following the
* type name (e.g. STRING(2)). If specified, the result of the cast
* should conform to the type parameters. Engines are expected to
* enforce type parameter constraints by erroring out or truncating
* the cast result, depending on the output type. See
* (broken link) for more details.
*
*
For example:
* CAST("ABC" as STRING(2)) should error out
* CAST(1234 as NUMERIC(2)) should error out
* CAST(1.234 as NUMERIC(2,1)) should return a NumericValue of 1.2
*
*
Collation can be specified with the COLLATE keyword on a string
* type, e.g. STRING COLLATE 'und:ci'. If specified, the
* of the ResolvedCast node will have equal
* collation annotations. See
* (broken link) for more details.
*
* For example:
* CAST("abc" AS STRING COLLATE "und:ci") should return value "abc"
* in STRING type with collation "und:ci".
* CAST(["abc"] AS ARRAY) should return
* the array ["abc"] with collation "und:ci" at the element type.
*/ @CanIgnoreReturnValue
public Builder setTypeModifiers(TypeModifiers v) {
this.typeModifiers = v;
return this;
}
@Override
public final ResolvedCast build() {
validate();
return new ResolvedCast(
type,
typeAnnotationMap,
expr,
returnNullOnError,
extendedCast,
format,
timeZone,
typeModifiers);
}
@Override
protected void validate() {
super.validate();
Preconditions.checkArgument(
expr != null, "expr must be set");
}
}
public static final ResolvedCast deserialize(
ResolvedCastProto proto, AbstractDeserializationHelper helper) {
return new ResolvedCast(proto, helper);
}
@Override
public final ResolvedNodeKind nodeKind() {
return ResolvedNodeKind.RESOLVED_CAST;
}
@Override
public final String nodeKindString() {
return "Cast";
}
/**
* Serializes this node into a {@link AnyResolvedExprProto}.
* Adds any new file descriptor sets it encounters to the builder.
*/
@Override
public final Message serialize(FileDescriptorSetsBuilder fileDescriptorSetsBuilder) {
AnyResolvedExprProto.Builder builder =
AnyResolvedExprProto.newBuilder();
serialize(fileDescriptorSetsBuilder, builder);
return builder.build();
}
/**
* Serializes this node into the appropriate field of the provided
* {@link AnyResolvedExprProto.Builder}.
* Adds any new file descriptor sets it encounters to the {@code fileDescriptorSetsBuilder}.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
AnyResolvedExprProto.Builder builder) {
builder.clear();
ResolvedCastProto.Builder childBuilder = ResolvedCastProto.newBuilder();
serialize(fileDescriptorSetsBuilder, childBuilder);
builder.setResolvedCastNode(childBuilder.build());
}
/**
* Serializes this node into the given {@link ResolvedCastProto.Builder}.
* Adds any new file descriptor sets it encounters to the builder.
* All preexisting state in the proto builder is cleared.
*/
public final void serialize(
FileDescriptorSetsBuilder fileDescriptorSetsBuilder,
ResolvedCastProto.Builder proto) {
proto.clear();
// Serialize superclass state to the parent field of the proto.
ResolvedExprProto parent =
(ResolvedExprProto) super.serialize(fileDescriptorSetsBuilder);
proto.setParent(parent);
// expr is an AST node. Call its serialization chain.
if (this.getExpr() != null) {
AnyResolvedExprProto.Builder exprBuilder =
AnyResolvedExprProto.newBuilder();
this.getExpr().serialize(
fileDescriptorSetsBuilder, exprBuilder);
proto.setExpr(
exprBuilder.build());
}
// returnNullOnError is a leaf type that can be set as a proto field directly.
// (see scalar types in (broken link).py for more information.)
proto.setReturnNullOnError(this.getReturnNullOnError());
// extendedCast is an AST node. Call its serialization chain.
if (this.getExtendedCast() != null) {
ResolvedExtendedCastProto.Builder extendedCastBuilder =
ResolvedExtendedCastProto.newBuilder();
this.getExtendedCast().serialize(
fileDescriptorSetsBuilder, extendedCastBuilder);
proto.setExtendedCast(
extendedCastBuilder.build());
}
// format is an AST node. Call its serialization chain.
if (this.getFormat() != null) {
AnyResolvedExprProto.Builder formatBuilder =
AnyResolvedExprProto.newBuilder();
this.getFormat().serialize(
fileDescriptorSetsBuilder, formatBuilder);
proto.setFormat(
formatBuilder.build());
}
// timeZone is an AST node. Call its serialization chain.
if (this.getTimeZone() != null) {
AnyResolvedExprProto.Builder timeZoneBuilder =
AnyResolvedExprProto.newBuilder();
this.getTimeZone().serialize(
fileDescriptorSetsBuilder, timeZoneBuilder);
proto.setTimeZone(
timeZoneBuilder.build());
}
// typeModifiers is a leaf type that requires a helper method to serialize.
// (see scalar types in (broken link).py for more information.)
if (this.getTypeModifiers() != null) {
proto.setTypeModifiers(
ResolvedNodes.serialize(this.getTypeModifiers(),
fileDescriptorSetsBuilder));
}
}
public final ResolvedExpr getExpr() {
return expr;
}
/**
* Whether to return NULL if the cast fails. This is set to true for
* SAFE_CAST.
*/
public final boolean getReturnNullOnError() {
return returnNullOnError;
}
/**
* If at least one of types involved in this cast is or contains an
* extended (TYPE_EXTENDED) type, this field contains information
* necessary to execute this cast.
*/
public final ResolvedExtendedCast getExtendedCast() {
return extendedCast;
}
/**
* The format string specified by the optional FORMAT clause. It is
* nullptr when the clause does not exist.
*/
public final ResolvedExpr getFormat() {
return format;
}
/**
* The time zone expression by the optional AT TIME ZONE clause. It
* is nullptr when the clause does not exist.
*/
public final ResolvedExpr getTimeZone() {
return timeZone;
}
/**
* Contains the TypeModifiers object which wraps all modifiers
* following the type name in a type string (e.g. type parameters,
* collation) in a cast. If there are no type modifiers specified,
* this object will be empty.
*
* Type parameters can be specified inside parentheses following the
* type name (e.g. STRING(2)). If specified, the result of the cast
* should conform to the type parameters. Engines are expected to
* enforce type parameter constraints by erroring out or truncating
* the cast result, depending on the output type. See
* (broken link) for more details.
*
*
For example:
* CAST("ABC" as STRING(2)) should error out
* CAST(1234 as NUMERIC(2)) should error out
* CAST(1.234 as NUMERIC(2,1)) should return a NumericValue of 1.2
*
*
Collation can be specified with the COLLATE keyword on a string
* type, e.g. STRING COLLATE 'und:ci'. If specified, the
*