How to use Scan method of ast Package

Best Syzkaller code snippet using ast.Scan

node.go

Source:node.go Github

copy

Full Screen

...66 case ast.Connection:67 return newConnectionNode(node.(*ast.ConnectionNode))68 case ast.Descriptor:69 return newDescriptorNode(node.(*ast.DescriptorNode))70 case ast.SingleRowScan:71 return newSingleRowScanNode(node.(*ast.SingleRowScanNode))72 case ast.TableScan:73 return newTableScanNode(node.(*ast.TableScanNode))74 case ast.JoinScan:75 return newJoinScanNode(node.(*ast.JoinScanNode))76 case ast.ArrayScan:77 return newArrayScanNode(node.(*ast.ArrayScanNode))78 case ast.ColumnHolder:79 return newColumnHolderNode(node.(*ast.ColumnHolderNode))80 case ast.FilterScan:81 return newFilterScanNode(node.(*ast.FilterScanNode))82 case ast.GroupingSet:83 return newGroupingSetNode(node.(*ast.GroupingSetNode))84 case ast.AggregateScan:85 return newAggregateScanNode(node.(*ast.AggregateScanNode))86 case ast.AnonymizedAggregateScan:87 return newAnonymizedAggregateScanNode(node.(*ast.AnonymizedAggregateScanNode))88 case ast.SetOperationItem:89 return newSetOperationItemNode(node.(*ast.SetOperationItemNode))90 case ast.SetOperationScan:91 return newSetOperationScanNode(node.(*ast.SetOperationScanNode))92 case ast.OrderByScan:93 return newOrderByScanNode(node.(*ast.OrderByScanNode))94 case ast.LimitOffsetScan:95 return newLimitOffsetScanNode(node.(*ast.LimitOffsetScanNode))96 case ast.WithRefScan:97 return newWithRefScanNode(node.(*ast.WithRefScanNode))98 case ast.AnalyticScan:99 return newAnalyticScanNode(node.(*ast.AnalyticScanNode))100 case ast.SampleScan:101 return newSampleScanNode(node.(*ast.SampleScanNode))102 case ast.ComputedColumn:103 return newComputedColumnNode(node.(*ast.ComputedColumnNode))104 case ast.OrderByItem:105 return newOrderByItemNode(node.(*ast.OrderByItemNode))106 case ast.ColumnAnnotations:107 return newColumnAnnotationsNode(node.(*ast.ColumnAnnotationsNode))108 case ast.GeneratedColumnInfo:109 return newGeneratedColumnInfoNode(node.(*ast.GeneratedColumnInfoNode))110 case ast.ColumnDefaultValue:111 return newColumnDefaultValueNode(node.(*ast.ColumnDefaultValueNode))112 case ast.ColumnDefinition:113 return newColumnDefinitionNode(node.(*ast.ColumnDefinitionNode))114 case ast.PrimaryKey:115 return newPrimaryKeyNode(node.(*ast.PrimaryKeyNode))116 case ast.ForeignKey:117 return newForeignKeyNode(node.(*ast.ForeignKeyNode))118 case ast.CheckConstraint:119 return newCheckConstraintNode(node.(*ast.CheckConstraintNode))120 case ast.OutputColumn:121 return newOutputColumnNode(node.(*ast.OutputColumnNode))122 case ast.ProjectScan:123 return newProjectScanNode(node.(*ast.ProjectScanNode))124 case ast.TVFScan:125 return newTVFScanNode(node.(*ast.TVFScanNode))126 case ast.GroupRowsScan:127 return newGroupRowsScanNode(node.(*ast.GroupRowsScanNode))128 case ast.FunctionArgument:129 return newFunctionArgumentNode(node.(*ast.FunctionArgumentNode))130 case ast.ExplainStmt:131 return newExplainStmtNode(node.(*ast.ExplainStmtNode))132 case ast.QueryStmt:133 return newQueryStmtNode(node.(*ast.QueryStmtNode))134 case ast.CreateDatabaseStmt:135 return newCreateDatabaseStmtNode(node.(*ast.CreateDatabaseStmtNode))136 case ast.IndexItem:137 return newIndexItemNode(node.(*ast.IndexItemNode))138 case ast.UnnestItem:139 return newUnnestItemNode(node.(*ast.UnnestItemNode))140 case ast.CreateIndexStmt:141 return newCreateIndexStmtNode(node.(*ast.CreateIndexStmtNode))142 case ast.CreateSchemaStmt:143 return newCreateSchemaStmtNode(node.(*ast.CreateSchemaStmtNode))144 case ast.CreateTableStmt:145 return newCreateTableStmtNode(node.(*ast.CreateTableStmtNode))146 case ast.CreateTableAsSelectStmt:147 return newCreateTableAsSelectStmtNode(node.(*ast.CreateTableAsSelectStmtNode))148 case ast.CreateModelStmt:149 return newCreateModelStmtNode(node.(*ast.CreateModelStmtNode))150 case ast.CreateViewStmt:151 return newCreateViewStmtNode(node.(*ast.CreateViewStmtNode))152 case ast.WithPartitionColumns:153 return newWithPartitionColumnsNode(node.(*ast.WithPartitionColumnsNode))154 case ast.CreateSnapshotTableStmt:155 return newCreateSnapshotTableStmtNode(node.(*ast.CreateSnapshotTableStmtNode))156 case ast.CreateExternalTableStmt:157 return newCreateExternalTableStmtNode(node.(*ast.CreateExternalTableStmtNode))158 case ast.ExportModelStmt:159 return newExportModelStmtNode(node.(*ast.ExportModelStmtNode))160 case ast.ExportDataStmt:161 return newExportDataStmtNode(node.(*ast.ExportDataStmtNode))162 case ast.DefineTableStmt:163 return newDefineTableStmtNode(node.(*ast.DefineTableStmtNode))164 case ast.DescribeStmt:165 return newDescribeStmtNode(node.(*ast.DescribeStmtNode))166 case ast.ShowStmt:167 return newShowStmtNode(node.(*ast.ShowStmtNode))168 case ast.BeginStmt:169 return newBeginStmtNode(node.(*ast.BeginStmtNode))170 case ast.SetTransactionStmt:171 return newSetTransactionStmtNode(node.(*ast.SetTransactionStmtNode))172 case ast.CommitStmt:173 return newCommitStmtNode(node.(*ast.CommitStmtNode))174 case ast.RollbackStmt:175 return newRollbackStmtNode(node.(*ast.RollbackStmtNode))176 case ast.StartBatchStmt:177 return newStartBatchStmtNode(node.(*ast.StartBatchStmtNode))178 case ast.RunBatchStmt:179 return newRunBatchStmtNode(node.(*ast.RunBatchStmtNode))180 case ast.AbortBatchStmt:181 return newAbortBatchStmtNode(node.(*ast.AbortBatchStmtNode))182 case ast.DropStmt:183 return newDropStmtNode(node.(*ast.DropStmtNode))184 case ast.DropMaterializedViewStmt:185 return newDropMaterializedViewStmtNode(node.(*ast.DropMaterializedViewStmtNode))186 case ast.DropSnapshotTableStmt:187 return newDropSnapshotTableStmtNode(node.(*ast.DropSnapshotTableStmtNode))188 case ast.RecursiveRefScan:189 return newRecursiveRefScanNode(node.(*ast.RecursiveRefScanNode))190 case ast.RecursiveScan:191 return newRecursiveScanNode(node.(*ast.RecursiveScanNode))192 case ast.WithScan:193 return newWithScanNode(node.(*ast.WithScanNode))194 case ast.WithEntry:195 return newWithEntryNode(node.(*ast.WithEntryNode))196 case ast.Option:197 return newOptionNode(node.(*ast.OptionNode))198 case ast.WindowPartitioning:199 return newWindowPartitioningNode(node.(*ast.WindowPartitioningNode))200 case ast.WindowOrdering:201 return newWindowOrderingNode(node.(*ast.WindowOrderingNode))202 case ast.WindowFrame:203 return newWindowFrameNode(node.(*ast.WindowFrameNode))204 case ast.AnalyticFunctionGroup:205 return newAnalyticFunctionGroupNode(node.(*ast.AnalyticFunctionGroupNode))206 case ast.WindowFrameExpr:207 return newWindowFrameExprNode(node.(*ast.WindowFrameExprNode))208 case ast.DMLValue:209 return newDMLValueNode(node.(*ast.DMLValueNode))210 case ast.DMLDefault:211 return newDMLDefaultNode(node.(*ast.DMLDefaultNode))212 case ast.AssertStmt:213 return newAssertStmtNode(node.(*ast.AssertStmtNode))214 case ast.AssertRowsModified:215 return newAssertRowsModifiedNode(node.(*ast.AssertRowsModifiedNode))216 case ast.InsertRow:217 return newInsertRowNode(node.(*ast.InsertRowNode))218 case ast.InsertStmt:219 return newInsertStmtNode(node.(*ast.InsertStmtNode))220 case ast.DeleteStmt:221 return newDeleteStmtNode(node.(*ast.DeleteStmtNode))222 case ast.UpdateItem:223 return newUpdateItemNode(node.(*ast.UpdateItemNode))224 case ast.UpdateArrayItem:225 return newUpdateArrayItemNode(node.(*ast.UpdateArrayItemNode))226 case ast.UpdateStmt:227 return newUpdateStmtNode(node.(*ast.UpdateStmtNode))228 case ast.MergeWhen:229 return newMergeWhenNode(node.(*ast.MergeWhenNode))230 case ast.MergeStmt:231 return newMergeStmtNode(node.(*ast.MergeStmtNode))232 case ast.TruncateStmt:233 return newTruncateStmtNode(node.(*ast.TruncateStmtNode))234 case ast.ObjectUnit:235 return newObjectUnitNode(node.(*ast.ObjectUnitNode))236 case ast.Privilege:237 return newPrivilegeNode(node.(*ast.PrivilegeNode))238 case ast.GrantStmt:239 return newGrantStmtNode(node.(*ast.GrantStmtNode))240 case ast.RevokeStmt:241 return newRevokeStmtNode(node.(*ast.RevokeStmtNode))242 case ast.AlterDatabaseStmt:243 return newAlterDatabaseStmtNode(node.(*ast.AlterDatabaseStmtNode))244 case ast.AlterMaterializedViewStmt:245 return newAlterMaterializedViewStmtNode(node.(*ast.AlterMaterializedViewStmtNode))246 case ast.AlterSchemaStmt:247 return newAlterSchemaStmtNode(node.(*ast.AlterSchemaStmtNode))248 case ast.AlterTableStmt:249 return newAlterTableStmtNode(node.(*ast.AlterTableStmtNode))250 case ast.AlterViewStmt:251 return newAlterViewStmtNode(node.(*ast.AlterViewStmtNode))252 case ast.SetOptionsAction:253 return newSetOptionsActionNode(node.(*ast.SetOptionsActionNode))254 case ast.AddColumnAction:255 return newAddColumnActionNode(node.(*ast.AddColumnActionNode))256 case ast.AddConstraintAction:257 return newAddConstraintActionNode(node.(*ast.AddConstraintActionNode))258 case ast.DropConstraintAction:259 return newDropConstraintActionNode(node.(*ast.DropConstraintActionNode))260 case ast.DropPrimaryKeyAction:261 return newDropPrimaryKeyActionNode(node.(*ast.DropPrimaryKeyActionNode))262 case ast.AlterColumnOptionsAction:263 return newAlterColumnOptionsActionNode(node.(*ast.AlterColumnOptionsActionNode))264 case ast.AlterColumnDropNotNullAction:265 return newAlterColumnDropNotNullActionNode(node.(*ast.AlterColumnDropNotNullActionNode))266 case ast.AlterColumnSetDataTypeAction:267 return newAlterColumnSetDataTypeActionNode(node.(*ast.AlterColumnSetDataTypeActionNode))268 case ast.AlterColumnSetDefaultAction:269 return newAlterColumnSetDefaultActionNode(node.(*ast.AlterColumnSetDefaultActionNode))270 case ast.AlterColumnDropDefaultAction:271 return newAlterColumnDropDefaultActionNode(node.(*ast.AlterColumnDropDefaultActionNode))272 case ast.DropColumnAction:273 return newDropColumnActionNode(node.(*ast.DropColumnActionNode))274 case ast.RenameColumnAction:275 return newRenameColumnActionNode(node.(*ast.RenameColumnActionNode))276 case ast.SetAsAction:277 return newSetAsActionNode(node.(*ast.SetAsActionNode))278 case ast.SetCollateClause:279 return newSetCollateClauseNode(node.(*ast.SetCollateClauseNode))280 case ast.AlterTableSetOptionsStmt:281 return newAlterTableSetOptionsStmtNode(node.(*ast.AlterTableSetOptionsStmtNode))282 case ast.RenameStmt:283 return newRenameStmtNode(node.(*ast.RenameStmtNode))284 case ast.CreatePrivilegeRestrictionStmt:285 return newCreatePrivilegeRestrictionStmtNode(node.(*ast.CreatePrivilegeRestrictionStmtNode))286 case ast.CreateRowAccessPolicyStmt:287 return newCreateRowAccessPolicyStmtNode(node.(*ast.CreateRowAccessPolicyStmtNode))288 case ast.DropPrivilegeRestrictionStmt:289 return newDropPrivilegeRestrictionStmtNode(node.(*ast.DropPrivilegeRestrictionStmtNode))290 case ast.DropRowAccessPolicyStmt:291 return newDropRowAccessPolicyStmtNode(node.(*ast.DropRowAccessPolicyStmtNode))292 case ast.DropSearchIndexStmt:293 return newDropSearchIndexStmtNode(node.(*ast.DropSearchIndexStmtNode))294 case ast.GrantToAction:295 return newGrantToActionNode(node.(*ast.GrantToActionNode))296 case ast.RestrictToAction:297 return newRestrictToActionNode(node.(*ast.RestrictToActionNode))298 case ast.AddToRestricteeListAction:299 return newAddToRestricteeListActionNode(node.(*ast.AddToRestricteeListActionNode))300 case ast.RemoveFromRestricteeListAction:301 return newRemoveFromRestricteeListActionNode(node.(*ast.RemoveFromRestricteeListActionNode))302 case ast.FilterUsingAction:303 return newFilterUsingActionNode(node.(*ast.FilterUsingActionNode))304 case ast.RevokeFromAction:305 return newRevokeFromActionNode(node.(*ast.RevokeFromActionNode))306 case ast.RenameToAction:307 return newRenameToActionNode(node.(*ast.RenameToActionNode))308 case ast.AlterPrivilegeRestrictionStmt:309 return newAlterPrivilegeRestrictionStmtNode(node.(*ast.AlterPrivilegeRestrictionStmtNode))310 case ast.AlterRowAccessPolicyStmt:311 return newAlterRowAccessPolicyStmtNode(node.(*ast.AlterRowAccessPolicyStmtNode))312 case ast.AlterAllRowAccessPoliciesStmt:313 return newAlterAllRowAccessPoliciesStmtNode(node.(*ast.AlterAllRowAccessPoliciesStmtNode))314 case ast.CreateConstantStmt:315 return newCreateConstantStmtNode(node.(*ast.CreateConstantStmtNode))316 case ast.CreateFunctionStmt:317 return newCreateFunctionStmtNode(node.(*ast.CreateFunctionStmtNode))318 case ast.ArgumentDef:319 return newArgumentDefNode(node.(*ast.ArgumentDefNode))320 case ast.ArgumentRef:321 return newArgumentRefNode(node.(*ast.ArgumentRefNode))322 case ast.CreateTableFunctionStmt:323 return newCreateTableFunctionStmtNode(node.(*ast.CreateTableFunctionStmtNode))324 case ast.RelationArgumentScan:325 return newRelationArgumentScanNode(node.(*ast.RelationArgumentScanNode))326 case ast.ArgumentList:327 return newArgumentListNode(node.(*ast.ArgumentListNode))328 case ast.FunctionSignatureHolder:329 return newFunctionSignatureHolderNode(node.(*ast.FunctionSignatureHolderNode))330 case ast.DropFunctionStmt:331 return newDropFunctionStmtNode(node.(*ast.DropFunctionStmtNode))332 case ast.DropTableFunctionStmt:333 return newDropTableFunctionStmtNode(node.(*ast.DropTableFunctionStmtNode))334 case ast.CallStmt:335 return newCallStmtNode(node.(*ast.CallStmtNode))336 case ast.ImportStmt:337 return newImportStmtNode(node.(*ast.ImportStmtNode))338 case ast.ModuleStmt:339 return newModuleStmtNode(node.(*ast.ModuleStmtNode))340 case ast.AggregateHavingModifier:341 return newAggregateHavingModifierNode(node.(*ast.AggregateHavingModifierNode))342 case ast.CreateMaterializedViewStmt:343 return newCreateMaterializedViewStmtNode(node.(*ast.CreateMaterializedViewStmtNode))344 case ast.CreateProcedureStmt:345 return newCreateProcedureStmtNode(node.(*ast.CreateProcedureStmtNode))346 case ast.ExecuteImmediateArgument:347 return newExecuteImmediateArgumentNode(node.(*ast.ExecuteImmediateArgumentNode))348 case ast.ExecuteImmediateStmt:349 return newExecuteImmediateStmtNode(node.(*ast.ExecuteImmediateStmtNode))350 case ast.AssignmentStmt:351 return newAssignmentStmtNode(node.(*ast.AssignmentStmtNode))352 case ast.CreateEntityStmt:353 return newCreateEntityStmtNode(node.(*ast.CreateEntityStmtNode))354 case ast.AlterEntityStmt:355 return newAlterEntityStmtNode(node.(*ast.AlterEntityStmtNode))356 case ast.PivotColumn:357 return newPivotColumnNode(node.(*ast.PivotColumnNode))358 case ast.PivotScan:359 return newPivotScanNode(node.(*ast.PivotScanNode))360 case ast.ReturningClause:361 return newReturningClauseNode(node.(*ast.ReturningClauseNode))362 case ast.UnpivotArg:363 return newUnpivotArgNode(node.(*ast.UnpivotArgNode))364 case ast.UnpivotScan:365 return newUnpivotScanNode(node.(*ast.UnpivotScanNode))366 case ast.CloneDataStmt:367 return newCloneDataStmtNode(node.(*ast.CloneDataStmtNode))368 case ast.TableAndColumnInfo:369 return newTableAndColumnInfoNode(node.(*ast.TableAndColumnInfoNode))370 case ast.AnalyzeStmt:371 return newAnalyzeStmtNode(node.(*ast.AnalyzeStmtNode))372 case ast.AuxLoadDataStmt:373 return newAuxLoadDataStmtNode(node.(*ast.AuxLoadDataStmtNode))374 }375 return nil376}377type LiteralNode struct {378 node *ast.LiteralNode379}380type ParameterNode struct {381 node *ast.ParameterNode382}383type ExpressionColumnNode struct {384 node *ast.ExpressionColumnNode385}386type ColumnRefNode struct {387 node *ast.ColumnRefNode388}389type ConstantNode struct {390 node *ast.ConstantNode391}392type SystemVariableNode struct {393 node *ast.SystemVariableNode394}395type InlineLambdaNode struct {396 node *ast.InlineLambdaNode397}398type FilterFieldArgNode struct {399 node *ast.FilterFieldArgNode400}401type FilterFieldNode struct {402 node *ast.FilterFieldNode403}404type FunctionCallNode struct {405 node *ast.FunctionCallNode406}407type AggregateFunctionCallNode struct {408 node *ast.AggregateFunctionCallNode409}410type AnalyticFunctionCallNode struct {411 node *ast.AnalyticFunctionCallNode412}413type ExtendedCastElementNode struct {414 node *ast.ExtendedCastElementNode415}416type ExtendedCastNode struct {417 node *ast.ExtendedCastNode418}419type CastNode struct {420 node *ast.CastNode421}422type MakeStructNode struct {423 node *ast.MakeStructNode424}425type MakeProtoNode struct {426 node *ast.MakeProtoNode427}428type MakeProtoFieldNode struct {429 node *ast.MakeProtoFieldNode430}431type GetStructFieldNode struct {432 node *ast.GetStructFieldNode433}434type GetProtoFieldNode struct {435 node *ast.GetProtoFieldNode436}437type GetJsonFieldNode struct {438 node *ast.GetJsonFieldNode439}440type FlattenNode struct {441 node *ast.FlattenNode442}443type FlattenedArgNode struct {444 node *ast.FlattenedArgNode445}446type ReplaceFieldItemNode struct {447 node *ast.ReplaceFieldItemNode448}449type ReplaceFieldNode struct {450 node *ast.ReplaceFieldNode451}452type SubqueryExprNode struct {453 node *ast.SubqueryExprNode454}455type LetExprNode struct {456 node *ast.LetExprNode457}458type ModelNode struct {459 node *ast.ModelNode460}461type ConnectionNode struct {462 node *ast.ConnectionNode463}464type DescriptorNode struct {465 node *ast.DescriptorNode466}467type SingleRowScanNode struct {468 node *ast.SingleRowScanNode469}470type TableScanNode struct {471 node *ast.TableScanNode472}473type JoinScanNode struct {474 node *ast.JoinScanNode475}476type ArrayScanNode struct {477 node *ast.ArrayScanNode478}479type ColumnHolderNode struct {480 node *ast.ColumnHolderNode481}482type FilterScanNode struct {483 node *ast.FilterScanNode484}485type GroupingSetNode struct {486 node *ast.GroupingSetNode487}488type AggregateScanNode struct {489 node *ast.AggregateScanNode490}491type AnonymizedAggregateScanNode struct {492 node *ast.AnonymizedAggregateScanNode493}494type SetOperationItemNode struct {495 node *ast.SetOperationItemNode496}497type SetOperationScanNode struct {498 node *ast.SetOperationScanNode499}500type OrderByScanNode struct {501 node *ast.OrderByScanNode502}503type LimitOffsetScanNode struct {504 node *ast.LimitOffsetScanNode505}506type WithRefScanNode struct {507 node *ast.WithRefScanNode508}509type AnalyticScanNode struct {510 node *ast.AnalyticScanNode511}512type SampleScanNode struct {513 node *ast.SampleScanNode514}515type ComputedColumnNode struct {516 node *ast.ComputedColumnNode517}518type OrderByItemNode struct {519 node *ast.OrderByItemNode520}521type ColumnAnnotationsNode struct {522 node *ast.ColumnAnnotationsNode523}524type GeneratedColumnInfoNode struct {525 node *ast.GeneratedColumnInfoNode526}527type ColumnDefaultValueNode struct {528 node *ast.ColumnDefaultValueNode529}530type ColumnDefinitionNode struct {531 node *ast.ColumnDefinitionNode532}533type PrimaryKeyNode struct {534 node *ast.PrimaryKeyNode535}536type ForeignKeyNode struct {537 node *ast.ForeignKeyNode538}539type CheckConstraintNode struct {540 node *ast.CheckConstraintNode541}542type OutputColumnNode struct {543 node *ast.OutputColumnNode544}545type ProjectScanNode struct {546 node *ast.ProjectScanNode547}548type TVFScanNode struct {549 node *ast.TVFScanNode550}551type GroupRowsScanNode struct {552 node *ast.GroupRowsScanNode553}554type FunctionArgumentNode struct {555 node *ast.FunctionArgumentNode556}557type ExplainStmtNode struct {558 node *ast.ExplainStmtNode559}560type QueryStmtNode struct {561 node *ast.QueryStmtNode562}563type CreateDatabaseStmtNode struct {564 node *ast.CreateDatabaseStmtNode565}566type IndexItemNode struct {567 node *ast.IndexItemNode568}569type UnnestItemNode struct {570 node *ast.UnnestItemNode571}572type CreateIndexStmtNode struct {573 node *ast.CreateIndexStmtNode574}575type CreateSchemaStmtNode struct {576 node *ast.CreateSchemaStmtNode577}578type CreateTableStmtNode struct {579 node *ast.CreateTableStmtNode580}581type CreateTableAsSelectStmtNode struct {582 node *ast.CreateTableAsSelectStmtNode583}584type CreateModelStmtNode struct {585 node *ast.CreateModelStmtNode586}587type CreateViewStmtNode struct {588 node *ast.CreateViewStmtNode589}590type WithPartitionColumnsNode struct {591 node *ast.WithPartitionColumnsNode592}593type CreateSnapshotTableStmtNode struct {594 node *ast.CreateSnapshotTableStmtNode595}596type CreateExternalTableStmtNode struct {597 node *ast.CreateExternalTableStmtNode598}599type ExportModelStmtNode struct {600 node *ast.ExportModelStmtNode601}602type ExportDataStmtNode struct {603 node *ast.ExportDataStmtNode604}605type DefineTableStmtNode struct {606 node *ast.DefineTableStmtNode607}608type DescribeStmtNode struct {609 node *ast.DescribeStmtNode610}611type ShowStmtNode struct {612 node *ast.ShowStmtNode613}614type BeginStmtNode struct {615 node *ast.BeginStmtNode616}617type SetTransactionStmtNode struct {618 node *ast.SetTransactionStmtNode619}620type CommitStmtNode struct {621 node *ast.CommitStmtNode622}623type RollbackStmtNode struct {624 node *ast.RollbackStmtNode625}626type StartBatchStmtNode struct {627 node *ast.StartBatchStmtNode628}629type RunBatchStmtNode struct {630 node *ast.RunBatchStmtNode631}632type AbortBatchStmtNode struct {633 node *ast.AbortBatchStmtNode634}635type DropStmtNode struct {636 node *ast.DropStmtNode637}638type DropMaterializedViewStmtNode struct {639 node *ast.DropMaterializedViewStmtNode640}641type DropSnapshotTableStmtNode struct {642 node *ast.DropSnapshotTableStmtNode643}644type RecursiveRefScanNode struct {645 node *ast.RecursiveRefScanNode646}647type RecursiveScanNode struct {648 node *ast.RecursiveScanNode649}650type WithScanNode struct {651 node *ast.WithScanNode652}653type WithEntryNode struct {654 node *ast.WithEntryNode655}656type OptionNode struct {657 node *ast.OptionNode658}659type WindowPartitioningNode struct {660 node *ast.WindowPartitioningNode661}662type WindowOrderingNode struct {663 node *ast.WindowOrderingNode664}665type WindowFrameNode struct {666 node *ast.WindowFrameNode667}668type AnalyticFunctionGroupNode struct {669 node *ast.AnalyticFunctionGroupNode670}671type WindowFrameExprNode struct {672 node *ast.WindowFrameExprNode673}674type DMLValueNode struct {675 node *ast.DMLValueNode676}677type DMLDefaultNode struct {678 node *ast.DMLDefaultNode679}680type AssertStmtNode struct {681 node *ast.AssertStmtNode682}683type AssertRowsModifiedNode struct {684 node *ast.AssertRowsModifiedNode685}686type InsertRowNode struct {687 node *ast.InsertRowNode688}689type InsertStmtNode struct {690 node *ast.InsertStmtNode691}692type DeleteStmtNode struct {693 node *ast.DeleteStmtNode694}695type UpdateItemNode struct {696 node *ast.UpdateItemNode697}698type UpdateArrayItemNode struct {699 node *ast.UpdateArrayItemNode700}701type UpdateStmtNode struct {702 node *ast.UpdateStmtNode703}704type MergeWhenNode struct {705 node *ast.MergeWhenNode706}707type MergeStmtNode struct {708 node *ast.MergeStmtNode709}710type TruncateStmtNode struct {711 node *ast.TruncateStmtNode712}713type ObjectUnitNode struct {714 node *ast.ObjectUnitNode715}716type PrivilegeNode struct {717 node *ast.PrivilegeNode718}719type GrantStmtNode struct {720 node *ast.GrantStmtNode721}722type RevokeStmtNode struct {723 node *ast.RevokeStmtNode724}725type AlterDatabaseStmtNode struct {726 node *ast.AlterDatabaseStmtNode727}728type AlterMaterializedViewStmtNode struct {729 node *ast.AlterMaterializedViewStmtNode730}731type AlterSchemaStmtNode struct {732 node *ast.AlterSchemaStmtNode733}734type AlterTableStmtNode struct {735 node *ast.AlterTableStmtNode736}737type AlterViewStmtNode struct {738 node *ast.AlterViewStmtNode739}740type SetOptionsActionNode struct {741 node *ast.SetOptionsActionNode742}743type AddColumnActionNode struct {744 node *ast.AddColumnActionNode745}746type AddConstraintActionNode struct {747 node *ast.AddConstraintActionNode748}749type DropConstraintActionNode struct {750 node *ast.DropConstraintActionNode751}752type DropPrimaryKeyActionNode struct {753 node *ast.DropPrimaryKeyActionNode754}755type AlterColumnOptionsActionNode struct {756 node *ast.AlterColumnOptionsActionNode757}758type AlterColumnDropNotNullActionNode struct {759 node *ast.AlterColumnDropNotNullActionNode760}761type AlterColumnSetDataTypeActionNode struct {762 node *ast.AlterColumnSetDataTypeActionNode763}764type AlterColumnSetDefaultActionNode struct {765 node *ast.AlterColumnSetDefaultActionNode766}767type AlterColumnDropDefaultActionNode struct {768 node *ast.AlterColumnDropDefaultActionNode769}770type DropColumnActionNode struct {771 node *ast.DropColumnActionNode772}773type RenameColumnActionNode struct {774 node *ast.RenameColumnActionNode775}776type SetAsActionNode struct {777 node *ast.SetAsActionNode778}779type SetCollateClauseNode struct {780 node *ast.SetCollateClauseNode781}782type AlterTableSetOptionsStmtNode struct {783 node *ast.AlterTableSetOptionsStmtNode784}785type RenameStmtNode struct {786 node *ast.RenameStmtNode787}788type CreatePrivilegeRestrictionStmtNode struct {789 node *ast.CreatePrivilegeRestrictionStmtNode790}791type CreateRowAccessPolicyStmtNode struct {792 node *ast.CreateRowAccessPolicyStmtNode793}794type DropPrivilegeRestrictionStmtNode struct {795 node *ast.DropPrivilegeRestrictionStmtNode796}797type DropRowAccessPolicyStmtNode struct {798 node *ast.DropRowAccessPolicyStmtNode799}800type DropSearchIndexStmtNode struct {801 node *ast.DropSearchIndexStmtNode802}803type GrantToActionNode struct {804 node *ast.GrantToActionNode805}806type RestrictToActionNode struct {807 node *ast.RestrictToActionNode808}809type AddToRestricteeListActionNode struct {810 node *ast.AddToRestricteeListActionNode811}812type RemoveFromRestricteeListActionNode struct {813 node *ast.RemoveFromRestricteeListActionNode814}815type FilterUsingActionNode struct {816 node *ast.FilterUsingActionNode817}818type RevokeFromActionNode struct {819 node *ast.RevokeFromActionNode820}821type RenameToActionNode struct {822 node *ast.RenameToActionNode823}824type AlterPrivilegeRestrictionStmtNode struct {825 node *ast.AlterPrivilegeRestrictionStmtNode826}827type AlterRowAccessPolicyStmtNode struct {828 node *ast.AlterRowAccessPolicyStmtNode829}830type AlterAllRowAccessPoliciesStmtNode struct {831 node *ast.AlterAllRowAccessPoliciesStmtNode832}833type CreateConstantStmtNode struct {834 node *ast.CreateConstantStmtNode835}836type CreateFunctionStmtNode struct {837 node *ast.CreateFunctionStmtNode838}839type ArgumentDefNode struct {840 node *ast.ArgumentDefNode841}842type ArgumentRefNode struct {843 node *ast.ArgumentRefNode844}845type CreateTableFunctionStmtNode struct {846 node *ast.CreateTableFunctionStmtNode847}848type RelationArgumentScanNode struct {849 node *ast.RelationArgumentScanNode850}851type ArgumentListNode struct {852 node *ast.ArgumentListNode853}854type FunctionSignatureHolderNode struct {855 node *ast.FunctionSignatureHolderNode856}857type DropFunctionStmtNode struct {858 node *ast.DropFunctionStmtNode859}860type DropTableFunctionStmtNode struct {861 node *ast.DropTableFunctionStmtNode862}863type CallStmtNode struct {864 node *ast.CallStmtNode865}866type ImportStmtNode struct {867 node *ast.ImportStmtNode868}869type ModuleStmtNode struct {870 node *ast.ModuleStmtNode871}872type AggregateHavingModifierNode struct {873 node *ast.AggregateHavingModifierNode874}875type CreateMaterializedViewStmtNode struct {876 node *ast.CreateMaterializedViewStmtNode877}878type CreateProcedureStmtNode struct {879 node *ast.CreateProcedureStmtNode880}881type ExecuteImmediateArgumentNode struct {882 node *ast.ExecuteImmediateArgumentNode883}884type ExecuteImmediateStmtNode struct {885 node *ast.ExecuteImmediateStmtNode886}887type AssignmentStmtNode struct {888 node *ast.AssignmentStmtNode889}890type CreateEntityStmtNode struct {891 node *ast.CreateEntityStmtNode892}893type AlterEntityStmtNode struct {894 node *ast.AlterEntityStmtNode895}896type PivotColumnNode struct {897 node *ast.PivotColumnNode898}899type PivotScanNode struct {900 node *ast.PivotScanNode901}902type ReturningClauseNode struct {903 node *ast.ReturningClauseNode904}905type UnpivotArgNode struct {906 node *ast.UnpivotArgNode907}908type UnpivotScanNode struct {909 node *ast.UnpivotScanNode910}911type CloneDataStmtNode struct {912 node *ast.CloneDataStmtNode913}914type TableAndColumnInfoNode struct {915 node *ast.TableAndColumnInfoNode916}917type AnalyzeStmtNode struct {918 node *ast.AnalyzeStmtNode919}920type AuxLoadDataStmtNode struct {921 node *ast.AuxLoadDataStmtNode922}923func newLiteralNode(n *ast.LiteralNode) *LiteralNode {924 return &LiteralNode{node: n}925}926func newParameterNode(n *ast.ParameterNode) *ParameterNode {927 return &ParameterNode{node: n}928}929func newExpressionColumnNode(n *ast.ExpressionColumnNode) *ExpressionColumnNode {930 return &ExpressionColumnNode{node: n}931}932func newColumnRefNode(n *ast.ColumnRefNode) *ColumnRefNode {933 return &ColumnRefNode{node: n}934}935func newConstantNode(n *ast.ConstantNode) *ConstantNode {936 return &ConstantNode{node: n}937}938func newSystemVariableNode(n *ast.SystemVariableNode) *SystemVariableNode {939 return &SystemVariableNode{node: n}940}941func newInlineLambdaNode(n *ast.InlineLambdaNode) *InlineLambdaNode {942 return &InlineLambdaNode{node: n}943}944func newFilterFieldArgNode(n *ast.FilterFieldArgNode) *FilterFieldArgNode {945 return &FilterFieldArgNode{node: n}946}947func newFilterFieldNode(n *ast.FilterFieldNode) *FilterFieldNode {948 return &FilterFieldNode{node: n}949}950func newFunctionCallNode(n *ast.FunctionCallNode) *FunctionCallNode {951 return &FunctionCallNode{node: n}952}953func newAggregateFunctionCallNode(n *ast.AggregateFunctionCallNode) *AggregateFunctionCallNode {954 return &AggregateFunctionCallNode{node: n}955}956func newAnalyticFunctionCallNode(n *ast.AnalyticFunctionCallNode) *AnalyticFunctionCallNode {957 return &AnalyticFunctionCallNode{node: n}958}959func newExtendedCastElementNode(n *ast.ExtendedCastElementNode) *ExtendedCastElementNode {960 return &ExtendedCastElementNode{node: n}961}962func newExtendedCastNode(n *ast.ExtendedCastNode) *ExtendedCastNode {963 return &ExtendedCastNode{node: n}964}965func newCastNode(n *ast.CastNode) *CastNode {966 return &CastNode{node: n}967}968func newMakeStructNode(n *ast.MakeStructNode) *MakeStructNode {969 return &MakeStructNode{node: n}970}971func newMakeProtoNode(n *ast.MakeProtoNode) *MakeProtoNode {972 return &MakeProtoNode{node: n}973}974func newMakeProtoFieldNode(n *ast.MakeProtoFieldNode) *MakeProtoFieldNode {975 return &MakeProtoFieldNode{node: n}976}977func newGetStructFieldNode(n *ast.GetStructFieldNode) *GetStructFieldNode {978 return &GetStructFieldNode{node: n}979}980func newGetProtoFieldNode(n *ast.GetProtoFieldNode) *GetProtoFieldNode {981 return &GetProtoFieldNode{node: n}982}983func newGetJsonFieldNode(n *ast.GetJsonFieldNode) *GetJsonFieldNode {984 return &GetJsonFieldNode{node: n}985}986func newFlattenNode(n *ast.FlattenNode) *FlattenNode {987 return &FlattenNode{node: n}988}989func newFlattenedArgNode(n *ast.FlattenedArgNode) *FlattenedArgNode {990 return &FlattenedArgNode{node: n}991}992func newReplaceFieldItemNode(n *ast.ReplaceFieldItemNode) *ReplaceFieldItemNode {993 return &ReplaceFieldItemNode{node: n}994}995func newReplaceFieldNode(n *ast.ReplaceFieldNode) *ReplaceFieldNode {996 return &ReplaceFieldNode{node: n}997}998func newSubqueryExprNode(n *ast.SubqueryExprNode) *SubqueryExprNode {999 return &SubqueryExprNode{node: n}1000}1001func newLetExprNode(n *ast.LetExprNode) *LetExprNode {1002 return &LetExprNode{node: n}1003}1004func newModelNode(n *ast.ModelNode) *ModelNode {1005 return &ModelNode{node: n}1006}1007func newConnectionNode(n *ast.ConnectionNode) *ConnectionNode {1008 return &ConnectionNode{node: n}1009}1010func newDescriptorNode(n *ast.DescriptorNode) *DescriptorNode {1011 return &DescriptorNode{node: n}1012}1013func newSingleRowScanNode(n *ast.SingleRowScanNode) *SingleRowScanNode {1014 return &SingleRowScanNode{node: n}1015}1016func newTableScanNode(n *ast.TableScanNode) *TableScanNode {1017 return &TableScanNode{node: n}1018}1019func newJoinScanNode(n *ast.JoinScanNode) *JoinScanNode {1020 return &JoinScanNode{node: n}1021}1022func newArrayScanNode(n *ast.ArrayScanNode) *ArrayScanNode {1023 return &ArrayScanNode{node: n}1024}1025func newColumnHolderNode(n *ast.ColumnHolderNode) *ColumnHolderNode {1026 return &ColumnHolderNode{node: n}1027}1028func newFilterScanNode(n *ast.FilterScanNode) *FilterScanNode {1029 return &FilterScanNode{node: n}1030}1031func newGroupingSetNode(n *ast.GroupingSetNode) *GroupingSetNode {1032 return &GroupingSetNode{node: n}1033}1034func newAggregateScanNode(n *ast.AggregateScanNode) *AggregateScanNode {1035 return &AggregateScanNode{node: n}1036}1037func newAnonymizedAggregateScanNode(n *ast.AnonymizedAggregateScanNode) *AnonymizedAggregateScanNode {1038 return &AnonymizedAggregateScanNode{node: n}1039}1040func newSetOperationItemNode(n *ast.SetOperationItemNode) *SetOperationItemNode {1041 return &SetOperationItemNode{node: n}1042}1043func newSetOperationScanNode(n *ast.SetOperationScanNode) *SetOperationScanNode {1044 return &SetOperationScanNode{node: n}1045}1046func newOrderByScanNode(n *ast.OrderByScanNode) *OrderByScanNode {1047 return &OrderByScanNode{node: n}1048}1049func newLimitOffsetScanNode(n *ast.LimitOffsetScanNode) *LimitOffsetScanNode {1050 return &LimitOffsetScanNode{node: n}1051}1052func newWithRefScanNode(n *ast.WithRefScanNode) *WithRefScanNode {1053 return &WithRefScanNode{node: n}1054}1055func newAnalyticScanNode(n *ast.AnalyticScanNode) *AnalyticScanNode {1056 return &AnalyticScanNode{node: n}1057}1058func newSampleScanNode(n *ast.SampleScanNode) *SampleScanNode {1059 return &SampleScanNode{node: n}1060}1061func newComputedColumnNode(n *ast.ComputedColumnNode) *ComputedColumnNode {1062 return &ComputedColumnNode{node: n}1063}1064func newOrderByItemNode(n *ast.OrderByItemNode) *OrderByItemNode {1065 return &OrderByItemNode{node: n}1066}1067func newColumnAnnotationsNode(n *ast.ColumnAnnotationsNode) *ColumnAnnotationsNode {1068 return &ColumnAnnotationsNode{node: n}1069}1070func newGeneratedColumnInfoNode(n *ast.GeneratedColumnInfoNode) *GeneratedColumnInfoNode {1071 return &GeneratedColumnInfoNode{node: n}1072}1073func newColumnDefaultValueNode(n *ast.ColumnDefaultValueNode) *ColumnDefaultValueNode {1074 return &ColumnDefaultValueNode{node: n}1075}1076func newColumnDefinitionNode(n *ast.ColumnDefinitionNode) *ColumnDefinitionNode {1077 return &ColumnDefinitionNode{node: n}1078}1079func newPrimaryKeyNode(n *ast.PrimaryKeyNode) *PrimaryKeyNode {1080 return &PrimaryKeyNode{node: n}1081}1082func newForeignKeyNode(n *ast.ForeignKeyNode) *ForeignKeyNode {1083 return &ForeignKeyNode{node: n}1084}1085func newCheckConstraintNode(n *ast.CheckConstraintNode) *CheckConstraintNode {1086 return &CheckConstraintNode{node: n}1087}1088func newOutputColumnNode(n *ast.OutputColumnNode) *OutputColumnNode {1089 return &OutputColumnNode{node: n}1090}1091func newProjectScanNode(n *ast.ProjectScanNode) *ProjectScanNode {1092 return &ProjectScanNode{node: n}1093}1094func newTVFScanNode(n *ast.TVFScanNode) *TVFScanNode {1095 return &TVFScanNode{node: n}1096}1097func newGroupRowsScanNode(n *ast.GroupRowsScanNode) *GroupRowsScanNode {1098 return &GroupRowsScanNode{node: n}1099}1100func newFunctionArgumentNode(n *ast.FunctionArgumentNode) *FunctionArgumentNode {1101 return &FunctionArgumentNode{node: n}1102}1103func newExplainStmtNode(n *ast.ExplainStmtNode) *ExplainStmtNode {1104 return &ExplainStmtNode{node: n}1105}1106func newQueryStmtNode(n *ast.QueryStmtNode) *QueryStmtNode {1107 return &QueryStmtNode{node: n}1108}1109func newCreateDatabaseStmtNode(n *ast.CreateDatabaseStmtNode) *CreateDatabaseStmtNode {1110 return &CreateDatabaseStmtNode{node: n}1111}1112func newIndexItemNode(n *ast.IndexItemNode) *IndexItemNode {1113 return &IndexItemNode{node: n}1114}1115func newUnnestItemNode(n *ast.UnnestItemNode) *UnnestItemNode {1116 return &UnnestItemNode{node: n}1117}1118func newCreateIndexStmtNode(n *ast.CreateIndexStmtNode) *CreateIndexStmtNode {1119 return &CreateIndexStmtNode{node: n}1120}1121func newCreateSchemaStmtNode(n *ast.CreateSchemaStmtNode) *CreateSchemaStmtNode {1122 return &CreateSchemaStmtNode{node: n}1123}1124func newCreateTableStmtNode(n *ast.CreateTableStmtNode) *CreateTableStmtNode {1125 return &CreateTableStmtNode{node: n}1126}1127func newCreateTableAsSelectStmtNode(n *ast.CreateTableAsSelectStmtNode) *CreateTableAsSelectStmtNode {1128 return &CreateTableAsSelectStmtNode{node: n}1129}1130func newCreateModelStmtNode(n *ast.CreateModelStmtNode) *CreateModelStmtNode {1131 return &CreateModelStmtNode{node: n}1132}1133func newCreateViewStmtNode(n *ast.CreateViewStmtNode) *CreateViewStmtNode {1134 return &CreateViewStmtNode{node: n}1135}1136func newWithPartitionColumnsNode(n *ast.WithPartitionColumnsNode) *WithPartitionColumnsNode {1137 return &WithPartitionColumnsNode{node: n}1138}1139func newCreateSnapshotTableStmtNode(n *ast.CreateSnapshotTableStmtNode) *CreateSnapshotTableStmtNode {1140 return &CreateSnapshotTableStmtNode{node: n}1141}1142func newCreateExternalTableStmtNode(n *ast.CreateExternalTableStmtNode) *CreateExternalTableStmtNode {1143 return &CreateExternalTableStmtNode{node: n}1144}1145func newExportModelStmtNode(n *ast.ExportModelStmtNode) *ExportModelStmtNode {1146 return &ExportModelStmtNode{node: n}1147}1148func newExportDataStmtNode(n *ast.ExportDataStmtNode) *ExportDataStmtNode {1149 return &ExportDataStmtNode{node: n}1150}1151func newDefineTableStmtNode(n *ast.DefineTableStmtNode) *DefineTableStmtNode {1152 return &DefineTableStmtNode{node: n}1153}1154func newDescribeStmtNode(n *ast.DescribeStmtNode) *DescribeStmtNode {1155 return &DescribeStmtNode{node: n}1156}1157func newShowStmtNode(n *ast.ShowStmtNode) *ShowStmtNode {1158 return &ShowStmtNode{node: n}1159}1160func newBeginStmtNode(n *ast.BeginStmtNode) *BeginStmtNode {1161 return &BeginStmtNode{node: n}1162}1163func newSetTransactionStmtNode(n *ast.SetTransactionStmtNode) *SetTransactionStmtNode {1164 return &SetTransactionStmtNode{node: n}1165}1166func newCommitStmtNode(n *ast.CommitStmtNode) *CommitStmtNode {1167 return &CommitStmtNode{node: n}1168}1169func newRollbackStmtNode(n *ast.RollbackStmtNode) *RollbackStmtNode {1170 return &RollbackStmtNode{node: n}1171}1172func newStartBatchStmtNode(n *ast.StartBatchStmtNode) *StartBatchStmtNode {1173 return &StartBatchStmtNode{node: n}1174}1175func newRunBatchStmtNode(n *ast.RunBatchStmtNode) *RunBatchStmtNode {1176 return &RunBatchStmtNode{node: n}1177}1178func newAbortBatchStmtNode(n *ast.AbortBatchStmtNode) *AbortBatchStmtNode {1179 return &AbortBatchStmtNode{node: n}1180}1181func newDropStmtNode(n *ast.DropStmtNode) *DropStmtNode {1182 return &DropStmtNode{node: n}1183}1184func newDropMaterializedViewStmtNode(n *ast.DropMaterializedViewStmtNode) *DropMaterializedViewStmtNode {1185 return &DropMaterializedViewStmtNode{node: n}1186}1187func newDropSnapshotTableStmtNode(n *ast.DropSnapshotTableStmtNode) *DropSnapshotTableStmtNode {1188 return &DropSnapshotTableStmtNode{node: n}1189}1190func newRecursiveRefScanNode(n *ast.RecursiveRefScanNode) *RecursiveRefScanNode {1191 return &RecursiveRefScanNode{node: n}1192}1193func newRecursiveScanNode(n *ast.RecursiveScanNode) *RecursiveScanNode {1194 return &RecursiveScanNode{node: n}1195}1196func newWithScanNode(n *ast.WithScanNode) *WithScanNode {1197 return &WithScanNode{node: n}1198}1199func newWithEntryNode(n *ast.WithEntryNode) *WithEntryNode {1200 return &WithEntryNode{node: n}1201}1202func newOptionNode(n *ast.OptionNode) *OptionNode {1203 return &OptionNode{node: n}1204}1205func newWindowPartitioningNode(n *ast.WindowPartitioningNode) *WindowPartitioningNode {1206 return &WindowPartitioningNode{node: n}1207}1208func newWindowOrderingNode(n *ast.WindowOrderingNode) *WindowOrderingNode {1209 return &WindowOrderingNode{node: n}1210}1211func newWindowFrameNode(n *ast.WindowFrameNode) *WindowFrameNode {1212 return &WindowFrameNode{node: n}1213}1214func newAnalyticFunctionGroupNode(n *ast.AnalyticFunctionGroupNode) *AnalyticFunctionGroupNode {1215 return &AnalyticFunctionGroupNode{node: n}1216}1217func newWindowFrameExprNode(n *ast.WindowFrameExprNode) *WindowFrameExprNode {1218 return &WindowFrameExprNode{node: n}1219}1220func newDMLValueNode(n *ast.DMLValueNode) *DMLValueNode {1221 return &DMLValueNode{node: n}1222}1223func newDMLDefaultNode(n *ast.DMLDefaultNode) *DMLDefaultNode {1224 return &DMLDefaultNode{node: n}1225}1226func newAssertStmtNode(n *ast.AssertStmtNode) *AssertStmtNode {1227 return &AssertStmtNode{node: n}1228}1229func newAssertRowsModifiedNode(n *ast.AssertRowsModifiedNode) *AssertRowsModifiedNode {1230 return &AssertRowsModifiedNode{node: n}1231}1232func newInsertRowNode(n *ast.InsertRowNode) *InsertRowNode {1233 return &InsertRowNode{node: n}1234}1235func newInsertStmtNode(n *ast.InsertStmtNode) *InsertStmtNode {1236 return &InsertStmtNode{node: n}1237}1238func newDeleteStmtNode(n *ast.DeleteStmtNode) *DeleteStmtNode {1239 return &DeleteStmtNode{node: n}1240}1241func newUpdateItemNode(n *ast.UpdateItemNode) *UpdateItemNode {1242 return &UpdateItemNode{node: n}1243}1244func newUpdateArrayItemNode(n *ast.UpdateArrayItemNode) *UpdateArrayItemNode {1245 return &UpdateArrayItemNode{node: n}1246}1247func newUpdateStmtNode(n *ast.UpdateStmtNode) *UpdateStmtNode {1248 return &UpdateStmtNode{node: n}1249}1250func newMergeWhenNode(n *ast.MergeWhenNode) *MergeWhenNode {1251 return &MergeWhenNode{node: n}1252}1253func newMergeStmtNode(n *ast.MergeStmtNode) *MergeStmtNode {1254 return &MergeStmtNode{node: n}1255}1256func newTruncateStmtNode(n *ast.TruncateStmtNode) *TruncateStmtNode {1257 return &TruncateStmtNode{node: n}1258}1259func newObjectUnitNode(n *ast.ObjectUnitNode) *ObjectUnitNode {1260 return &ObjectUnitNode{node: n}1261}1262func newPrivilegeNode(n *ast.PrivilegeNode) *PrivilegeNode {1263 return &PrivilegeNode{node: n}1264}1265func newGrantStmtNode(n *ast.GrantStmtNode) *GrantStmtNode {1266 return &GrantStmtNode{node: n}1267}1268func newRevokeStmtNode(n *ast.RevokeStmtNode) *RevokeStmtNode {1269 return &RevokeStmtNode{node: n}1270}1271func newAlterDatabaseStmtNode(n *ast.AlterDatabaseStmtNode) *AlterDatabaseStmtNode {1272 return &AlterDatabaseStmtNode{node: n}1273}1274func newAlterMaterializedViewStmtNode(n *ast.AlterMaterializedViewStmtNode) *AlterMaterializedViewStmtNode {1275 return &AlterMaterializedViewStmtNode{node: n}1276}1277func newAlterSchemaStmtNode(n *ast.AlterSchemaStmtNode) *AlterSchemaStmtNode {1278 return &AlterSchemaStmtNode{node: n}1279}1280func newAlterTableStmtNode(n *ast.AlterTableStmtNode) *AlterTableStmtNode {1281 return &AlterTableStmtNode{node: n}1282}1283func newAlterViewStmtNode(n *ast.AlterViewStmtNode) *AlterViewStmtNode {1284 return &AlterViewStmtNode{node: n}1285}1286func newSetOptionsActionNode(n *ast.SetOptionsActionNode) *SetOptionsActionNode {1287 return &SetOptionsActionNode{node: n}1288}1289func newAddColumnActionNode(n *ast.AddColumnActionNode) *AddColumnActionNode {1290 return &AddColumnActionNode{node: n}1291}1292func newAddConstraintActionNode(n *ast.AddConstraintActionNode) *AddConstraintActionNode {1293 return &AddConstraintActionNode{node: n}1294}1295func newDropConstraintActionNode(n *ast.DropConstraintActionNode) *DropConstraintActionNode {1296 return &DropConstraintActionNode{node: n}1297}1298func newDropPrimaryKeyActionNode(n *ast.DropPrimaryKeyActionNode) *DropPrimaryKeyActionNode {1299 return &DropPrimaryKeyActionNode{node: n}1300}1301func newAlterColumnOptionsActionNode(n *ast.AlterColumnOptionsActionNode) *AlterColumnOptionsActionNode {1302 return &AlterColumnOptionsActionNode{node: n}1303}1304func newAlterColumnDropNotNullActionNode(n *ast.AlterColumnDropNotNullActionNode) *AlterColumnDropNotNullActionNode {1305 return &AlterColumnDropNotNullActionNode{node: n}1306}1307func newAlterColumnSetDataTypeActionNode(n *ast.AlterColumnSetDataTypeActionNode) *AlterColumnSetDataTypeActionNode {1308 return &AlterColumnSetDataTypeActionNode{node: n}1309}1310func newAlterColumnSetDefaultActionNode(n *ast.AlterColumnSetDefaultActionNode) *AlterColumnSetDefaultActionNode {1311 return &AlterColumnSetDefaultActionNode{node: n}1312}1313func newAlterColumnDropDefaultActionNode(n *ast.AlterColumnDropDefaultActionNode) *AlterColumnDropDefaultActionNode {1314 return &AlterColumnDropDefaultActionNode{node: n}1315}1316func newDropColumnActionNode(n *ast.DropColumnActionNode) *DropColumnActionNode {1317 return &DropColumnActionNode{node: n}1318}1319func newRenameColumnActionNode(n *ast.RenameColumnActionNode) *RenameColumnActionNode {1320 return &RenameColumnActionNode{node: n}1321}1322func newSetAsActionNode(n *ast.SetAsActionNode) *SetAsActionNode {1323 return &SetAsActionNode{node: n}1324}1325func newSetCollateClauseNode(n *ast.SetCollateClauseNode) *SetCollateClauseNode {1326 return &SetCollateClauseNode{node: n}1327}1328func newAlterTableSetOptionsStmtNode(n *ast.AlterTableSetOptionsStmtNode) *AlterTableSetOptionsStmtNode {1329 return &AlterTableSetOptionsStmtNode{node: n}1330}1331func newRenameStmtNode(n *ast.RenameStmtNode) *RenameStmtNode {1332 return &RenameStmtNode{node: n}1333}1334func newCreatePrivilegeRestrictionStmtNode(n *ast.CreatePrivilegeRestrictionStmtNode) *CreatePrivilegeRestrictionStmtNode {1335 return &CreatePrivilegeRestrictionStmtNode{node: n}1336}1337func newCreateRowAccessPolicyStmtNode(n *ast.CreateRowAccessPolicyStmtNode) *CreateRowAccessPolicyStmtNode {1338 return &CreateRowAccessPolicyStmtNode{node: n}1339}1340func newDropPrivilegeRestrictionStmtNode(n *ast.DropPrivilegeRestrictionStmtNode) *DropPrivilegeRestrictionStmtNode {1341 return &DropPrivilegeRestrictionStmtNode{node: n}1342}1343func newDropRowAccessPolicyStmtNode(n *ast.DropRowAccessPolicyStmtNode) *DropRowAccessPolicyStmtNode {1344 return &DropRowAccessPolicyStmtNode{node: n}1345}1346func newDropSearchIndexStmtNode(n *ast.DropSearchIndexStmtNode) *DropSearchIndexStmtNode {1347 return &DropSearchIndexStmtNode{node: n}1348}1349func newGrantToActionNode(n *ast.GrantToActionNode) *GrantToActionNode {1350 return &GrantToActionNode{node: n}1351}1352func newRestrictToActionNode(n *ast.RestrictToActionNode) *RestrictToActionNode {1353 return &RestrictToActionNode{node: n}1354}1355func newAddToRestricteeListActionNode(n *ast.AddToRestricteeListActionNode) *AddToRestricteeListActionNode {1356 return &AddToRestricteeListActionNode{node: n}1357}1358func newRemoveFromRestricteeListActionNode(n *ast.RemoveFromRestricteeListActionNode) *RemoveFromRestricteeListActionNode {1359 return &RemoveFromRestricteeListActionNode{node: n}1360}1361func newFilterUsingActionNode(n *ast.FilterUsingActionNode) *FilterUsingActionNode {1362 return &FilterUsingActionNode{node: n}1363}1364func newRevokeFromActionNode(n *ast.RevokeFromActionNode) *RevokeFromActionNode {1365 return &RevokeFromActionNode{node: n}1366}1367func newRenameToActionNode(n *ast.RenameToActionNode) *RenameToActionNode {1368 return &RenameToActionNode{node: n}1369}1370func newAlterPrivilegeRestrictionStmtNode(n *ast.AlterPrivilegeRestrictionStmtNode) *AlterPrivilegeRestrictionStmtNode {1371 return &AlterPrivilegeRestrictionStmtNode{node: n}1372}1373func newAlterRowAccessPolicyStmtNode(n *ast.AlterRowAccessPolicyStmtNode) *AlterRowAccessPolicyStmtNode {1374 return &AlterRowAccessPolicyStmtNode{node: n}1375}1376func newAlterAllRowAccessPoliciesStmtNode(n *ast.AlterAllRowAccessPoliciesStmtNode) *AlterAllRowAccessPoliciesStmtNode {1377 return &AlterAllRowAccessPoliciesStmtNode{node: n}1378}1379func newCreateConstantStmtNode(n *ast.CreateConstantStmtNode) *CreateConstantStmtNode {1380 return &CreateConstantStmtNode{node: n}1381}1382func newCreateFunctionStmtNode(n *ast.CreateFunctionStmtNode) *CreateFunctionStmtNode {1383 return &CreateFunctionStmtNode{node: n}1384}1385func newArgumentDefNode(n *ast.ArgumentDefNode) *ArgumentDefNode {1386 return &ArgumentDefNode{node: n}1387}1388func newArgumentRefNode(n *ast.ArgumentRefNode) *ArgumentRefNode {1389 return &ArgumentRefNode{node: n}1390}1391func newCreateTableFunctionStmtNode(n *ast.CreateTableFunctionStmtNode) *CreateTableFunctionStmtNode {1392 return &CreateTableFunctionStmtNode{node: n}1393}1394func newRelationArgumentScanNode(n *ast.RelationArgumentScanNode) *RelationArgumentScanNode {1395 return &RelationArgumentScanNode{node: n}1396}1397func newArgumentListNode(n *ast.ArgumentListNode) *ArgumentListNode {1398 return &ArgumentListNode{node: n}1399}1400func newFunctionSignatureHolderNode(n *ast.FunctionSignatureHolderNode) *FunctionSignatureHolderNode {1401 return &FunctionSignatureHolderNode{node: n}1402}1403func newDropFunctionStmtNode(n *ast.DropFunctionStmtNode) *DropFunctionStmtNode {1404 return &DropFunctionStmtNode{node: n}1405}1406func newDropTableFunctionStmtNode(n *ast.DropTableFunctionStmtNode) *DropTableFunctionStmtNode {1407 return &DropTableFunctionStmtNode{node: n}1408}1409func newCallStmtNode(n *ast.CallStmtNode) *CallStmtNode {1410 return &CallStmtNode{node: n}1411}1412func newImportStmtNode(n *ast.ImportStmtNode) *ImportStmtNode {1413 return &ImportStmtNode{node: n}1414}1415func newModuleStmtNode(n *ast.ModuleStmtNode) *ModuleStmtNode {1416 return &ModuleStmtNode{node: n}1417}1418func newAggregateHavingModifierNode(n *ast.AggregateHavingModifierNode) *AggregateHavingModifierNode {1419 return &AggregateHavingModifierNode{node: n}1420}1421func newCreateMaterializedViewStmtNode(n *ast.CreateMaterializedViewStmtNode) *CreateMaterializedViewStmtNode {1422 return &CreateMaterializedViewStmtNode{node: n}1423}1424func newCreateProcedureStmtNode(n *ast.CreateProcedureStmtNode) *CreateProcedureStmtNode {1425 return &CreateProcedureStmtNode{node: n}1426}1427func newExecuteImmediateArgumentNode(n *ast.ExecuteImmediateArgumentNode) *ExecuteImmediateArgumentNode {1428 return &ExecuteImmediateArgumentNode{node: n}1429}1430func newExecuteImmediateStmtNode(n *ast.ExecuteImmediateStmtNode) *ExecuteImmediateStmtNode {1431 return &ExecuteImmediateStmtNode{node: n}1432}1433func newAssignmentStmtNode(n *ast.AssignmentStmtNode) *AssignmentStmtNode {1434 return &AssignmentStmtNode{node: n}1435}1436func newCreateEntityStmtNode(n *ast.CreateEntityStmtNode) *CreateEntityStmtNode {1437 return &CreateEntityStmtNode{node: n}1438}1439func newAlterEntityStmtNode(n *ast.AlterEntityStmtNode) *AlterEntityStmtNode {1440 return &AlterEntityStmtNode{node: n}1441}1442func newPivotColumnNode(n *ast.PivotColumnNode) *PivotColumnNode {1443 return &PivotColumnNode{node: n}1444}1445func newPivotScanNode(n *ast.PivotScanNode) *PivotScanNode {1446 return &PivotScanNode{node: n}1447}1448func newReturningClauseNode(n *ast.ReturningClauseNode) *ReturningClauseNode {1449 return &ReturningClauseNode{node: n}1450}1451func newUnpivotArgNode(n *ast.UnpivotArgNode) *UnpivotArgNode {1452 return &UnpivotArgNode{node: n}1453}1454func newUnpivotScanNode(n *ast.UnpivotScanNode) *UnpivotScanNode {1455 return &UnpivotScanNode{node: n}1456}1457func newCloneDataStmtNode(n *ast.CloneDataStmtNode) *CloneDataStmtNode {1458 return &CloneDataStmtNode{node: n}1459}1460func newTableAndColumnInfoNode(n *ast.TableAndColumnInfoNode) *TableAndColumnInfoNode {1461 return &TableAndColumnInfoNode{node: n}1462}1463func newAnalyzeStmtNode(n *ast.AnalyzeStmtNode) *AnalyzeStmtNode {1464 return &AnalyzeStmtNode{node: n}1465}1466func newAuxLoadDataStmtNode(n *ast.AuxLoadDataStmtNode) *AuxLoadDataStmtNode {1467 return &AuxLoadDataStmtNode{node: n}1468}...

Full Screen

Full Screen

tokenizer.go

Source:tokenizer.go Github

copy

Full Screen

1// Copyright 2016 Guilherme Nemeth <guilherme.nemeth@gmail.com>2//3// Some parts of this file were taken from Go's source code,4// more specifically the functions "isLetter", "isDigit", "nextChar",5// "scanComment", "scanIdentifier", "digitVal", "scanMantissa",6// "scanNumber", "scanEscape", "scanString", "skipWhitespace".7// The copyright notice and license below apply to the specified functions.8//9// Copyright (c) 2012 The Go Authors. All rights reserved.10//11// Redistribution and use in source and binary forms, with or without12// modification, are permitted provided that the following conditions are13// met:14//15// * Redistributions of source code must retain the above copyright16// notice, this list of conditions and the following disclaimer.17// * Redistributions in binary form must reproduce the above18// copyright notice, this list of conditions and the following disclaimer19// in the documentation and/or other materials provided with the20// distribution.21// * Neither the name of Google Inc. nor the names of its22// contributors may be used to endorse or promote products derived from23// this software without specific prior written permission.24//25// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS26// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT27// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR28// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT29// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,30// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT31// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,32// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY33// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT34// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE35// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.36package parse37import (38 "fmt"39 "github.com/glhrmfrts/yo/ast"40 "os"41 "unicode"42 "unicode/utf8"43)44type tokenizer struct {45 offset int46 readOffset int47 r rune48 src []byte49 filename string50 lineno int51 insertSemi bool52 last ast.Token53}54const bom = 0xFEFF55const eof = -156func isLetter(ch rune) bool {57 return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 && unicode.IsLetter(ch)58}59func isDigit(ch rune) bool {60 return '0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch)61}62func (t *tokenizer) error(msg string) {63 fmt.Printf("%s:%d -> syntax error: %s\n", t.filename, t.lineno, msg)64 os.Exit(1)65}66func (t *tokenizer) nextChar() bool {67 if t.readOffset < len(t.src) {68 t.offset = t.readOffset69 ch := t.src[t.readOffset]70 r, w := rune(ch), 171 switch {72 case r == 0:73 t.error("illegal character NUL")74 case r >= 0x80:75 // not ASCII76 r, w = utf8.DecodeRune(t.src[t.offset:])77 if r == utf8.RuneError && w == 1 {78 t.error("illegal UTF-8 encoding")79 } else if r == bom && t.offset > 0 {80 t.error("illegal byte order mark")81 }82 }83 if ch == '\n' {84 t.lineno++85 }86 t.r = r87 t.readOffset += w88 return true89 }90 t.r = eof91 t.offset = len(t.src)92 return false93}94func (t *tokenizer) scanComment() bool {95 // initial '/' already consumed96 if t.r == '/' {97 for t.r != eof && t.r != '\n' {98 t.nextChar()99 }100 return true101 }102 return false103}104func (t *tokenizer) scanIdentifier() string {105 offs := t.offset106 for isLetter(t.r) || isDigit(t.r) {107 t.nextChar()108 }109 return string(t.src[offs:t.offset])110}111func digitVal(ch rune) int {112 switch {113 case '0' <= ch && ch <= '9':114 return int(ch - '0')115 case 'a' <= ch && ch <= 'f':116 return int(ch - 'a' + 10)117 case 'A' <= ch && ch <= 'F':118 return int(ch - 'A' + 10)119 }120 return 16121}122func (t *tokenizer) scanMantissa(base int) {123 for digitVal(t.r) < base {124 t.nextChar()125 }126}127func (t *tokenizer) scanNumber(seenDecimalPoint bool) (ast.Token, string) {128 // digitVal(t.r) < 10129 offs := t.offset130 typ := ast.TokenInt131 if seenDecimalPoint {132 typ = ast.TokenFloat133 offs--134 t.scanMantissa(10)135 goto exponent136 }137 if t.r == '0' {138 // int or float139 offs := t.offset140 t.nextChar()141 if t.r == 'x' || t.r == 'X' {142 // hexadecimal int143 t.nextChar()144 t.scanMantissa(16)145 if t.offset-offs <= 2 {146 // only scanned "0x" or "0X"147 t.error("illegal hexadecimal number")148 }149 } else {150 // octal int or float151 seenDecimalDigit := false152 t.scanMantissa(8)153 if t.r == '8' || t.r == '9' {154 // illegal octal int or float155 seenDecimalDigit = true156 t.scanMantissa(10)157 }158 if t.r == '.' || t.r == 'e' || t.r == 'E' {159 goto fraction160 }161 // octal int162 if seenDecimalDigit {163 t.error("illegal octal number")164 }165 }166 goto exit167 }168 // decimal int or float169 t.scanMantissa(10)170fraction:171 if t.r == '.' {172 typ = ast.TokenFloat173 t.nextChar()174 t.scanMantissa(10)175 }176exponent:177 if t.r == 'e' || t.r == 'E' {178 typ = ast.TokenFloat179 t.nextChar()180 if t.r == '-' || t.r == '+' {181 t.nextChar()182 }183 t.scanMantissa(10)184 }185exit:186 return typ, string(t.src[offs:t.offset])187}188// scans a valid escape sequence and returns the evaluated value189func (t *tokenizer) scanEscape(quote rune) rune {190 var n int191 var base, max uint32192 var r rune193 switch t.r {194 case 'a':195 r = '\a'196 case 'b':197 r = '\b'198 case 'f':199 r = '\f'200 case 'n':201 r = '\n'202 case 'r':203 r = '\r'204 case 't':205 r = '\t'206 case 'v':207 r = '\v'208 case '\\':209 r = '\\'210 case quote:211 r = quote212 case '0', '1', '2', '3', '4', '5', '6', '7':213 n, base, max = 3, 8, 255214 case 'x':215 t.nextChar()216 n, base, max = 2, 16, 255217 case 'u':218 t.nextChar()219 n, base, max = 4, 16, unicode.MaxRune220 case 'U':221 t.nextChar()222 n, base, max = 8, 16, unicode.MaxRune223 default:224 msg := "unknown escape sequence"225 if t.r < 0 {226 msg = "escape sequence not terminated"227 }228 t.error(msg)229 }230 if r > 0 {231 return r232 }233 var x uint32234 for n > 0 {235 d := uint32(digitVal(t.r))236 if d >= base {237 msg := fmt.Sprintf("illegal character %#U in escape sequence", t.r)238 if t.r < 0 {239 msg = "escape sequence not terminated"240 }241 t.error(msg)242 }243 x = x*base + d244 t.nextChar()245 n--246 if n == 0 && base == 16 && max == 255 && t.r == '\\' {247 rd := t.readOffset248 t.nextChar()249 if t.r == 'x' {250 n = 2251 max = unicode.MaxRune252 t.nextChar()253 } else {254 t.readOffset = rd255 }256 }257 }258 if x > max || 0xD800 <= x && x < 0xE000 {259 t.error("escape sequence is invalid Unicode code point")260 }261 return rune(x)262}263func (t *tokenizer) scanString(quote rune) string {264 var result string265 for {266 ch := t.r267 if ch < 0 {268 t.error("string literal not terminated")269 }270 t.nextChar()271 if ch == quote {272 break273 }274 if ch == '\\' {275 ch = t.scanEscape(quote)276 }277 result += string(ch)278 }279 return result280}281func (t *tokenizer) skipWhitespace() {282 for t.r == ' ' || t.r == '\t' || t.r == '\r' {283 t.nextChar()284 }285}286func (t *tokenizer) needSemi(tok ast.Token) bool {287 return (tok == ast.TokenId || tok == ast.TokenFloat || tok == ast.TokenInt || tok == ast.TokenString ||288 tok == ast.TokenBreak || tok == ast.TokenContinue || tok == ast.TokenReturn || tok == ast.TokenPanic)289}290// functions that look 1 or 2 characters ahead,291// and return the given token types based on that292func (t *tokenizer) maybe1(a ast.Token, c1 rune, t1 ast.Token) ast.Token {293 offset := t.readOffset294 t.nextChar()295 if t.r == c1 {296 return t1297 }298 t.readOffset = offset299 return a300}301func (t *tokenizer) maybe2(a ast.Token, c1 rune, t1 ast.Token, c2 rune, t2 ast.Token) ast.Token {302 offset := t.readOffset303 t.nextChar()304 if t.r == c1 {305 return t1306 }307 if t.r == c2 {308 return t2309 }310 t.readOffset = offset311 return a312}313func (t *tokenizer) maybe3(a ast.Token, c1 rune, t1 ast.Token, c2 rune, t2 ast.Token, c3 rune, t3 ast.Token) ast.Token {314 offset := t.readOffset315 t.nextChar()316 if t.r == c1 {317 return t1318 }319 if t.r == c2 {320 return t2321 }322 if t.r == c3 {323 return t3324 }325 t.readOffset = offset326 return a327}328// does the actual scanning and return the type of the token329// and a literal string representing it330func (t *tokenizer) scan() (ast.Token, string) {331 t.skipWhitespace()332 switch ch := t.r; {333 case isLetter(t.r):334 lit := t.scanIdentifier()335 kwtype, ok := ast.Keyword(lit)336 if ok {337 return kwtype, lit338 }339 return ast.TokenId, lit340 case isDigit(t.r):341 return t.scanNumber(false)342 case t.r == '\'' || t.r == '"':343 t.nextChar()344 return ast.TokenString, t.scanString(ch)345 default:346 if t.r == '/' {347 t.nextChar()348 if t.scanComment() {349 return t.nextToken()350 }351 if t.r == '=' {352 t.nextChar()353 return ast.TokenDiveq, "/="354 }355 return ast.TokenDiv, "/"356 }357 tok := ast.Token(-1)358 offs := t.offset359 switch t.r {360 case '\n':361 tok = ast.TokenNewline362 case '+':363 tok = t.maybe2(ast.TokenPlus, '=', ast.TokenPluseq, '+', ast.TokenPlusplus)364 case '-':365 tok = t.maybe3(ast.TokenMinus, '=', ast.TokenMinuseq, '-', ast.TokenMinusminus, '>', ast.TokenMinusgt)366 case '*':367 tok = t.maybe2(ast.TokenTimes, '=', ast.TokenTimeseq, '*', ast.TokenTimestimes)368 case '%':369 tok = ast.TokenMod370 case '&':371 tok = t.maybe2(ast.TokenAmp, '=', ast.TokenAmpeq, '&', ast.TokenAmpamp)372 case '|':373 tok = t.maybe2(ast.TokenPipe, '=', ast.TokenPipeeq, '|', ast.TokenPipepipe)374 case '^':375 tok = t.maybe1(ast.TokenTilde, '=', ast.TokenTildeeq)376 case '<':377 tok = t.maybe2(ast.TokenLt, '=', ast.TokenLteq, '<', ast.TokenLtlt)378 case '>':379 tok = t.maybe2(ast.TokenGt, '=', ast.TokenGteq, '>', ast.TokenGtgt)380 case '=':381 tok = t.maybe1(ast.TokenEq, '=', ast.TokenEqeq)382 case ':':383 tok = t.maybe1(ast.TokenColon, '=', ast.TokenColoneq)384 case ';':385 tok = ast.TokenSemicolon386 case ',':387 tok = ast.TokenComma388 case '!':389 tok = t.maybe1(ast.TokenBang, '=', ast.TokenBangeq)390 case '?':391 tok = ast.TokenQuestion392 case '(':393 tok = ast.TokenLparen394 case ')':395 tok = ast.TokenRparen396 case '[':397 tok = ast.TokenLbrack398 case ']':399 tok = ast.TokenRbrack400 case '{':401 tok = ast.TokenLbrace402 case '}':403 tok = ast.TokenRbrace404 case '.':405 t.nextChar()406 if isDigit(t.r) {407 return t.scanNumber(true)408 } else if t.r == '.' {409 t.nextChar()410 if t.r == '.' {411 t.nextChar()412 return ast.TokenDotdotdot, "..."413 }414 } else {415 return ast.TokenDot, "."416 }417 }418 if tok != eof {419 t.nextChar()420 return tok, string(t.src[offs:t.offset])421 }422 }423 if t.offset >= len(t.src) {424 return ast.TokenEos, "end"425 }426 fmt.Print(string(t.r))427 return ast.TokenIllegal, ""428}429func (t *tokenizer) nextToken() (ast.Token, string) {430 if t.insertSemi {431 t.insertSemi = false432 t.last = ast.TokenSemicolon433 return ast.TokenSemicolon, ";"434 }435 tok, literal := t.scan()436 if tok == ast.TokenNewline && t.needSemi(t.last) {437 t.insertSemi = true438 }439 t.last = tok440 return tok, literal441}442func (t *tokenizer) init(source []byte, filename string) {443 t.src = source444 t.filename = filename445 t.lineno = 1446 // fetch the first char447 t.nextChar()448}...

Full Screen

Full Screen

advise_impl.go

Source:advise_impl.go Github

copy

Full Screen

...27type Target struct {28 DatabaseName string29 TableName string30 Field string31 AvgScanNum float6432}33func GetAvgScanNum(r *ResultSetAdvise, databaseName string, tableName string, field string) (float64, error) {34 rowCount, err := r.getRowCount(databaseName, tableName)35 if err != nil {36 return 0, errors.Trace(err)37 }38 disCount, err := r.getDistinctCount(databaseName, tableName, field)39 if err != nil {40 return 0, errors.Trace(err)41 }42 log.Info("GetAvgScanNum",43 zap.Int64("rowCount", rowCount),44 zap.Int64("disCount", disCount))45 if disCount == 0 {46 return math.MaxFloat64, nil47 }48 return float64(rowCount / disCount), nil49 //return 1, nil50}51func GetIndexAdviser(r *ResultSetAdvise, adviseVisitor *AdviseVisitor) ([]Target, []string, error) {52 var targetList []Target53 tableName := adviseVisitor.tableName54 for _, enode := range adviseVisitor.whereExpr {55 fieldName := enode.(*ast.BinaryOperationExpr).L.(*ast.ColumnNameExpr).Name.Name.O56 avgScanNum, err := GetAvgScanNum(r, adviseVisitor.databaseName, tableName, fieldName)57 if err != nil {58 return nil, nil, errors.Trace(err)59 }60 if avgScanNum < SingleIndexThreshold {61 if enode.(*ast.BinaryOperationExpr).Op != opcode.EQ {62 avgScanNum += 30000063 }64 targetList = append(targetList, Target{65 DatabaseName: adviseVisitor.databaseName,66 TableName: tableName,67 Field: fieldName,68 AvgScanNum: avgScanNum,69 })70 } else if avgScanNum >= SingleIndexThreshold && avgScanNum < MutiIndexThreshold {71 if enode.(*ast.BinaryOperationExpr).Op != opcode.EQ {72 avgScanNum += 30000073 }74 targetList = append(targetList, Target{75 DatabaseName: adviseVisitor.databaseName,76 TableName: tableName,77 Field: fieldName,78 AvgScanNum: avgScanNum})79 } else {80 continue81 }82 }83 if len(adviseVisitor.groupByField) != 0 {84 for _, field := range adviseVisitor.groupByField {85 avgScanNum, err := GetAvgScanNum(r, adviseVisitor.databaseName, tableName, field)86 if err != nil {87 return nil, nil, errors.Trace(err)88 }89 if avgScanNum < SingleIndexThreshold {90 avgScanNum += 10000091 targetList = append(targetList, Target{92 DatabaseName: adviseVisitor.databaseName,93 TableName: tableName,94 Field: field, AvgScanNum: avgScanNum})95 } else if avgScanNum >= SingleIndexThreshold && avgScanNum < MutiIndexThreshold {96 avgScanNum += 10000097 targetList = append(targetList, Target{98 DatabaseName: adviseVisitor.databaseName,99 TableName: tableName,100 Field: field, AvgScanNum: avgScanNum})101 } else {102 panic("2222")103 }104 }105 }106 if len(adviseVisitor.orderByInfo) != 0 {107 sum := 1108 for _, info := range adviseVisitor.orderByInfo {109 if info.OrderByDesc {110 sum++111 }112 }113 if sum != len(adviseVisitor.orderByInfo) {114 return targetList, nil, nil115 }116 for _, info := range adviseVisitor.orderByInfo {117 for _, v := range info.OrderByField {118 log.Info("order field",zap.String("f",v))119 avgScanNum, err := GetAvgScanNum(r, adviseVisitor.databaseName, tableName, v)120 if err != nil {121 return nil, nil, errors.Trace(err)122 }123 if avgScanNum < SingleIndexThreshold {124 avgScanNum += 200000125 targetList = append(targetList, Target{126 DatabaseName: adviseVisitor.databaseName,127 TableName: tableName, Field: v, AvgScanNum: avgScanNum})128 } else if avgScanNum >= SingleIndexThreshold && avgScanNum < MutiIndexThreshold {129 avgScanNum += 200000130 targetList = append(targetList, Target{131 DatabaseName: adviseVisitor.databaseName,132 TableName: tableName, Field: v, AvgScanNum: avgScanNum})133 } else {134 panic("2222")135 }136 }137 }138 }139 return targetList, nil, nil140}141type tname struct {142 d string143 t string144 f string145}146func advise(r *ResultSetAdvise, defaultDatabase string, stmt *ast.SelectStmt) ([]string, error) {147 v := &AdviseVisitor{148 defaultDatabase: defaultDatabase,149 }150 stmt.Accept(v)151 tlist, _, err := GetIndexAdviser(r, v)152 if err != nil {153 return nil, err154 }155 rm := make(map[tname]float64)156 for _, t := range tlist {157 dt := tname{t.DatabaseName, t.TableName, t.Field}158 if rr, ok := rm[dt]; ok {159 if rr > t.AvgScanNum {160 rm[dt] = t.AvgScanNum161 }162 } else {163 rm[dt] = t.AvgScanNum164 }165 }166 var result []Target167 for k, v := range rm {168 result = append(result, Target{DatabaseName: k.d, TableName: k.t, Field: k.f, AvgScanNum: v})169 }170 sort.Slice(result, func(i, j int) bool {171 return result[i].AvgScanNum < result[j].AvgScanNum172 })173 log.Info("advise", zap.Reflect("result", result))174 resultMap := make(map[tname][]Target)175 for _, r := range result {176 k := tname{d: r.DatabaseName, t: r.TableName}177 if v, ok := resultMap[k]; ok {178 if len(v) > 0 && r.AvgScanNum >= 300000 {179 avg := v[len(v)-1].AvgScanNum180 if avg >= 200000 && avg < 300000 {181 continue182 }183 }184 if len(v) <= 3 {185 v = append(v, r)186 resultMap[k] = v187 }188 } else {189 resultMap[k] = []Target{r}190 }191 }192 var rstr []string193 for _, v := range resultMap {...

Full Screen

Full Screen

Scan

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 f, err := parser.ParseFile(fset, "1.go", nil, parser.ParseComments)4 if err != nil {5 fmt.Println(err)6 }7 ast.Print(fset, f)8 for _, cg := range f.Comments {9 fmt.Println(cg.List)10 }11}12import (13func main() {14 f, err := parser.ParseFile(fset, "1.go", nil, parser.ParseComments)15 if err != nil {16 fmt.Println(err)17 }18 ast.Print(fset, f)19 for _, cg := range f.Comments {20 fmt.Println(cg.List)21 }22}23import (24func main() {25 f, err := parser.ParseFile(fset, "1.go", nil, parser.ParseComments)26 if err != nil {27 fmt.Println(err)28 }29 ast.Print(fset, f)30 for _, cg := range f.Comments {31 fmt.Println(cg.List)32 }33}34import (35func main() {36 f, err := parser.ParseFile(fset, "1.go", nil, parser.ParseComments)37 if err != nil {38 fmt.Println(err)39 }

Full Screen

Full Screen

Scan

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 f, err := parser.ParseFile(fset, "1.go", nil, parser.ParseComments)4 if err != nil {5 fmt.Println(err)6 }7 ast.Print(fset, f)8}9import (10func main() {11 f, err := parser.ParseFile(fset, "1.go", nil, parser.ParseComments)12 if err != nil {13 fmt.Println(err)14 }15 ast.Print(fset, f)16}17import (18func main() {19 f, err := parser.ParseFile(fset, "1.go", nil, parser.ParseComments)20 if err != nil {21 fmt.Println(err)22 }23 ast.Print(fset, f)24}25import (26func main() {27 f, err := parser.ParseFile(fset, "1.go", nil, parser.ParseComments)28 if err != nil {29 fmt.Println(err)30 }31 ast.Print(fset, f)32}33import (34func main() {

Full Screen

Full Screen

Scan

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 f, err := parser.ParseFile(fset, "2.go", nil, parser.ParseComments)4 if err != nil {5 log.Fatal(err)6 }7 for _, s := range f.Imports {8 fmt.Println(s.Path.Value)9 }10}11import (12func main() {13 f, err := parser.ParseFile(fset, "2.go", nil, parser.ParseComments)14 if err != nil {15 log.Fatal(err)16 }17 for _, s := range f.Imports {18 fmt.Println(s.Path.Value)19 }20}21import (22func main() {23 f, err := parser.ParseFile(fset, "3.go", nil, parser.ParseComments)24 if err != nil {25 log.Fatal(err)26 }27 for _, s := range f.Imports {28 fmt.Println(s.Path.Value)29 }30}31import (32func main() {33 f, err := parser.ParseFile(fset, "3.go", nil, parser.ParseComments)34 if err != nil {35 log.Fatal(err)36 }37 for _, s := range f.Imports {

Full Screen

Full Screen

Scan

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fset := token.NewFileSet()4 node, err := parser.ParseFile(fset, "test.go", nil, 0)5 if err != nil {6 fmt.Printf("Error parsing file: %s7 }8 ast.Inspect(node, func(n ast.Node) bool {9 switch x := n.(type) {10 fmt.Println("Function declaration:", x.Name.Name)11 fmt.Println("Identifier:", x.Name)12 }13 })14}

Full Screen

Full Screen

Scan

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fset := token.NewFileSet()4 node, _ := parser.ParseFile(fset, "2.go", nil, 0)5 ast.Inspect(node, func(n ast.Node) bool {6 switch x := n.(type) {7 fmt.Printf("%s: %s8", fset.Position(x.Pos()), x.Name)9 fmt.Printf("%s: %s10", fset.Position(x.Pos()), x.Value)11 }12 })13}

Full Screen

Full Screen

Scan

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 node, _ := parser.ParseFile(fset, "1.go", nil, 0)4 ast.Inspect(node, func(n ast.Node) bool {5 switch x := n.(type) {6 fmt.Println(x.Name)7 }8 })9}10import (11func main() {12 node, _ := parser.ParseFile(fset, "1.go", nil, 0)13 ast.Inspect(node, func(n ast.Node) bool {14 switch x := n.(type) {15 fmt.Println(x.Name)16 }17 })18}19import (20func main() {21 node, _ := parser.ParseFile(fset, "1.go", nil, 0)22 ast.Inspect(node, func(n ast.Node) bool {23 switch x := n.(type) {24 fmt.Println(x.Name)25 }26 })27}28import (29func main() {30 node, _ := parser.ParseFile(fset, "1.go", nil, 0)31 ast.Inspect(node, func(n ast.Node) bool {

Full Screen

Full Screen

Scan

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fset := token.NewFileSet()4 f, err := parser.ParseFile(fset, "1.go", nil, 0)5 if err != nil {6 panic(err)7 }8 scanner := ast.NewScanner(f)9 for {10 tok, pos, lit := scanner.Scan()11 if tok == token.EOF {12 }13 fmt.Printf("%s\t%s\t%s14 }15}16import (17func main() {18 fset := token.NewFileSet()19 f, err := parser.ParseFile(fset, "1.go", nil, 0)20 if err != nil {21 panic(err)22 }23 scanner := ast.NewScanner(f)24 ast.Walk(scanner, f)25}26import (27func main() {28 fset := token.NewFileSet()29 f, err := parser.ParseFile(fset, "1.go", nil, 0)30 if err != nil {31 panic(err)32 }33 scanner := ast.NewScanner(f)34 ast.Walk(scanner, f)35}36import (37func main() {38 fset := token.NewFileSet()39 f, err := parser.ParseFile(fset, "1.go", nil, 0)

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful