├── .github └── workflows │ ├── image_push.yml │ └── maven_test.yml ├── .gitignore ├── LICENSE ├── README.md ├── checkstyle └── checkstyle.xml ├── docs ├── Architecture.png ├── Idea.md ├── QuickStart.md ├── VtDriver.png ├── VtDriver支持的SQL.md ├── VtDriver适配.md ├── architecture.en.png ├── lombok.png ├── preheat.md ├── properties.md ├── proto_2.png ├── readme.en.md └── splitTable.md ├── pom.xml ├── proto ├── pom.xml └── src │ └── main │ └── proto │ ├── README.md │ ├── automation.proto │ ├── automationservice.proto │ ├── binlogdata.proto │ ├── binlogservice.proto │ ├── logutil.proto │ ├── mysqlctl.proto │ ├── query.proto │ ├── queryservice.proto │ ├── replicationdata.proto │ ├── tableacl.proto │ ├── tabletmanagerdata.proto │ ├── tabletmanagerservice.proto │ ├── throttlerdata.proto │ ├── throttlerservice.proto │ ├── topodata.proto │ ├── vschema.proto │ ├── vtctldata.proto │ ├── vtctlservice.proto │ ├── vtgate.proto │ ├── vtgateservice.proto │ ├── vtrpc.proto │ ├── vttest.proto │ ├── vttime.proto │ ├── vtworkerdata.proto │ ├── vtworkerservice.proto │ └── workflow.proto ├── src ├── main │ ├── java │ │ ├── binlogdata │ │ │ └── Binlogdata.java │ │ ├── com │ │ │ └── jd │ │ │ │ └── jdbc │ │ │ │ ├── Executor.java │ │ │ │ ├── IExecute.java │ │ │ │ ├── VSchemaManager.java │ │ │ │ ├── VcursorImpl.java │ │ │ │ ├── api │ │ │ │ ├── VtApiServer.java │ │ │ │ ├── VtApiServerResponse.java │ │ │ │ ├── VtApiStatusResponse.java │ │ │ │ ├── VtHttpHandler.java │ │ │ │ └── handler │ │ │ │ │ ├── VtStatusHandler.java │ │ │ │ │ └── VtVschemaRefreshHandler.java │ │ │ │ ├── common │ │ │ │ ├── Constant.java │ │ │ │ ├── Hex.java │ │ │ │ ├── tuple │ │ │ │ │ ├── ImmutablePair.java │ │ │ │ │ ├── ImmutableTriple.java │ │ │ │ │ ├── MutablePair.java │ │ │ │ │ ├── MutableTriple.java │ │ │ │ │ ├── Pair.java │ │ │ │ │ └── Triple.java │ │ │ │ └── util │ │ │ │ │ ├── CollectionUtils.java │ │ │ │ │ ├── Crc32Utill.java │ │ │ │ │ └── MapUtil.java │ │ │ │ ├── concurrency │ │ │ │ ├── AllErrorRecorder.java │ │ │ │ └── ErrorRecorder.java │ │ │ │ ├── context │ │ │ │ ├── IContext.java │ │ │ │ ├── PlanningContext.java │ │ │ │ ├── VtBackgroundContext.java │ │ │ │ ├── VtCancelContext.java │ │ │ │ ├── VtContext.java │ │ │ │ ├── VtContextConstant.java │ │ │ │ └── VtDeadlineContext.java │ │ │ │ ├── discovery │ │ │ │ ├── HealthCheck.java │ │ │ │ ├── SecurityCenter.java │ │ │ │ ├── TabletHealthCheck.java │ │ │ │ ├── TopologyWatcher.java │ │ │ │ └── TopologyWatcherManager.java │ │ │ │ ├── engine │ │ │ │ ├── AbstractMultiQueryEngine.java │ │ │ │ ├── AbstractRouteEngine.java │ │ │ │ ├── BasePrimitiveEngine.java │ │ │ │ ├── ConcatenateEngine.java │ │ │ │ ├── DMLEngine.java │ │ │ │ ├── DMLOpcode.java │ │ │ │ ├── DeleteEngine.java │ │ │ │ ├── Engine.java │ │ │ │ ├── InsertEngine.java │ │ │ │ ├── JoinEngine.java │ │ │ │ ├── LimitEngine.java │ │ │ │ ├── LimitStream.java │ │ │ │ ├── MemorySortEngine.java │ │ │ │ ├── MemorySortStream.java │ │ │ │ ├── MultiQueryEngine.java │ │ │ │ ├── OrderByParams.java │ │ │ │ ├── OrderedAggregateEngine.java │ │ │ │ ├── Plan.java │ │ │ │ ├── PrimitiveEngine.java │ │ │ │ ├── ProjectionEngine.java │ │ │ │ ├── PulloutSubqueryEngine.java │ │ │ │ ├── RouteEngine.java │ │ │ │ ├── RouteStream.java │ │ │ │ ├── SendEngine.java │ │ │ │ ├── SetEngine.java │ │ │ │ ├── SingleRowEngine.java │ │ │ │ ├── SubQueryEngine.java │ │ │ │ ├── TableShardQuery.java │ │ │ │ ├── UpdateEngine.java │ │ │ │ ├── Vcursor.java │ │ │ │ ├── gen4 │ │ │ │ │ ├── AbstractAggregateGen4.java │ │ │ │ │ ├── CheckCol.java │ │ │ │ │ ├── ConcatenateGen4Engine.java │ │ │ │ │ ├── DistinctGen4Engine.java │ │ │ │ │ ├── FilterGen4Engine.java │ │ │ │ │ ├── GroupByParams.java │ │ │ │ │ ├── JoinGen4Engine.java │ │ │ │ │ ├── LimitGen4Engine.java │ │ │ │ │ ├── MemorySortGen4Engine.java │ │ │ │ │ ├── OrderByParamsGen4.java │ │ │ │ │ ├── OrderedAggregateGen4Engine.java │ │ │ │ │ ├── ProbeTable.java │ │ │ │ │ ├── RouteGen4Engine.java │ │ │ │ │ ├── RoutingParameters.java │ │ │ │ │ ├── ScalarAggregateGen4Engine.java │ │ │ │ │ ├── SimpleConverterLookup.java │ │ │ │ │ ├── SimpleProjectionGen4Engine.java │ │ │ │ │ ├── VindexLookup.java │ │ │ │ │ └── VitessCompare.java │ │ │ │ ├── sequence │ │ │ │ │ ├── Generate.java │ │ │ │ │ └── SequenceCache.java │ │ │ │ └── table │ │ │ │ │ ├── TableDMLEngine.java │ │ │ │ │ ├── TableDeleteEngine.java │ │ │ │ │ ├── TableEngine.java │ │ │ │ │ ├── TableInsertEngine.java │ │ │ │ │ ├── TableQueryEngine.java │ │ │ │ │ ├── TableRouteEngine.java │ │ │ │ │ └── TableUpdateEngine.java │ │ │ │ ├── evalengine │ │ │ │ ├── Arithmetic.java │ │ │ │ ├── Comparisons.java │ │ │ │ ├── EvalEngine.java │ │ │ │ ├── EvalResult.java │ │ │ │ ├── Logical.java │ │ │ │ ├── Simplify.java │ │ │ │ └── TranslationLookup.java │ │ │ │ ├── exception │ │ │ │ └── SQLExceptionTranslator.java │ │ │ │ ├── key │ │ │ │ ├── BinaryHashUtil.java │ │ │ │ ├── Bytes.java │ │ │ │ ├── CurrentShard.java │ │ │ │ ├── Destination.java │ │ │ │ ├── DestinationAllShard.java │ │ │ │ ├── DestinationAnyShard.java │ │ │ │ ├── DestinationKeyspaceID.java │ │ │ │ ├── DestinationNone.java │ │ │ │ ├── DestinationResolve.java │ │ │ │ ├── DestinationShard.java │ │ │ │ ├── Key.java │ │ │ │ ├── Shard.java │ │ │ │ ├── ShardEnum.java │ │ │ │ ├── StandardShard.java │ │ │ │ ├── Strings.java │ │ │ │ └── Uint64key.java │ │ │ │ ├── monitor │ │ │ │ ├── ConnectionCollector.java │ │ │ │ ├── DefaultConfig.java │ │ │ │ ├── HealthCheckCollector.java │ │ │ │ ├── HealthyCollector.java │ │ │ │ ├── MonitorServer.java │ │ │ │ ├── PlanCollector.java │ │ │ │ ├── PortCollector.java │ │ │ │ ├── QueryServiceCollector.java │ │ │ │ ├── SplitTableUtilCollector.java │ │ │ │ ├── SqlErrorCollector.java │ │ │ │ ├── SqlErrorRecorder.java │ │ │ │ ├── SrvKeyspaceCollector.java │ │ │ │ ├── StatementCollector.java │ │ │ │ ├── ThreadPoolCollector.java │ │ │ │ ├── TopoServerCollector.java │ │ │ │ ├── TopologyCollector.java │ │ │ │ ├── VersionCollector.java │ │ │ │ └── discovery │ │ │ │ │ ├── HeartBeatReport.java │ │ │ │ │ └── ResultDTO.java │ │ │ │ ├── planbuilder │ │ │ │ ├── AbstractRoutePlan.java │ │ │ │ ├── Builder.java │ │ │ │ ├── BuilderImpl.java │ │ │ │ ├── Column.java │ │ │ │ ├── ConcatenatePlan.java │ │ │ │ ├── DMLPlan.java │ │ │ │ ├── DeletePlan.java │ │ │ │ ├── InsertPlan.java │ │ │ │ ├── JoinPlan.java │ │ │ │ ├── Jointab.java │ │ │ │ ├── LimitPlan.java │ │ │ │ ├── MemorySortPlan.java │ │ │ │ ├── MergeSortPlan.java │ │ │ │ ├── MultiQueryPlan.java │ │ │ │ ├── OrderedAggregatePlan.java │ │ │ │ ├── PlanBuilder.java │ │ │ │ ├── PrimitiveBuilder.java │ │ │ │ ├── PulloutSubqueryPlan.java │ │ │ │ ├── ResultColumn.java │ │ │ │ ├── ResultsBuilder.java │ │ │ │ ├── RoutePlan.java │ │ │ │ ├── SetPlan.java │ │ │ │ ├── SubqueryPlan.java │ │ │ │ ├── Symtab.java │ │ │ │ ├── Truncater.java │ │ │ │ ├── UpdatePlan.java │ │ │ │ ├── gen4 │ │ │ │ │ ├── AggregationPushing.java │ │ │ │ │ ├── Gen4Planner.java │ │ │ │ │ ├── HorizonPlanning.java │ │ │ │ │ ├── InnerJoin.java │ │ │ │ │ ├── IntroducesTable.java │ │ │ │ │ ├── Offsets.java │ │ │ │ │ ├── PlanVisitor.java │ │ │ │ │ ├── PostProcess.java │ │ │ │ │ ├── ProjectionPushing.java │ │ │ │ │ ├── QueryProjection.java │ │ │ │ │ ├── QueryTable.java │ │ │ │ │ ├── Rewriter.java │ │ │ │ │ ├── SingleShardedShortcut.java │ │ │ │ │ ├── SortedIterator.java │ │ │ │ │ ├── TableName.java │ │ │ │ │ ├── logical │ │ │ │ │ │ ├── AbstractGen4Plan.java │ │ │ │ │ │ ├── ConcatenateGen4Plan.java │ │ │ │ │ │ ├── DistinctGen4Plan.java │ │ │ │ │ │ ├── FilterGen4Plan.java │ │ │ │ │ │ ├── HashJoinPlan.java │ │ │ │ │ │ ├── JoinGen4Plan.java │ │ │ │ │ │ ├── LimitGen4Plan.java │ │ │ │ │ │ ├── LogicalPlan.java │ │ │ │ │ │ ├── LogicalPlanCommon.java │ │ │ │ │ │ ├── MemorySortGen4Plan.java │ │ │ │ │ │ ├── OrderedAggregateGen4Plan.java │ │ │ │ │ │ ├── ProjectionGen4Plan.java │ │ │ │ │ │ ├── ResultsBuilder.java │ │ │ │ │ │ ├── RouteGen4Plan.java │ │ │ │ │ │ └── SimpleProjectionGen4Plan.java │ │ │ │ │ └── operator │ │ │ │ │ │ ├── Operator.java │ │ │ │ │ │ ├── OperatorFuncs.java │ │ │ │ │ │ ├── OperatorToQuery.java │ │ │ │ │ │ ├── OperatorTransformers.java │ │ │ │ │ │ ├── OperatorUtil.java │ │ │ │ │ │ ├── logical │ │ │ │ │ │ ├── Concatenate.java │ │ │ │ │ │ ├── Derived.java │ │ │ │ │ │ ├── Filter.java │ │ │ │ │ │ ├── Join.java │ │ │ │ │ │ ├── LogicalOperator.java │ │ │ │ │ │ ├── QueryGraph.java │ │ │ │ │ │ ├── SubQuery.java │ │ │ │ │ │ └── Update.java │ │ │ │ │ │ └── physical │ │ │ │ │ │ ├── ApplyJoin.java │ │ │ │ │ │ ├── Cost.java │ │ │ │ │ │ ├── Filter.java │ │ │ │ │ │ ├── OpCache.java │ │ │ │ │ │ ├── PhysicalOperator.java │ │ │ │ │ │ ├── Route.java │ │ │ │ │ │ ├── RoutePlanning.java │ │ │ │ │ │ ├── Table.java │ │ │ │ │ │ ├── TableSetPair.java │ │ │ │ │ │ ├── Union.java │ │ │ │ │ │ ├── VindexOption.java │ │ │ │ │ │ └── VindexPlusPredicates.java │ │ │ │ ├── semantics │ │ │ │ │ ├── Analyzer.java │ │ │ │ │ ├── Binder.java │ │ │ │ │ ├── Certain.java │ │ │ │ │ ├── ColumnInfo.java │ │ │ │ │ ├── ColumnName.java │ │ │ │ │ ├── Dependencies.java │ │ │ │ │ ├── Dependency.java │ │ │ │ │ ├── DerivedTable.java │ │ │ │ │ ├── EarlyRewriter.java │ │ │ │ │ ├── Exception.java │ │ │ │ │ ├── ExprDependencies.java │ │ │ │ │ ├── LargeTableSet.java │ │ │ │ │ ├── Nothing.java │ │ │ │ │ ├── Originable.java │ │ │ │ │ ├── RealTable.java │ │ │ │ │ ├── SQLObjectExpr.java │ │ │ │ │ ├── SchemaInformation.java │ │ │ │ │ ├── Scope.java │ │ │ │ │ ├── Scoper.java │ │ │ │ │ ├── SemTable.java │ │ │ │ │ ├── TableCollector.java │ │ │ │ │ ├── TableInfo.java │ │ │ │ │ ├── TableSet.java │ │ │ │ │ ├── Type.java │ │ │ │ │ ├── Typer.java │ │ │ │ │ ├── Uncertain.java │ │ │ │ │ ├── VSchema.java │ │ │ │ │ ├── VTableInfo.java │ │ │ │ │ ├── VindexTable.java │ │ │ │ │ └── Vtable.java │ │ │ │ └── tableplan │ │ │ │ │ ├── TableDMLPlan.java │ │ │ │ │ └── TableRoutePlan.java │ │ │ │ ├── pool │ │ │ │ ├── ExecuteResult.java │ │ │ │ ├── HikariUtil.java │ │ │ │ ├── InnerConnection.java │ │ │ │ ├── InnerConnectionConstant.java │ │ │ │ ├── Numbered.java │ │ │ │ ├── StatefulConnection.java │ │ │ │ └── StatefulConnectionPool.java │ │ │ │ ├── queryservice │ │ │ │ ├── AbstractQueryService.java │ │ │ │ ├── AbstractTabletQueryService.java │ │ │ │ ├── AsyncQueryService.java │ │ │ │ ├── BlockingQueryService.java │ │ │ │ ├── CombinedQueryService.java │ │ │ │ ├── IHealthCheckQueryService.java │ │ │ │ ├── IInner.java │ │ │ │ ├── IParentQueryService.java │ │ │ │ ├── IQueryService.java │ │ │ │ ├── NativeQueryService.java │ │ │ │ ├── QueryService.java │ │ │ │ ├── RetryTabletQueryService.java │ │ │ │ ├── RoleType.java │ │ │ │ ├── ShardQueryService.java │ │ │ │ ├── StreamIterator.java │ │ │ │ ├── TabletDialer.java │ │ │ │ ├── TabletQueryService.java │ │ │ │ ├── VtIterator.java │ │ │ │ └── util │ │ │ │ │ ├── RoleUtils.java │ │ │ │ │ └── VtResultSetUtils.java │ │ │ │ ├── session │ │ │ │ ├── CommitOrder.java │ │ │ │ ├── SafeSession.java │ │ │ │ ├── ShardSession.java │ │ │ │ ├── TransactionMode.java │ │ │ │ └── VitessSession.java │ │ │ │ ├── spring │ │ │ │ └── VitessDataSourceInitializingBean.java │ │ │ │ ├── sqlparser │ │ │ │ ├── ASTUtils.java │ │ │ │ ├── Comment.java │ │ │ │ ├── SQLUtils.java │ │ │ │ ├── SqlParser.java │ │ │ │ ├── ast │ │ │ │ │ ├── SQLArgument.java │ │ │ │ │ ├── SQLArrayDataType.java │ │ │ │ │ ├── SQLCommentHint.java │ │ │ │ │ ├── SQLDataType.java │ │ │ │ │ ├── SQLDataTypeImpl.java │ │ │ │ │ ├── SQLDeclareItem.java │ │ │ │ │ ├── SQLExpr.java │ │ │ │ │ ├── SQLExprImpl.java │ │ │ │ │ ├── SQLHint.java │ │ │ │ │ ├── SQLKeep.java │ │ │ │ │ ├── SQLLimit.java │ │ │ │ │ ├── SQLMapDataType.java │ │ │ │ │ ├── SQLName.java │ │ │ │ │ ├── SQLObject.java │ │ │ │ │ ├── SQLObjectImpl.java │ │ │ │ │ ├── SQLObjectWithDataType.java │ │ │ │ │ ├── SQLOrderBy.java │ │ │ │ │ ├── SQLOrderingSpecification.java │ │ │ │ │ ├── SQLOver.java │ │ │ │ │ ├── SQLParameter.java │ │ │ │ │ ├── SQLPartition.java │ │ │ │ │ ├── SQLPartitionBy.java │ │ │ │ │ ├── SQLPartitionByHash.java │ │ │ │ │ ├── SQLPartitionByList.java │ │ │ │ │ ├── SQLPartitionByRange.java │ │ │ │ │ ├── SQLPartitionValue.java │ │ │ │ │ ├── SQLRecordDataType.java │ │ │ │ │ ├── SQLReplaceable.java │ │ │ │ │ ├── SQLSetQuantifier.java │ │ │ │ │ ├── SQLStatement.java │ │ │ │ │ ├── SQLStatementImpl.java │ │ │ │ │ ├── SQLStructDataType.java │ │ │ │ │ ├── SQLSubPartition.java │ │ │ │ │ ├── SQLSubPartitionBy.java │ │ │ │ │ ├── SQLSubPartitionByHash.java │ │ │ │ │ ├── SQLSubPartitionByList.java │ │ │ │ │ ├── SQLSubPartitionByRange.java │ │ │ │ │ ├── SQLWindow.java │ │ │ │ │ ├── expr │ │ │ │ │ │ ├── SQLAggregateExpr.java │ │ │ │ │ │ ├── SQLAggregateOption.java │ │ │ │ │ │ ├── SQLAllColumnExpr.java │ │ │ │ │ │ ├── SQLAllExpr.java │ │ │ │ │ │ ├── SQLAnyExpr.java │ │ │ │ │ │ ├── SQLArrayExpr.java │ │ │ │ │ │ ├── SQLBetweenExpr.java │ │ │ │ │ │ ├── SQLBinaryExpr.java │ │ │ │ │ │ ├── SQLBinaryOpExpr.java │ │ │ │ │ │ ├── SQLBinaryOpExprGroup.java │ │ │ │ │ │ ├── SQLBinaryOperator.java │ │ │ │ │ │ ├── SQLBooleanExpr.java │ │ │ │ │ │ ├── SQLCaseExpr.java │ │ │ │ │ │ ├── SQLCaseStatement.java │ │ │ │ │ │ ├── SQLCastExpr.java │ │ │ │ │ │ ├── SQLCharExpr.java │ │ │ │ │ │ ├── SQLContainsExpr.java │ │ │ │ │ │ ├── SQLCurrentOfCursorExpr.java │ │ │ │ │ │ ├── SQLDateExpr.java │ │ │ │ │ │ ├── SQLDefaultExpr.java │ │ │ │ │ │ ├── SQLExistsExpr.java │ │ │ │ │ │ ├── SQLExprUtils.java │ │ │ │ │ │ ├── SQLFlashbackExpr.java │ │ │ │ │ │ ├── SQLGroupingSetExpr.java │ │ │ │ │ │ ├── SQLHexExpr.java │ │ │ │ │ │ ├── SQLIdentifierExpr.java │ │ │ │ │ │ ├── SQLInListExpr.java │ │ │ │ │ │ ├── SQLInSubQueryExpr.java │ │ │ │ │ │ ├── SQLIntegerExpr.java │ │ │ │ │ │ ├── SQLIntervalExpr.java │ │ │ │ │ │ ├── SQLIntervalUnit.java │ │ │ │ │ │ ├── SQLListExpr.java │ │ │ │ │ │ ├── SQLLiteralExpr.java │ │ │ │ │ │ ├── SQLMethodInvokeExpr.java │ │ │ │ │ │ ├── SQLNCharExpr.java │ │ │ │ │ │ ├── SQLNotExpr.java │ │ │ │ │ │ ├── SQLNullExpr.java │ │ │ │ │ │ ├── SQLNumberExpr.java │ │ │ │ │ │ ├── SQLNumericLiteralExpr.java │ │ │ │ │ │ ├── SQLPropertyExpr.java │ │ │ │ │ │ ├── SQLQueryExpr.java │ │ │ │ │ │ ├── SQLRealExpr.java │ │ │ │ │ │ ├── SQLSequenceExpr.java │ │ │ │ │ │ ├── SQLSomeExpr.java │ │ │ │ │ │ ├── SQLTextLiteralExpr.java │ │ │ │ │ │ ├── SQLTimestampExpr.java │ │ │ │ │ │ ├── SQLUnaryExpr.java │ │ │ │ │ │ ├── SQLUnaryOperator.java │ │ │ │ │ │ ├── SQLValuableExpr.java │ │ │ │ │ │ ├── SQLValuesExpr.java │ │ │ │ │ │ ├── SQLVariantRefExpr.java │ │ │ │ │ │ ├── SQLVariantRefListExpr.java │ │ │ │ │ │ ├── VtArgument.java │ │ │ │ │ │ ├── VtListArgument.java │ │ │ │ │ │ └── VtOffset.java │ │ │ │ │ └── statement │ │ │ │ │ │ ├── SQLAlterCharacter.java │ │ │ │ │ │ ├── SQLAlterDatabaseStatement.java │ │ │ │ │ │ ├── SQLAlterFunctionStatement.java │ │ │ │ │ │ ├── SQLAlterProcedureStatement.java │ │ │ │ │ │ ├── SQLAlterSequenceStatement.java │ │ │ │ │ │ ├── SQLAlterStatement.java │ │ │ │ │ │ ├── SQLAlterTableAddColumn.java │ │ │ │ │ │ ├── SQLAlterTableAddConstraint.java │ │ │ │ │ │ ├── SQLAlterTableAddIndex.java │ │ │ │ │ │ ├── SQLAlterTableAddPartition.java │ │ │ │ │ │ ├── SQLAlterTableAlterColumn.java │ │ │ │ │ │ ├── SQLAlterTableAnalyzePartition.java │ │ │ │ │ │ ├── SQLAlterTableCheckPartition.java │ │ │ │ │ │ ├── SQLAlterTableCoalescePartition.java │ │ │ │ │ │ ├── SQLAlterTableConvertCharSet.java │ │ │ │ │ │ ├── SQLAlterTableDisableConstraint.java │ │ │ │ │ │ ├── SQLAlterTableDisableKeys.java │ │ │ │ │ │ ├── SQLAlterTableDisableLifecycle.java │ │ │ │ │ │ ├── SQLAlterTableDiscardPartition.java │ │ │ │ │ │ ├── SQLAlterTableDropColumnItem.java │ │ │ │ │ │ ├── SQLAlterTableDropConstraint.java │ │ │ │ │ │ ├── SQLAlterTableDropForeignKey.java │ │ │ │ │ │ ├── SQLAlterTableDropIndex.java │ │ │ │ │ │ ├── SQLAlterTableDropKey.java │ │ │ │ │ │ ├── SQLAlterTableDropPartition.java │ │ │ │ │ │ ├── SQLAlterTableDropPrimaryKey.java │ │ │ │ │ │ ├── SQLAlterTableEnableConstraint.java │ │ │ │ │ │ ├── SQLAlterTableEnableKeys.java │ │ │ │ │ │ ├── SQLAlterTableEnableLifecycle.java │ │ │ │ │ │ ├── SQLAlterTableExchangePartition.java │ │ │ │ │ │ ├── SQLAlterTableImportPartition.java │ │ │ │ │ │ ├── SQLAlterTableItem.java │ │ │ │ │ │ ├── SQLAlterTableOptimizePartition.java │ │ │ │ │ │ ├── SQLAlterTableReOrganizePartition.java │ │ │ │ │ │ ├── SQLAlterTableRebuildPartition.java │ │ │ │ │ │ ├── SQLAlterTableRename.java │ │ │ │ │ │ ├── SQLAlterTableRenameColumn.java │ │ │ │ │ │ ├── SQLAlterTableRenameIndex.java │ │ │ │ │ │ ├── SQLAlterTableRenamePartition.java │ │ │ │ │ │ ├── SQLAlterTableRepairPartition.java │ │ │ │ │ │ ├── SQLAlterTableSetComment.java │ │ │ │ │ │ ├── SQLAlterTableSetLifecycle.java │ │ │ │ │ │ ├── SQLAlterTableStatement.java │ │ │ │ │ │ ├── SQLAlterTableTouch.java │ │ │ │ │ │ ├── SQLAlterTableTruncatePartition.java │ │ │ │ │ │ ├── SQLAlterTypeStatement.java │ │ │ │ │ │ ├── SQLAlterViewRenameStatement.java │ │ │ │ │ │ ├── SQLAlterViewStatement.java │ │ │ │ │ │ ├── SQLAssignItem.java │ │ │ │ │ │ ├── SQLBlockStatement.java │ │ │ │ │ │ ├── SQLCallStatement.java │ │ │ │ │ │ ├── SQLCharacterDataType.java │ │ │ │ │ │ ├── SQLCheck.java │ │ │ │ │ │ ├── SQLCloseStatement.java │ │ │ │ │ │ ├── SQLColumnCheck.java │ │ │ │ │ │ ├── SQLColumnConstraint.java │ │ │ │ │ │ ├── SQLColumnDefinition.java │ │ │ │ │ │ ├── SQLColumnPrimaryKey.java │ │ │ │ │ │ ├── SQLColumnReference.java │ │ │ │ │ │ ├── SQLColumnUniqueKey.java │ │ │ │ │ │ ├── SQLCommentStatement.java │ │ │ │ │ │ ├── SQLCommitStatement.java │ │ │ │ │ │ ├── SQLConstraint.java │ │ │ │ │ │ ├── SQLConstraintImpl.java │ │ │ │ │ │ ├── SQLCreateDatabaseStatement.java │ │ │ │ │ │ ├── SQLCreateFunctionStatement.java │ │ │ │ │ │ ├── SQLCreateIndexStatement.java │ │ │ │ │ │ ├── SQLCreateMaterializedViewStatement.java │ │ │ │ │ │ ├── SQLCreateProcedureStatement.java │ │ │ │ │ │ ├── SQLCreateSequenceStatement.java │ │ │ │ │ │ ├── SQLCreateStatement.java │ │ │ │ │ │ ├── SQLCreateTableStatement.java │ │ │ │ │ │ ├── SQLCreateTriggerStatement.java │ │ │ │ │ │ ├── SQLCreateUserStatement.java │ │ │ │ │ │ ├── SQLCreateViewStatement.java │ │ │ │ │ │ ├── SQLDDLStatement.java │ │ │ │ │ │ ├── SQLDeclareStatement.java │ │ │ │ │ │ ├── SQLDeleteStatement.java │ │ │ │ │ │ ├── SQLDescribeStatement.java │ │ │ │ │ │ ├── SQLDropDatabaseStatement.java │ │ │ │ │ │ ├── SQLDropEventStatement.java │ │ │ │ │ │ ├── SQLDropFunctionStatement.java │ │ │ │ │ │ ├── SQLDropIndexStatement.java │ │ │ │ │ │ ├── SQLDropLogFileGroupStatement.java │ │ │ │ │ │ ├── SQLDropMaterializedViewStatement.java │ │ │ │ │ │ ├── SQLDropProcedureStatement.java │ │ │ │ │ │ ├── SQLDropSequenceStatement.java │ │ │ │ │ │ ├── SQLDropServerStatement.java │ │ │ │ │ │ ├── SQLDropStatement.java │ │ │ │ │ │ ├── SQLDropSynonymStatement.java │ │ │ │ │ │ ├── SQLDropTableSpaceStatement.java │ │ │ │ │ │ ├── SQLDropTableStatement.java │ │ │ │ │ │ ├── SQLDropTriggerStatement.java │ │ │ │ │ │ ├── SQLDropTypeStatement.java │ │ │ │ │ │ ├── SQLDropUserStatement.java │ │ │ │ │ │ ├── SQLDropViewStatement.java │ │ │ │ │ │ ├── SQLDumpStatement.java │ │ │ │ │ │ ├── SQLErrorLoggingClause.java │ │ │ │ │ │ ├── SQLExplainStatement.java │ │ │ │ │ │ ├── SQLExprHint.java │ │ │ │ │ │ ├── SQLExprStatement.java │ │ │ │ │ │ ├── SQLExprTableSource.java │ │ │ │ │ │ ├── SQLExternalRecordFormat.java │ │ │ │ │ │ ├── SQLFetchStatement.java │ │ │ │ │ │ ├── SQLForeignKeyConstraint.java │ │ │ │ │ │ ├── SQLForeignKeyImpl.java │ │ │ │ │ │ ├── SQLGrantStatement.java │ │ │ │ │ │ ├── SQLIfStatement.java │ │ │ │ │ │ ├── SQLInsertInto.java │ │ │ │ │ │ ├── SQLInsertStatement.java │ │ │ │ │ │ ├── SQLJoinTableSource.java │ │ │ │ │ │ ├── SQLLateralViewTableSource.java │ │ │ │ │ │ ├── SQLLoopStatement.java │ │ │ │ │ │ ├── SQLMergeStatement.java │ │ │ │ │ │ ├── SQLNotNullConstraint.java │ │ │ │ │ │ ├── SQLNullConstraint.java │ │ │ │ │ │ ├── SQLObjectType.java │ │ │ │ │ │ ├── SQLOpenStatement.java │ │ │ │ │ │ ├── SQLPrimaryKey.java │ │ │ │ │ │ ├── SQLPrimaryKeyImpl.java │ │ │ │ │ │ ├── SQLReleaseSavePointStatement.java │ │ │ │ │ │ ├── SQLReplaceStatement.java │ │ │ │ │ │ ├── SQLReturnStatement.java │ │ │ │ │ │ ├── SQLRevokeStatement.java │ │ │ │ │ │ ├── SQLRollbackStatement.java │ │ │ │ │ │ ├── SQLSavePointStatement.java │ │ │ │ │ │ ├── SQLScriptCommitStatement.java │ │ │ │ │ │ ├── SQLSelect.java │ │ │ │ │ │ ├── SQLSelectGroupByClause.java │ │ │ │ │ │ ├── SQLSelectItem.java │ │ │ │ │ │ ├── SQLSelectOrderByItem.java │ │ │ │ │ │ ├── SQLSelectQuery.java │ │ │ │ │ │ ├── SQLSelectQueryBlock.java │ │ │ │ │ │ ├── SQLSelectStatement.java │ │ │ │ │ │ ├── SQLSetStatement.java │ │ │ │ │ │ ├── SQLShowErrorsStatement.java │ │ │ │ │ │ ├── SQLShowTablesStatement.java │ │ │ │ │ │ ├── SQLStartTransactionStatement.java │ │ │ │ │ │ ├── SQLSubqueryTableSource.java │ │ │ │ │ │ ├── SQLTableConstraint.java │ │ │ │ │ │ ├── SQLTableElement.java │ │ │ │ │ │ ├── SQLTableSource.java │ │ │ │ │ │ ├── SQLTableSourceImpl.java │ │ │ │ │ │ ├── SQLTruncateStatement.java │ │ │ │ │ │ ├── SQLUnionOperator.java │ │ │ │ │ │ ├── SQLUnionQuery.java │ │ │ │ │ │ ├── SQLUnionQueryTableSource.java │ │ │ │ │ │ ├── SQLUnique.java │ │ │ │ │ │ ├── SQLUniqueConstraint.java │ │ │ │ │ │ ├── SQLUpdateSetItem.java │ │ │ │ │ │ ├── SQLUpdateStatement.java │ │ │ │ │ │ ├── SQLUseStatement.java │ │ │ │ │ │ ├── SQLValuesTableSource.java │ │ │ │ │ │ ├── SQLWhileStatement.java │ │ │ │ │ │ └── SQLWithSubqueryClause.java │ │ │ │ ├── dialect │ │ │ │ │ └── mysql │ │ │ │ │ │ ├── BindVarNeeds.java │ │ │ │ │ │ ├── Normalizer.java │ │ │ │ │ │ ├── SmartNormalizer.java │ │ │ │ │ │ ├── ast │ │ │ │ │ │ ├── MySqlForceIndexHint.java │ │ │ │ │ │ ├── MySqlHint.java │ │ │ │ │ │ ├── MySqlIgnoreIndexHint.java │ │ │ │ │ │ ├── MySqlIndexHint.java │ │ │ │ │ │ ├── MySqlIndexHintImpl.java │ │ │ │ │ │ ├── MySqlKey.java │ │ │ │ │ │ ├── MySqlObject.java │ │ │ │ │ │ ├── MySqlObjectImpl.java │ │ │ │ │ │ ├── MySqlPrimaryKey.java │ │ │ │ │ │ ├── MySqlUnique.java │ │ │ │ │ │ ├── MySqlUseIndexHint.java │ │ │ │ │ │ ├── MysqlForeignKey.java │ │ │ │ │ │ ├── clause │ │ │ │ │ │ │ ├── ConditionValue.java │ │ │ │ │ │ │ ├── MySqlCaseStatement.java │ │ │ │ │ │ │ ├── MySqlCursorDeclareStatement.java │ │ │ │ │ │ │ ├── MySqlDeclareConditionStatement.java │ │ │ │ │ │ │ ├── MySqlDeclareHandlerStatement.java │ │ │ │ │ │ │ ├── MySqlDeclareStatement.java │ │ │ │ │ │ │ ├── MySqlExplainType.java │ │ │ │ │ │ │ ├── MySqlFormatName.java │ │ │ │ │ │ │ ├── MySqlHandlerType.java │ │ │ │ │ │ │ ├── MySqlIterateStatement.java │ │ │ │ │ │ │ ├── MySqlLeaveStatement.java │ │ │ │ │ │ │ ├── MySqlRepeatStatement.java │ │ │ │ │ │ │ ├── MySqlSelectIntoStatement.java │ │ │ │ │ │ │ └── MySqlStatementType.java │ │ │ │ │ │ ├── expr │ │ │ │ │ │ │ ├── MySqlCharExpr.java │ │ │ │ │ │ │ ├── MySqlExpr.java │ │ │ │ │ │ │ ├── MySqlExprImpl.java │ │ │ │ │ │ │ ├── MySqlExtractExpr.java │ │ │ │ │ │ │ ├── MySqlMatchAgainstExpr.java │ │ │ │ │ │ │ ├── MySqlOrderingExpr.java │ │ │ │ │ │ │ ├── MySqlOutFileExpr.java │ │ │ │ │ │ │ └── MySqlUserName.java │ │ │ │ │ │ └── statement │ │ │ │ │ │ │ ├── CobarShowStatus.java │ │ │ │ │ │ │ ├── MySqlAlterEventStatement.java │ │ │ │ │ │ │ ├── MySqlAlterLogFileGroupStatement.java │ │ │ │ │ │ │ ├── MySqlAlterServerStatement.java │ │ │ │ │ │ │ ├── MySqlAlterTableAlterColumn.java │ │ │ │ │ │ │ ├── MySqlAlterTableChangeColumn.java │ │ │ │ │ │ │ ├── MySqlAlterTableDiscardTablespace.java │ │ │ │ │ │ │ ├── MySqlAlterTableImportTablespace.java │ │ │ │ │ │ │ ├── MySqlAlterTableModifyColumn.java │ │ │ │ │ │ │ ├── MySqlAlterTableOption.java │ │ │ │ │ │ │ ├── MySqlAlterTablespaceStatement.java │ │ │ │ │ │ │ ├── MySqlAlterUserStatement.java │ │ │ │ │ │ │ ├── MySqlAnalyzeStatement.java │ │ │ │ │ │ │ ├── MySqlBinlogStatement.java │ │ │ │ │ │ │ ├── MySqlChecksumTableStatement.java │ │ │ │ │ │ │ ├── MySqlCreateAddLogFileGroupStatement.java │ │ │ │ │ │ │ ├── MySqlCreateEventStatement.java │ │ │ │ │ │ │ ├── MySqlCreateServerStatement.java │ │ │ │ │ │ │ ├── MySqlCreateTableSpaceStatement.java │ │ │ │ │ │ │ ├── MySqlCreateTableStatement.java │ │ │ │ │ │ │ ├── MySqlCreateUserStatement.java │ │ │ │ │ │ │ ├── MySqlDeleteStatement.java │ │ │ │ │ │ │ ├── MySqlEventSchedule.java │ │ │ │ │ │ │ ├── MySqlExecuteStatement.java │ │ │ │ │ │ │ ├── MySqlExplainStatement.java │ │ │ │ │ │ │ ├── MySqlFlushStatement.java │ │ │ │ │ │ │ ├── MySqlHelpStatement.java │ │ │ │ │ │ │ ├── MySqlHintStatement.java │ │ │ │ │ │ │ ├── MySqlInsertReplaceStatement.java │ │ │ │ │ │ │ ├── MySqlInsertStatement.java │ │ │ │ │ │ │ ├── MySqlKillStatement.java │ │ │ │ │ │ │ ├── MySqlLoadDataInFileStatement.java │ │ │ │ │ │ │ ├── MySqlLoadXmlStatement.java │ │ │ │ │ │ │ ├── MySqlLockTableStatement.java │ │ │ │ │ │ │ ├── MySqlOptimizeStatement.java │ │ │ │ │ │ │ ├── MySqlPartitionByKey.java │ │ │ │ │ │ │ ├── MySqlPrepareStatement.java │ │ │ │ │ │ │ ├── MySqlRenameTableStatement.java │ │ │ │ │ │ │ ├── MySqlResetStatement.java │ │ │ │ │ │ │ ├── MySqlSelectQueryBlock.java │ │ │ │ │ │ │ ├── MySqlSetTransactionStatement.java │ │ │ │ │ │ │ ├── MySqlShowAuthorsStatement.java │ │ │ │ │ │ │ ├── MySqlShowBinLogEventsStatement.java │ │ │ │ │ │ │ ├── MySqlShowBinaryLogsStatement.java │ │ │ │ │ │ │ ├── MySqlShowCharacterSetStatement.java │ │ │ │ │ │ │ ├── MySqlShowCollationStatement.java │ │ │ │ │ │ │ ├── MySqlShowColumnsStatement.java │ │ │ │ │ │ │ ├── MySqlShowContributorsStatement.java │ │ │ │ │ │ │ ├── MySqlShowCreateDatabaseStatement.java │ │ │ │ │ │ │ ├── MySqlShowCreateEventStatement.java │ │ │ │ │ │ │ ├── MySqlShowCreateFunctionStatement.java │ │ │ │ │ │ │ ├── MySqlShowCreateProcedureStatement.java │ │ │ │ │ │ │ ├── MySqlShowCreateTableStatement.java │ │ │ │ │ │ │ ├── MySqlShowCreateTriggerStatement.java │ │ │ │ │ │ │ ├── MySqlShowCreateViewStatement.java │ │ │ │ │ │ │ ├── MySqlShowDatabasePartitionStatusStatement.java │ │ │ │ │ │ │ ├── MySqlShowDatabasesStatement.java │ │ │ │ │ │ │ ├── MySqlShowEngineStatement.java │ │ │ │ │ │ │ ├── MySqlShowEnginesStatement.java │ │ │ │ │ │ │ ├── MySqlShowErrorsStatement.java │ │ │ │ │ │ │ ├── MySqlShowEventsStatement.java │ │ │ │ │ │ │ ├── MySqlShowFunctionCodeStatement.java │ │ │ │ │ │ │ ├── MySqlShowFunctionStatusStatement.java │ │ │ │ │ │ │ ├── MySqlShowGrantsStatement.java │ │ │ │ │ │ │ ├── MySqlShowIndexesStatement.java │ │ │ │ │ │ │ ├── MySqlShowKeysStatement.java │ │ │ │ │ │ │ ├── MySqlShowMasterLogsStatement.java │ │ │ │ │ │ │ ├── MySqlShowMasterStatusStatement.java │ │ │ │ │ │ │ ├── MySqlShowOpenTablesStatement.java │ │ │ │ │ │ │ ├── MySqlShowPluginsStatement.java │ │ │ │ │ │ │ ├── MySqlShowPrivilegesStatement.java │ │ │ │ │ │ │ ├── MySqlShowProcedureCodeStatement.java │ │ │ │ │ │ │ ├── MySqlShowProcedureStatusStatement.java │ │ │ │ │ │ │ ├── MySqlShowProcessListStatement.java │ │ │ │ │ │ │ ├── MySqlShowProfileStatement.java │ │ │ │ │ │ │ ├── MySqlShowProfilesStatement.java │ │ │ │ │ │ │ ├── MySqlShowRelayLogEventsStatement.java │ │ │ │ │ │ │ ├── MySqlShowSlaveHostsStatement.java │ │ │ │ │ │ │ ├── MySqlShowSlaveStatusStatement.java │ │ │ │ │ │ │ ├── MySqlShowStatement.java │ │ │ │ │ │ │ ├── MySqlShowStatusStatement.java │ │ │ │ │ │ │ ├── MySqlShowTableStatusStatement.java │ │ │ │ │ │ │ ├── MySqlShowTriggersStatement.java │ │ │ │ │ │ │ ├── MySqlShowVariantsStatement.java │ │ │ │ │ │ │ ├── MySqlShowWarningsStatement.java │ │ │ │ │ │ │ ├── MySqlStatement.java │ │ │ │ │ │ │ ├── MySqlStatementImpl.java │ │ │ │ │ │ │ ├── MySqlSubPartitionByKey.java │ │ │ │ │ │ │ ├── MySqlSubPartitionByList.java │ │ │ │ │ │ │ ├── MySqlTableIndex.java │ │ │ │ │ │ │ ├── MySqlUnlockTablesStatement.java │ │ │ │ │ │ │ ├── MySqlUpdateStatement.java │ │ │ │ │ │ │ ├── MySqlUpdateTableSource.java │ │ │ │ │ │ │ └── MysqlDeallocatePrepareStatement.java │ │ │ │ │ │ ├── custom │ │ │ │ │ │ └── VitessSchemaASTVisitorAdapter.java │ │ │ │ │ │ ├── executor │ │ │ │ │ │ └── MySqlProcedureExecutor.java │ │ │ │ │ │ ├── parser │ │ │ │ │ │ ├── MySqlCreateTableParser.java │ │ │ │ │ │ ├── MySqlExprParser.java │ │ │ │ │ │ ├── MySqlLexer.java │ │ │ │ │ │ ├── MySqlSelectIntoParser.java │ │ │ │ │ │ ├── MySqlSelectParser.java │ │ │ │ │ │ └── MySqlStatementParser.java │ │ │ │ │ │ └── visitor │ │ │ │ │ │ ├── AddDualVisitor.java │ │ │ │ │ │ ├── CheckNodeTypesVisitor.java │ │ │ │ │ │ ├── MySqlASTVisitor.java │ │ │ │ │ │ ├── MySqlASTVisitorAdapter.java │ │ │ │ │ │ ├── MySqlEvalVisitorImpl.java │ │ │ │ │ │ ├── MySqlExportParameterVisitor.java │ │ │ │ │ │ ├── MySqlOutputVisitor.java │ │ │ │ │ │ ├── MySqlSchemaStatVisitor.java │ │ │ │ │ │ ├── MySqlShowColumnOutpuVisitor.java │ │ │ │ │ │ ├── RewriteHavingAggrWithOffsetVisitor.java │ │ │ │ │ │ ├── SwitchTableVisitor.java │ │ │ │ │ │ ├── TableRouteGetEngineVisitor.java │ │ │ │ │ │ ├── VtChangeSchemaVisitor.java │ │ │ │ │ │ ├── VtFindOriginVisitor.java │ │ │ │ │ │ ├── VtFormatImpossibleQueryVisitor.java │ │ │ │ │ │ ├── VtGetBindVarsVisitor.java │ │ │ │ │ │ ├── VtHasSubqueryVisitor.java │ │ │ │ │ │ ├── VtJoinPushOrderByVisitor.java │ │ │ │ │ │ ├── VtNormalizeVisitor.java │ │ │ │ │ │ ├── VtPutBindVarsVisitor.java │ │ │ │ │ │ ├── VtRemoveBacktickVisitor.java │ │ │ │ │ │ ├── VtRemoveDbNameExpectSystemDbVisitor.java │ │ │ │ │ │ ├── VtRemoveDbNameInColumnVisitor.java │ │ │ │ │ │ ├── VtRemoveDbNameVisitor.java │ │ │ │ │ │ ├── VtReplaceExprVisitor.java │ │ │ │ │ │ ├── VtReplaceVariantRefExprVisitor.java │ │ │ │ │ │ ├── VtRestoreVisitor.java │ │ │ │ │ │ ├── VtRewriteTableSchemaVisitor.java │ │ │ │ │ │ ├── VtRouteWireupFixUpAstVisitor.java │ │ │ │ │ │ ├── VtRouteWireupVarFormatVisitor.java │ │ │ │ │ │ ├── VtSmartNormalizeVisitor.java │ │ │ │ │ │ ├── VtTableRouteWireupFixUpAstVisitor.java │ │ │ │ │ │ └── VtTableRouteWireupVarFormatVisitor.java │ │ │ │ ├── parser │ │ │ │ │ ├── CharTypes.java │ │ │ │ │ ├── EOFParserException.java │ │ │ │ │ ├── InsertColumnsCache.java │ │ │ │ │ ├── Keywords.java │ │ │ │ │ ├── LayoutCharacters.java │ │ │ │ │ ├── Lexer.java │ │ │ │ │ ├── NotAllowCommentException.java │ │ │ │ │ ├── ParserException.java │ │ │ │ │ ├── SQLCreateTableParser.java │ │ │ │ │ ├── SQLDDLParser.java │ │ │ │ │ ├── SQLExprParser.java │ │ │ │ │ ├── SQLParseException.java │ │ │ │ │ ├── SQLParser.java │ │ │ │ │ ├── SQLParserFeature.java │ │ │ │ │ ├── SQLParserUtils.java │ │ │ │ │ ├── SQLSelectListCache.java │ │ │ │ │ ├── SQLSelectParser.java │ │ │ │ │ ├── SQLStatementParser.java │ │ │ │ │ ├── SymbolTable.java │ │ │ │ │ ├── Token.java │ │ │ │ │ └── VitessRuntimeException.java │ │ │ │ ├── repository │ │ │ │ │ ├── Schema.java │ │ │ │ │ ├── SchemaObject.java │ │ │ │ │ ├── SchemaObjectImpl.java │ │ │ │ │ ├── SchemaObjectType.java │ │ │ │ │ ├── SchemaRepository.java │ │ │ │ │ ├── SchemaResolveVisitor.java │ │ │ │ │ └── SchemaResolveVisitorFactory.java │ │ │ │ ├── stat │ │ │ │ │ └── TableStat.java │ │ │ │ ├── support │ │ │ │ │ ├── json │ │ │ │ │ │ ├── JSONParser.java │ │ │ │ │ │ ├── JSONUtils.java │ │ │ │ │ │ └── JSONWriter.java │ │ │ │ │ └── logging │ │ │ │ │ │ ├── JakartaCommonsLoggingImpl.java │ │ │ │ │ │ ├── Jdk14LoggingImpl.java │ │ │ │ │ │ ├── Log.java │ │ │ │ │ │ ├── Log4j2Impl.java │ │ │ │ │ │ ├── Log4jImpl.java │ │ │ │ │ │ ├── LogFactory.java │ │ │ │ │ │ ├── NoLoggingImpl.java │ │ │ │ │ │ ├── Resources.java │ │ │ │ │ │ └── SLF4JImpl.java │ │ │ │ ├── utils │ │ │ │ │ ├── Consumer.java │ │ │ │ │ ├── FnvHash.java │ │ │ │ │ ├── HexBin.java │ │ │ │ │ ├── JdbcConstants.java │ │ │ │ │ ├── JdbcUtils.java │ │ │ │ │ ├── ListDG.java │ │ │ │ │ ├── MySqlUtils.java │ │ │ │ │ ├── ResultSetConsumer.java │ │ │ │ │ ├── SplitMultiQueryUtils.java │ │ │ │ │ ├── StringUtils.java │ │ │ │ │ ├── TableNameUtils.java │ │ │ │ │ └── Utils.java │ │ │ │ └── visitor │ │ │ │ │ ├── AnalyzerVisitor.java │ │ │ │ │ ├── CheckForInvalidGroupingExpressionsVisitor.java │ │ │ │ │ ├── CheckUnionVisitor.java │ │ │ │ │ ├── ExportParameterVisitor.java │ │ │ │ │ ├── ExportParameterVisitorUtils.java │ │ │ │ │ ├── ExportParameterizedOutputVisitor.java │ │ │ │ │ ├── ExprDependenciesVisitor.java │ │ │ │ │ ├── OrderByGroupByNumberRewriteVisitor.java │ │ │ │ │ ├── ParameterizedOutputVisitorUtils.java │ │ │ │ │ ├── ParameterizedVisitor.java │ │ │ │ │ ├── PrintableVisitor.java │ │ │ │ │ ├── RewriteHavingVisitor.java │ │ │ │ │ ├── SQLASTOutputVisitor.java │ │ │ │ │ ├── SQLASTVisitor.java │ │ │ │ │ ├── SQLASTVisitorAdapter.java │ │ │ │ │ ├── SQLEvalVisitor.java │ │ │ │ │ ├── SQLEvalVisitorImpl.java │ │ │ │ │ ├── SQLEvalVisitorUtils.java │ │ │ │ │ ├── SQLTransformVisitor.java │ │ │ │ │ ├── SchemaStatVisitor.java │ │ │ │ │ ├── VisitorFeature.java │ │ │ │ │ ├── VtBreakExpressionInLHSandRHSVisitor.java │ │ │ │ │ ├── VtVisitor.java │ │ │ │ │ └── functions │ │ │ │ │ ├── Ascii.java │ │ │ │ │ ├── Bin.java │ │ │ │ │ ├── BitLength.java │ │ │ │ │ ├── Char.java │ │ │ │ │ ├── Concat.java │ │ │ │ │ ├── Elt.java │ │ │ │ │ ├── Function.java │ │ │ │ │ ├── Greatest.java │ │ │ │ │ ├── Hex.java │ │ │ │ │ ├── If.java │ │ │ │ │ ├── Insert.java │ │ │ │ │ ├── Instr.java │ │ │ │ │ ├── Isnull.java │ │ │ │ │ ├── Lcase.java │ │ │ │ │ ├── Least.java │ │ │ │ │ ├── Left.java │ │ │ │ │ ├── Length.java │ │ │ │ │ ├── Locate.java │ │ │ │ │ ├── Lpad.java │ │ │ │ │ ├── Ltrim.java │ │ │ │ │ ├── Nil.java │ │ │ │ │ ├── Now.java │ │ │ │ │ ├── OneParamFunctions.java │ │ │ │ │ ├── Reverse.java │ │ │ │ │ ├── Right.java │ │ │ │ │ ├── Substring.java │ │ │ │ │ ├── Trim.java │ │ │ │ │ ├── Ucase.java │ │ │ │ │ └── Unhex.java │ │ │ │ ├── sqltypes │ │ │ │ ├── BatchVtResultSet.java │ │ │ │ ├── BeginBatchVtResultSet.java │ │ │ │ ├── BeginVtResultSet.java │ │ │ │ ├── Constants.java │ │ │ │ ├── SqlTypes.java │ │ │ │ ├── VtNumberRange.java │ │ │ │ ├── VtPlanValue.java │ │ │ │ ├── VtResultSet.java │ │ │ │ ├── VtResultSetMessage.java │ │ │ │ ├── VtResultValue.java │ │ │ │ ├── VtRowList.java │ │ │ │ ├── VtSqlStatementType.java │ │ │ │ ├── VtStreamResultSet.java │ │ │ │ ├── VtType.java │ │ │ │ └── VtValue.java │ │ │ │ ├── srvtopo │ │ │ │ ├── BindVariable.java │ │ │ │ ├── BoundQuery.java │ │ │ │ ├── Gateway.java │ │ │ │ ├── ResilientServer.java │ │ │ │ ├── ResolvedShard.java │ │ │ │ ├── Resolver.java │ │ │ │ ├── ScatterConn.java │ │ │ │ ├── SrvTopo.java │ │ │ │ ├── SrvTopoException.java │ │ │ │ ├── SrvTopoServer.java │ │ │ │ ├── TabletGateway.java │ │ │ │ └── TxConn.java │ │ │ │ ├── tindexes │ │ │ │ ├── ActualTable.java │ │ │ │ ├── Column.java │ │ │ │ ├── LogicTable.java │ │ │ │ ├── ShardTableByMurmur.java │ │ │ │ ├── SplitTableUtil.java │ │ │ │ ├── TableDestinationGroup.java │ │ │ │ ├── TableIndex.java │ │ │ │ ├── TableRuleMod.java │ │ │ │ └── config │ │ │ │ │ ├── LogicTableConfig.java │ │ │ │ │ ├── SchemaConfig.java │ │ │ │ │ └── SplitTableConfig.java │ │ │ │ ├── topo │ │ │ │ ├── Resource.java │ │ │ │ ├── Topo.java │ │ │ │ ├── TopoCellInfo.java │ │ │ │ ├── TopoConnection.java │ │ │ │ ├── TopoException.java │ │ │ │ ├── TopoExceptionCode.java │ │ │ │ ├── TopoFactory.java │ │ │ │ ├── TopoServer.java │ │ │ │ ├── TopoSrvKeyspace.java │ │ │ │ ├── TopoStatsConnection.java │ │ │ │ ├── TopoTablet.java │ │ │ │ ├── TopoVschema.java │ │ │ │ ├── etcd2topo │ │ │ │ │ ├── Etcd2TopoFactory.java │ │ │ │ │ ├── Etcd2TopoServer.java │ │ │ │ │ ├── EtcdWatcher.java │ │ │ │ │ └── SrvKeyspaceListener.java │ │ │ │ └── topoproto │ │ │ │ │ └── TopoProto.java │ │ │ │ ├── util │ │ │ │ ├── KeyspaceUtil.java │ │ │ │ ├── NetUtil.java │ │ │ │ ├── ScheduledManager.java │ │ │ │ ├── SelectItemUtil.java │ │ │ │ ├── TimeUtil.java │ │ │ │ ├── cache │ │ │ │ │ ├── CacheBase.java │ │ │ │ │ └── lrucache │ │ │ │ │ │ └── LRUCache.java │ │ │ │ ├── consolidator │ │ │ │ │ ├── Consolidator.java │ │ │ │ │ ├── ConsolidatorResult.java │ │ │ │ │ └── Result.java │ │ │ │ └── threadpool │ │ │ │ │ ├── AbstractVtExecutorService.java │ │ │ │ │ ├── InitThreadPoolService.java │ │ │ │ │ ├── JdkUtil.java │ │ │ │ │ ├── JvmUtil.java │ │ │ │ │ ├── VtRejectedExecutionHandler.java │ │ │ │ │ ├── VtThreadFactoryBuilder.java │ │ │ │ │ └── impl │ │ │ │ │ ├── TabletNettyExecutorService.java │ │ │ │ │ ├── VtHealthCheckExecutorService.java │ │ │ │ │ └── VtQueryExecutorService.java │ │ │ │ ├── vindexes │ │ │ │ ├── LookupPlanable.java │ │ │ │ ├── MultiColumn.java │ │ │ │ ├── Reversible.java │ │ │ │ ├── SingleColumn.java │ │ │ │ ├── VKeyspace.java │ │ │ │ ├── Vindex.java │ │ │ │ ├── VschemaConstant.java │ │ │ │ ├── cryto │ │ │ │ │ └── TripleDES.java │ │ │ │ └── hash │ │ │ │ │ ├── AbstractHash.java │ │ │ │ │ ├── Arithmetic.java │ │ │ │ │ ├── Binary.java │ │ │ │ │ ├── BinaryHash.java │ │ │ │ │ ├── Hash.java │ │ │ │ │ ├── MurmurVtValueIndex.java │ │ │ │ │ └── VtValueIndex.java │ │ │ │ └── vitess │ │ │ │ ├── AbstractVitessConnection.java │ │ │ │ ├── AbstractVitessPreparedStatement.java │ │ │ │ ├── AbstractVitessResultSet.java │ │ │ │ ├── AbstractVitessResultSetMetaData.java │ │ │ │ ├── AbstractVitessStatement.java │ │ │ │ ├── Config.java │ │ │ │ ├── VitessConnection.java │ │ │ │ ├── VitessDataSource.java │ │ │ │ ├── VitessDriver.java │ │ │ │ ├── VitessJdbcProperyUtil.java │ │ │ │ ├── VitessJdbcUrlParser.java │ │ │ │ ├── VitessPreparedStatement.java │ │ │ │ ├── VitessResultSet.java │ │ │ │ ├── VitessResultSetMetaData.java │ │ │ │ ├── VitessStatement.java │ │ │ │ ├── VitessWrapper.java │ │ │ │ ├── metadata │ │ │ │ ├── AbstractDatabaseMetaData.java │ │ │ │ ├── CachedDatabaseMetaData.java │ │ │ │ └── VitessDatabaseMetaData.java │ │ │ │ ├── mysql │ │ │ │ ├── VitessPropertyKey.java │ │ │ │ └── VitessQueryBindVariable.java │ │ │ │ └── resultset │ │ │ │ ├── AbstractDatabaseMetaDataResultSet.java │ │ │ │ ├── DatabaseMetaDataResultSet.java │ │ │ │ ├── DateTimeUtil.java │ │ │ │ ├── MetaDataResultSetUtil.java │ │ │ │ └── ResultSetUtil.java │ │ ├── io │ │ │ └── vitess │ │ │ │ └── proto │ │ │ │ ├── Query.java │ │ │ │ ├── Topodata.java │ │ │ │ └── Vtrpc.java │ │ ├── queryservice │ │ │ ├── QueryGrpc.java │ │ │ └── Queryservice.java │ │ ├── vschema │ │ │ └── Vschema.java │ │ └── vttime │ │ │ └── Vttime.java │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ ├── com.jd.jdbc.tindexes.TableIndex │ │ │ └── java.sql.Driver │ │ └── vtdriver-version.properties └── test │ ├── java │ ├── com │ │ └── jd │ │ │ ├── BaseTest.java │ │ │ └── jdbc │ │ │ ├── api │ │ │ └── VtApiServerTest.java │ │ │ ├── cache │ │ │ └── LRUCacheTest.java │ │ │ ├── concurrency │ │ │ └── AllErrorRecorderTest.java │ │ │ ├── context │ │ │ └── ContextTest.java │ │ │ ├── discovery │ │ │ ├── EtcdTopoServerTest.java │ │ │ ├── HealthCheckTest.java │ │ │ ├── MockTablet.java │ │ │ └── ReadWriteSplitTest.java │ │ │ ├── engine │ │ │ ├── ASCIICharEncodingTest.java │ │ │ ├── CharEncodingTest.java │ │ │ ├── DeleteEngineTest.java │ │ │ ├── FakePrimitive.java │ │ │ ├── InsertEngineTest.java │ │ │ ├── RouteEngineTest.java │ │ │ ├── SelectEngineTest.java │ │ │ ├── SelectTestSuite.java │ │ │ ├── UpdateEngineTest.java │ │ │ ├── destination │ │ │ │ └── DestinationTest.java │ │ │ ├── gen4 │ │ │ │ ├── ConcatenateGen4EngineTest.java │ │ │ │ ├── DistinctGen4EngineTest.java │ │ │ │ ├── FilterGen4EngineTest.java │ │ │ │ ├── JoinGen4EngineTest.java │ │ │ │ ├── LimitGen4EngineTest.java │ │ │ │ ├── MemorySortGen4EngineTest.java │ │ │ │ ├── OrderedAggregateGen4EngineTest.java │ │ │ │ ├── RouteGen4EngineTest.java │ │ │ │ ├── ScalarAggregateGen4EngineTest.java │ │ │ │ └── VitessCompareTest.java │ │ │ ├── join │ │ │ │ ├── JoinTypeTest.java │ │ │ │ ├── ShardedJoinTest.java │ │ │ │ └── UnShardedJoinTest.java │ │ │ ├── subquery │ │ │ │ ├── ShardedSubqueryTest.java │ │ │ │ └── UnShardedSubqueryTest.java │ │ │ ├── union │ │ │ │ ├── ShardedUnionTest.java │ │ │ │ └── UnShardedUnionTest.java │ │ │ ├── util │ │ │ │ └── TestResult.java │ │ │ └── vcursor │ │ │ │ ├── FakeVcursorUtil.java │ │ │ │ ├── LoggingVCursor.java │ │ │ │ └── NoopVCursor.java │ │ │ ├── evalengine │ │ │ └── ArithmeticTest.java │ │ │ ├── key │ │ │ └── BinaryHashUtilTest.java │ │ │ ├── planbuilder │ │ │ ├── AbstractPlanTest.java │ │ │ ├── AdvancedPlanTest.java │ │ │ ├── Gen4PlanTest.java │ │ │ ├── PlanCacheTest.java │ │ │ ├── PlanPerformanceTest.java │ │ │ ├── PlanTest.java │ │ │ ├── gen4 │ │ │ │ ├── AnalyzerTest.java │ │ │ │ ├── HorizonPlanningTest.java │ │ │ │ ├── OperatorTest.java │ │ │ │ ├── QueryProjectionTest.java │ │ │ │ ├── RewriterTest.java │ │ │ │ └── operator │ │ │ │ │ └── physical │ │ │ │ │ └── RoutePlanningTest.java │ │ │ ├── semantics │ │ │ │ ├── EarlyRewriterTest.java │ │ │ │ ├── FakeSI.java │ │ │ │ └── TableSetTest.java │ │ │ └── vschema │ │ │ │ ├── AbstractTable.java │ │ │ │ ├── Authoritative.java │ │ │ │ ├── AutoIncrement.java │ │ │ │ ├── ColumnVindexesItem.java │ │ │ │ ├── ColumnsItem.java │ │ │ │ ├── Dual.java │ │ │ │ ├── Foo.java │ │ │ │ ├── Hash.java │ │ │ │ ├── Keyspaces.java │ │ │ │ ├── M1.java │ │ │ │ ├── Main.java │ │ │ │ ├── Multicolvin.java │ │ │ │ ├── Music.java │ │ │ │ ├── MusicExtra.java │ │ │ │ ├── OverlapVindex.java │ │ │ │ ├── PinTest.java │ │ │ │ ├── PlanVschema.java │ │ │ │ ├── Samecolvin.java │ │ │ │ ├── SecondUser.java │ │ │ │ ├── Seq.java │ │ │ │ ├── Tables.java │ │ │ │ ├── Test.java │ │ │ │ ├── Unsharded.java │ │ │ │ ├── UnshardedA.java │ │ │ │ ├── UnshardedAuthoritative.java │ │ │ │ ├── UnshardedAuto.java │ │ │ │ ├── UnshardedB.java │ │ │ │ ├── User.java │ │ │ │ ├── UserExtra.java │ │ │ │ ├── UserMetadata.java │ │ │ │ ├── Vindexes.java │ │ │ │ └── WeirdName.java │ │ │ ├── queryservice │ │ │ ├── MockQueryServer.java │ │ │ ├── TabletDialerAgent.java │ │ │ └── util │ │ │ │ └── RoleUtilsTest.java │ │ │ ├── shards │ │ │ └── hash │ │ │ │ ├── KeyTest.java │ │ │ │ └── VtConnHashTest.java │ │ │ ├── show │ │ │ └── ShowVitessShardsTest.java │ │ │ ├── sqlparser │ │ │ ├── ChangeSchemaTest.java │ │ │ ├── KeywordTest.java │ │ │ ├── NormalizeRewritePutTest.java │ │ │ ├── SmartNormalizeDateTest.java │ │ │ ├── SmartNormalizeTest1.java │ │ │ ├── SmartNormalizeTest2.java │ │ │ └── dialect │ │ │ │ └── mysql │ │ │ │ └── visitor │ │ │ │ └── AddDualVisitorTest.java │ │ │ ├── sqltypes │ │ │ └── VtValueTest.java │ │ │ ├── table │ │ │ ├── ConcurrentSplitTableTest.java │ │ │ ├── LastInsertIdTest.java │ │ │ ├── SplitTableUtilTest.java │ │ │ ├── TableAutoGeneratedKeysTest.java │ │ │ ├── TableRewriteBatchedStatementsTest.java │ │ │ ├── TableTestUtil.java │ │ │ ├── TestParallelQuery.java │ │ │ ├── TransactionTest.java │ │ │ ├── batch │ │ │ │ └── BatchTest.java │ │ │ ├── engine │ │ │ │ ├── DeleteTest.java │ │ │ │ ├── InsertTest.java │ │ │ │ ├── SelectTest.java │ │ │ │ ├── TableSequenceTest.java │ │ │ │ ├── UpdateTest.java │ │ │ │ ├── join │ │ │ │ │ └── JoinTest.java │ │ │ │ ├── subquery │ │ │ │ │ └── SubqueryTest.java │ │ │ │ ├── union │ │ │ │ │ └── UnionTest.java │ │ │ │ └── unshard │ │ │ │ │ ├── DeleteUnShardTest.java │ │ │ │ │ ├── InsertUnShardTest.java │ │ │ │ │ ├── SelectUnShardTest.java │ │ │ │ │ └── UpdateUnShardTest.java │ │ │ ├── multiquery │ │ │ │ └── MultiqueryTest.java │ │ │ ├── streamquery │ │ │ │ └── StreamQueryTest.java │ │ │ ├── table │ │ │ │ └── TestTableSort.java │ │ │ └── unshard │ │ │ │ ├── ConcurrentSplitTableUnshardTest.java │ │ │ │ ├── LastInsertIdUnShardTest.java │ │ │ │ ├── TableAutoGeneratedKeysUnShardTest.java │ │ │ │ └── TransactionUnShardTest.java │ │ │ ├── threadpool │ │ │ ├── InitConnectionPoolParams.java │ │ │ └── VtThreadPoolExecutorTest.java │ │ │ ├── topo │ │ │ ├── MemoryTopoFactory.java │ │ │ ├── MemoryTopoServer.java │ │ │ ├── discovery │ │ │ │ └── TestHealthCheck.java │ │ │ └── etcd2topo │ │ │ │ ├── Etcd2TopoFactoryTest.java │ │ │ │ ├── Etcd2TopoServerTest.java │ │ │ │ └── ServerTest.java │ │ │ ├── util │ │ │ ├── InnerConnectionPoolUtil.java │ │ │ ├── JdkUtilTest.java │ │ │ ├── JsonUtil.java │ │ │ └── SplitMultiQueryUtilsTest.java │ │ │ └── vitess │ │ │ ├── KeyspaceNotExistTest.java │ │ │ ├── TimeTest.java │ │ │ ├── TimeTestUtil.java │ │ │ ├── TimeZoneTest.java │ │ │ ├── TimezoneConfigureTest.java │ │ │ ├── TransactionTest.java │ │ │ ├── TransactionUnShardTest.java │ │ │ ├── TypeTest.java │ │ │ ├── VitessAutoGeneratedKeysRewriteBatchTest.java │ │ │ ├── VitessAutoGeneratedKeysTest.java │ │ │ ├── VitessDriverCPTest.java │ │ │ ├── VitessDriverConnectionPoolTest.java │ │ │ ├── VitessDriverConsolidatorTest.java │ │ │ ├── VitessDriverDatabaseMetaDataTest.java │ │ │ ├── VitessDriverExecuteBatchTest.java │ │ │ ├── VitessDriverFindColumnByName.java │ │ │ ├── VitessDriverReadWriteSplit.java │ │ │ ├── VitessDriverTestBase.java │ │ │ ├── VitessDriverUnshardedTest.java │ │ │ ├── VitessJdbcUrlParserTest.java │ │ │ ├── allowMultiQueries │ │ │ ├── VitessDriverAllowMultiQuerieTest.java │ │ │ ├── VitessDriverMultiQueriesTest.java │ │ │ └── VitessDriverMultiQuerySubsectionTest.java │ │ │ └── parser │ │ │ └── test │ │ │ ├── SelectTest.java │ │ │ ├── SqlParserTest.java │ │ │ └── TestUtils.java │ └── testsuite │ │ ├── TestSuite.java │ │ ├── internal │ │ ├── TestSuiteConn.java │ │ ├── TestSuiteShardSpec.java │ │ ├── config │ │ │ ├── DriverJdbcCfg.java │ │ │ ├── TestSuiteCfgPath.java │ │ │ ├── TestSuiteCfgReader.java │ │ │ └── TestSuiteJdbcCfg.java │ │ ├── environment │ │ │ ├── DriverEnv.java │ │ │ └── TestSuiteEnv.java │ │ └── testcase │ │ │ └── TestSuiteCase.java │ │ └── util │ │ ├── printer │ │ └── TestSuitePrinter.java │ │ └── random │ │ └── TestSuiteRandom.java │ └── resources │ ├── emojis.json │ ├── engine │ ├── destination │ │ ├── delete_cases.json │ │ ├── select_cases.json │ │ └── update_cases.json │ ├── dml_delete_sharded.json │ ├── dml_delete_unsharded.json │ ├── dml_insert_sharded.json │ ├── dml_insert_unsharded.json │ ├── dml_update_sharded.json │ ├── dml_update_unsharded.json │ ├── join │ │ ├── datatype │ │ │ └── datatype_join_test.json │ │ ├── sharded │ │ │ └── join_cases.json │ │ └── unsharded │ │ │ └── join_cases.json │ ├── selectengine │ │ ├── aggr_cases.json │ │ ├── bug_in_resolve_cases │ │ │ ├── aggr_cases.json │ │ │ ├── memory_sort_cases.json │ │ │ └── select_cases.json │ │ ├── calculate_dual_case.json │ │ ├── deepPagination.json │ │ ├── filter_cases.json │ │ ├── from_cases.json │ │ ├── memory_sort_cases.json │ │ ├── postprocess_cases.json │ │ └── select_cases.json │ ├── subquery │ │ ├── sharded │ │ │ └── subquery_cases.json │ │ └── unsharded │ │ │ └── subquery_cases.json │ ├── tableengine │ │ ├── delete_case.json │ │ ├── delete_case_upperCase.json │ │ ├── insert_case.json │ │ ├── insert_case_seq.json │ │ ├── insert_case_upperCase.json │ │ ├── join_case.json │ │ ├── multiquery │ │ │ └── select_case.json │ │ ├── select_aggr_case.json │ │ ├── select_aggr_case_unsupport.json │ │ ├── select_aggr_case_upperCase.json │ │ ├── select_case.json │ │ ├── select_case_upperCase.json │ │ ├── select_filter_case.json │ │ ├── select_filter_case_upperCase.json │ │ ├── select_memsort_case.json │ │ ├── select_memsort_case_upperCase.json │ │ ├── select_postprocess_case.json │ │ ├── select_postprocess_case_upperCase.json │ │ ├── split-table-seq-tindex.yml │ │ ├── split-table-seq.yml │ │ ├── split-table_1.yml │ │ ├── split-table_2.yml │ │ ├── streamquery │ │ │ └── select_case.json │ │ ├── subquery_case.json │ │ ├── union_case.json │ │ ├── update_case.json │ │ └── update_case_upperCase.json │ └── union │ │ ├── sharded │ │ └── union_cases.json │ │ └── unsharded │ │ └── union_cases.json │ ├── log4j.properties │ ├── plan │ ├── Gen4 │ │ ├── operator_test_data.txt │ │ ├── operator_test_data_bk.txt │ │ └── operator_test_data_one.txt │ ├── aggr_cases.txt │ ├── aggr_cases_unsupported.txt │ ├── destination_case.txt │ ├── destination_cases_error.txt │ ├── dml_delete_cases.txt │ ├── dml_delete_cases_unsupported.txt │ ├── dml_insert_cases.txt │ ├── dml_insert_cases_unsupported.txt │ ├── dml_update_cases.txt │ ├── dml_update_cases_unsupported.txt │ ├── filter_cases.txt │ ├── filter_cases_unsupported.txt │ ├── from_cases.txt │ ├── from_cases_unsupported.txt │ ├── memory_sort_cases.txt │ ├── memory_sort_cases_unsupported.txt │ ├── one_cases.txt │ ├── plan_schema.json │ ├── postprocess_cases.txt │ ├── postprocess_cases_unsupported.txt │ ├── select_cases.txt │ ├── select_cases_unsupported.txt │ └── union_cases.txt │ ├── table │ ├── autoGeneratedKeys.yml │ ├── shardTable.yml │ ├── shardTableByLong.yml │ ├── shardTableByMode.yml │ └── shardTableByString.yml │ ├── testsuite-dev.properties │ ├── transaction │ ├── table_transaction_case.json │ ├── table_transaction_case_seq.json │ └── transaction.json │ ├── util │ └── splitmultiqueryutils.json │ ├── vitess_env │ ├── create_tables.sh │ ├── init_mysql_user.sh │ ├── setup.sh │ ├── vtdriver-env-v11.0.0.patch │ ├── vtdriver-env-v12.0.2.patch │ ├── vtdriver-env-v13.0.0.patch │ └── vtdriver │ │ ├── commerce_unsharded.sql │ │ ├── customer_sharded.sql │ │ ├── mysql_user.sql │ │ ├── vschema_commerce_unsharded.json │ │ └── vschema_customer_sharded.json │ └── vtdriver-split-table.yml └── vtdriver-spring-boot-starter ├── README.md ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── jd │ │ └── vtdriver │ │ └── spring │ │ └── boot │ │ └── autoconfigure │ │ ├── VtDriverAutoConfiguration.java │ │ ├── VtDriverSplitTable.java │ │ └── properties │ │ └── VtDriverSplitTableProperties.java └── resources │ └── META-INF │ └── spring.factories └── test ├── java └── com │ └── jd │ └── vtdriver │ └── spring │ └── boot │ ├── demo │ ├── VtdriverSpringbootApplication.java │ ├── mapper │ │ ├── TableMapper.java │ │ └── UserMapper.java │ └── model │ │ ├── Table.java │ │ └── User.java │ └── testcase │ ├── DemoTest.java │ └── VtDriverSplitTableTest.java └── resources ├── application-yaml.yaml └── application.properties /.github/workflows/image_push.yml: -------------------------------------------------------------------------------- 1 | name: image_push 2 | 3 | on: workflow_dispatch 4 | 5 | jobs: 6 | push_to_docker_hub: 7 | name: Build and push image to Docker Hub 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Check out the repo 11 | uses: actions/checkout@v2 12 | - name: Clone vitess repository 13 | uses: actions/checkout@v2 14 | with: 15 | repository: vitessio/vitess 16 | path: src/test/resources/vitess_env/build_vitess/vitess 17 | ref: v13.0.0 18 | - name: run setup.sh v13.0.0 19 | run: cd src/test/resources/vitess_env && chmod ug+x setup.sh && ./setup.sh 20 | - name: Log in to Docker Hub 21 | uses: docker/login-action@v1 22 | with: 23 | username: ${{ secrets.DOCKER_USERNAME }} 24 | password: ${{ secrets.DOCKERHUB_TOKEN }} 25 | - name: Push image to Docker Hub 26 | run: docker push vtdriverio/vtdriver-env:latest 27 | -------------------------------------------------------------------------------- /docs/Architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jd-opensource/vtdriver/4ec144cc589c232610dea62054cae16d7a75aa98/docs/Architecture.png -------------------------------------------------------------------------------- /docs/Idea.md: -------------------------------------------------------------------------------- 1 | ## IDEA配置 2 | ### lombok 3 | 由于VtDriver源码使用了lombok插件提供的一些注解,需要在IDEA中安装 4 | file-->setting-->plugins,输入 Lombok 搜索,进行安装 5 | 6 | ![lombok.png](lombok.png) 7 | ### proto编译 8 | VtDriver内部使用了一些proto生成的代码,已经把需要用到的类利用protobuf生成后放入VtDriver的目录下 9 | 若需要修改proto文件,可按照下面的步骤生成proto对应的java类,并放入源码中 10 | ![proto_2.png](proto_2.png) -------------------------------------------------------------------------------- /docs/VtDriver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jd-opensource/vtdriver/4ec144cc589c232610dea62054cae16d7a75aa98/docs/VtDriver.png -------------------------------------------------------------------------------- /docs/VtDriver适配.md: -------------------------------------------------------------------------------- 1 | ### VtDriver适配已有的Vitess环境 2 | 3 | 1. 修改ETCD_SERVER 4 | 5 | 如果部署的Vitess环境和项目不在同一机器上,要在vitess/examples/local/env.sh中修改ETCD_SERVER的ip修改为环境所部署机器的ip ( 6 | 不是127.0.0.1或者localhost),并重启生效。确保项目所在机器可以访问到ETCD 7 | 8 | 2. 运行测试用例(可选) 9 | 10 | 根据项目中的文件 11 | 12 | vtdriver/src/test/resources/config/commerce_unsharded.sql 13 | 14 | vtdriver/src/test/resources/config/customer_sharded.sql 15 | 16 | 分别对单分片和两分片的库创建表; 17 | 18 | 参考vSchema文件 19 | 20 | vtdriver/src/test/resources/config/vschema_commerce_unsharded.json 21 | 22 | vtdriver/src/test/resources/config/vschema_customer_sharded.json 23 | 24 | 更新vSchema; 25 | 26 | 设置相关库的sql_mode 27 | 28 | ```sql 29 | set global sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION'; 30 | ``` 31 | 32 | 3. 链接数据库 33 | 34 | 可参考[QuickStart.md](./QuickStart.md)的第二步进行配置 -------------------------------------------------------------------------------- /docs/architecture.en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jd-opensource/vtdriver/4ec144cc589c232610dea62054cae16d7a75aa98/docs/architecture.en.png -------------------------------------------------------------------------------- /docs/lombok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jd-opensource/vtdriver/4ec144cc589c232610dea62054cae16d7a75aa98/docs/lombok.png -------------------------------------------------------------------------------- /docs/preheat.md: -------------------------------------------------------------------------------- 1 | # VtDriver预热 2 | 3 | 应用启动时需要先连接元数据,获取MySQL的连接信息,然后再与底层的mysql建立连接,这个时间确实会比使用MySQL要长,因为分片场景要连接到多个MySQL。 4 | 5 | ## 预热方式 6 | ### Spring XML配置方式 7 | ``` 8 | 9 | ``` 10 | ### Spring Java Config配置方式 11 | ``` 12 | @Bean 13 | public VitessDataSourceInitializingBean vitessDataSourceInitializingBean() { 14 | return new VitessDataSourceInitializingBean(); 15 | } 16 | ``` 17 | ### SpringBoot也可以直接使用vtdriver-spring-boot-starter -------------------------------------------------------------------------------- /docs/proto_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jd-opensource/vtdriver/4ec144cc589c232610dea62054cae16d7a75aa98/docs/proto_2.png -------------------------------------------------------------------------------- /proto/src/main/proto/tableacl.proto: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Vitess Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Table ACL proto definitions. 18 | 19 | syntax = "proto3"; 20 | option go_package = "vitess.io/vitess/go/vt/proto/tableacl"; 21 | 22 | package tableacl; 23 | 24 | // TableGroupSpec defines ACLs for a group of tables. 25 | message TableGroupSpec { 26 | string name = 1; 27 | // either tables or a table name prefixes (if it ends in a %) 28 | repeated string table_names_or_prefixes = 2; 29 | repeated string readers = 3; 30 | repeated string writers = 4; 31 | repeated string admins = 5; 32 | } 33 | 34 | message Config { 35 | repeated TableGroupSpec table_groups = 1; 36 | } 37 | -------------------------------------------------------------------------------- /proto/src/main/proto/vtctlservice.proto: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Vitess Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // This package contains a service allowing you to use vtctld as a 18 | // proxy for vt commands. 19 | 20 | syntax = "proto3"; 21 | option go_package = "vitess.io/vitess/go/vt/proto/vtctlservice"; 22 | 23 | package vtctlservice; 24 | 25 | import "vtctldata.proto"; 26 | 27 | // Service Vtctl allows you to call vt commands through gRPC. 28 | service Vtctl { 29 | rpc ExecuteVtctlCommand (vtctldata.ExecuteVtctlCommandRequest) returns (stream vtctldata.ExecuteVtctlCommandResponse) {}; 30 | } 31 | -------------------------------------------------------------------------------- /proto/src/main/proto/vttime.proto: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Vitess Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // This package contains a shared time data structure 18 | 19 | syntax = "proto3"; 20 | option go_package = "vitess.io/vitess/go/vt/proto/vttime"; 21 | 22 | package vttime; 23 | 24 | // Time represents a time stamp in nanoseconds. In go, use logutil library 25 | // to convert times. 26 | message Time { 27 | int64 seconds = 1; 28 | int32 nanoseconds = 2; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /proto/src/main/proto/vtworkerdata.proto: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Vitess Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Data structures for the vtworker RPC interface. 18 | 19 | syntax = "proto3"; 20 | option go_package = "vitess.io/vitess/go/vt/proto/vtworkerdata"; 21 | 22 | package vtworkerdata; 23 | 24 | import "logutil.proto"; 25 | 26 | // ExecuteVtworkerCommandRequest is the payload for ExecuteVtworkerCommand. 27 | message ExecuteVtworkerCommandRequest { 28 | repeated string args = 1; 29 | } 30 | 31 | // ExecuteVtworkerCommandResponse is streamed back by ExecuteVtworkerCommand. 32 | message ExecuteVtworkerCommandResponse { 33 | logutil.Event event = 1; 34 | } 35 | -------------------------------------------------------------------------------- /proto/src/main/proto/vtworkerservice.proto: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2019 The Vitess Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // RPC interface for vtworker. 18 | // The interface is very similar to the vtctld interface (see vtctlservice.proto). 19 | 20 | syntax = "proto3"; 21 | option go_package = "vitess.io/vitess/go/vt/proto/vtworkerservice"; 22 | 23 | package vtworkerservice; 24 | 25 | import "vtworkerdata.proto"; 26 | 27 | // Vtworker contains the vtworker RPC calls. 28 | service Vtworker { 29 | // ExecuteVtworkerCommand allows to run a vtworker command by specifying the 30 | // same arguments as on the command line. 31 | rpc ExecuteVtworkerCommand (vtworkerdata.ExecuteVtworkerCommandRequest) returns (stream vtworkerdata.ExecuteVtworkerCommandResponse) {}; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/api/VtApiServerResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.api; 18 | 19 | import java.io.Serializable; 20 | import lombok.Getter; 21 | 22 | @Getter 23 | public enum VtApiServerResponse implements Serializable { 24 | /** 25 | * 26 | */ 27 | SUCCESS(200, "Success"), 28 | FAILURE(500, "Failure"); 29 | 30 | private final int code; 31 | 32 | private final String message; 33 | 34 | VtApiServerResponse(int code, String message) { 35 | this.code = code; 36 | this.message = message; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/common/util/Crc32Utill.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.common.util; 18 | 19 | import java.util.zip.CRC32; 20 | 21 | public class Crc32Utill { 22 | 23 | private Crc32Utill() { 24 | } 25 | 26 | public static long checksumByCrc32(byte[] b) { 27 | CRC32 crc32 = new CRC32(); 28 | crc32.update(b); 29 | return crc32.getValue(); 30 | } 31 | 32 | public static long checksumByCrc32(int b) { 33 | CRC32 crc32 = new CRC32(); 34 | crc32.update(b); 35 | return crc32.getValue(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/common/util/MapUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.common.util; 18 | 19 | import java.util.Map; 20 | import java.util.function.Function; 21 | 22 | public class MapUtil { 23 | private MapUtil() { 24 | } 25 | 26 | public static V computeIfAbsent(Map concurrentHashMap, K key, Function mappingFunction) { 27 | V value = concurrentHashMap.get(key); 28 | if (value != null) { 29 | return value; 30 | } 31 | return concurrentHashMap.computeIfAbsent(key, mappingFunction); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/concurrency/ErrorRecorder.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.concurrency; 20 | 21 | import java.sql.SQLException; 22 | 23 | public interface ErrorRecorder { 24 | 25 | /** 26 | * @param e 27 | */ 28 | void recordError(Exception e); 29 | 30 | /** 31 | * @return 32 | */ 33 | Boolean hasErrors(); 34 | 35 | /** 36 | * @return 37 | */ 38 | SQLException error(); 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/context/VtContextConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.context; 20 | 21 | public class VtContextConstant { 22 | public static final String EXECUTION_CANCELLED = "execution is cancelled. "; 23 | 24 | public static final String BEGIN_EXECUTION_CANCELLED = "begin execution is cancelled. "; 25 | 26 | public static final String STREAM_EXECUTION_CANCELLED = "stream execution is cancelled. "; 27 | 28 | public static final String CONTEXT_CANCELLED = "context is canceled. "; 29 | } -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/context/VtDeadlineContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.context; 20 | 21 | import java.util.Date; 22 | import java.util.Map; 23 | 24 | public class VtDeadlineContext extends VtCancelContext { 25 | 26 | public VtDeadlineContext(IContext parent, Date deadline, Map contextValues) { 27 | super(parent, contextValues); 28 | this.deadline = deadline; 29 | Date parentDeadline = parent.getDeadline(); 30 | if (parentDeadline != null && parentDeadline.before(deadline)) { 31 | this.deadline = parentDeadline; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/engine/OrderByParams.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.engine; 20 | 21 | import lombok.AllArgsConstructor; 22 | import lombok.Getter; 23 | import lombok.Setter; 24 | 25 | @AllArgsConstructor 26 | @Getter 27 | @Setter 28 | public class OrderByParams { 29 | Integer col; 30 | 31 | Boolean desc; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/engine/Plan.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.engine; 20 | 21 | import com.jd.jdbc.sqlparser.dialect.mysql.BindVarNeeds; 22 | import com.jd.jdbc.sqltypes.VtSqlStatementType; 23 | import lombok.AllArgsConstructor; 24 | import lombok.Data; 25 | 26 | @Data 27 | @AllArgsConstructor 28 | public class Plan { 29 | private VtSqlStatementType statementType; 30 | 31 | private PrimitiveEngine primitive; 32 | 33 | private BindVarNeeds bindVarNeeds; 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/engine/TableShardQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.engine; 20 | 21 | import com.jd.jdbc.context.IContext; 22 | import com.jd.jdbc.srvtopo.BindVariable; 23 | import com.jd.jdbc.srvtopo.BoundQuery; 24 | import com.jd.jdbc.srvtopo.ResolvedShard; 25 | import java.sql.SQLException; 26 | import java.util.List; 27 | import java.util.Map; 28 | 29 | public interface TableShardQuery { 30 | Map> getShardQueryList(final IContext ctx, final Vcursor vcursor, final Map bindVariableMap) throws SQLException; 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/engine/gen4/CheckCol.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.engine.gen4; 20 | 21 | import lombok.Getter; 22 | import lombok.Setter; 23 | 24 | public class CheckCol { 25 | @Getter 26 | private int col; 27 | 28 | @Setter 29 | @Getter 30 | private Integer wsCol; 31 | 32 | @Getter 33 | private int collation; 34 | 35 | public CheckCol(int col, int collation) { 36 | this.col = col; 37 | this.collation = collation; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/evalengine/Simplify.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.evalengine; 20 | 21 | import java.sql.SQLException; 22 | 23 | public class Simplify { 24 | public static EvalEngine.Expr simplifyExpr(EvalEngine.ExpressionEnv env, EvalEngine.Expr e) throws SQLException { 25 | if (e.constant()) { 26 | EvalResult res = env.evaluate(e); 27 | return new EvalEngine.Literal(res); 28 | } 29 | return e; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/evalengine/TranslationLookup.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.evalengine; 20 | 21 | import com.jd.jdbc.sqlparser.ast.SQLExpr; 22 | import com.jd.jdbc.sqlparser.ast.SQLName; 23 | import java.sql.SQLException; 24 | 25 | public interface TranslationLookup { 26 | 27 | int columnLookup(SQLName col) throws SQLException; 28 | 29 | int collationForExpr(SQLExpr expr); 30 | 31 | int defaultCollation(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/key/DestinationResolve.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.key; 20 | 21 | import java.sql.SQLException; 22 | 23 | /** 24 | * Destination resolve shard. 25 | */ 26 | public interface DestinationResolve { 27 | 28 | void resolve(String shard) throws SQLException; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/key/Shard.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.key; 20 | 21 | import io.vitess.proto.Topodata; 22 | import java.util.List; 23 | 24 | public interface Shard { 25 | List getShardReferences(String keyspace, int shardNumber); 26 | } -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/monitor/ConnectionCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.monitor; 18 | 19 | import io.prometheus.client.Histogram; 20 | 21 | public class ConnectionCollector { 22 | private static final Histogram HISTOGRAM = Histogram.build() 23 | .name("Connection_histogram") 24 | .labelNames("conn") 25 | .help("Connection histogram in seconds.") 26 | .buckets(DefaultConfig.BUCKETS) 27 | .register(MonitorServer.getCollectorRegistry()); 28 | 29 | public static Histogram getConnectionHistogram() { 30 | return HISTOGRAM; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/monitor/DefaultConfig.java: -------------------------------------------------------------------------------- 1 | package com.jd.jdbc.monitor; 2 | 3 | import com.google.common.collect.Lists; 4 | import java.util.List; 5 | 6 | public class DefaultConfig { 7 | public static final double[] BUCKETS = {0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1.0, 2.0, 5.0, 10.0}; 8 | 9 | public static final List HEALTH_CHECK_LABEL_NAMES = Lists.newArrayList("Cell", "Keyspace", "Shard", "TabletType", "Serving", "TabletAlias", "Uid", "IP"); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/monitor/PortCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.monitor; 18 | 19 | import io.prometheus.client.Gauge; 20 | 21 | public class PortCollector { 22 | private static final Gauge API_SERVER_PORT_GAUGE = Gauge.build() 23 | .name("api_server_port") 24 | .labelNames("prefix") 25 | .help("api server port info") 26 | .register(MonitorServer.getCollectorRegistry()); 27 | 28 | public static Gauge getApiServerPortGauge() { 29 | return API_SERVER_PORT_GAUGE; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/monitor/SplitTableUtilCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.monitor; 18 | 19 | import io.prometheus.client.Gauge; 20 | 21 | public class SplitTableUtilCollector { 22 | private static final Gauge SPLIT_TABLE_GAUGE = Gauge.build() 23 | .name("split_table_flag") 24 | .labelNames("Keyspace") 25 | .help("split table flag") 26 | .register(MonitorServer.getCollectorRegistry()); 27 | 28 | public static Gauge getSplitTableGauge() { 29 | return SPLIT_TABLE_GAUGE; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/monitor/VersionCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.monitor; 18 | 19 | import io.prometheus.client.Gauge; 20 | 21 | public class VersionCollector { 22 | private static final Gauge VTDRIVER_VERSION_COUNTER = Gauge.build() 23 | .name("VtDriver_version") 24 | .help("VtDriver version info") 25 | .labelNames("version") 26 | .register(MonitorServer.getCollectorRegistry()); 27 | 28 | public static Gauge getVersionGauge() { 29 | return VTDRIVER_VERSION_COUNTER; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/monitor/discovery/ResultDTO.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.monitor.discovery; 18 | 19 | import java.io.Serializable; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Data; 22 | import lombok.NoArgsConstructor; 23 | 24 | @Data 25 | @NoArgsConstructor 26 | @AllArgsConstructor 27 | public class ResultDTO implements Serializable { 28 | private static final long serialVersionUID = 2256366524603180634L; 29 | 30 | private Boolean success; 31 | 32 | private Integer code; 33 | 34 | private String msg; 35 | 36 | private T data; 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/planbuilder/Truncater.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder; 20 | 21 | public interface Truncater { 22 | /** 23 | * @param count 24 | */ 25 | void setTruncateColumnCount(Integer count); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/planbuilder/gen4/InnerJoin.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.gen4; 20 | 21 | import com.jd.jdbc.planbuilder.semantics.TableSet; 22 | import com.jd.jdbc.sqlparser.ast.SQLExpr; 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | import lombok.Getter; 26 | 27 | public class InnerJoin { 28 | 29 | @Getter 30 | private TableSet deps; 31 | 32 | @Getter 33 | private List exprs = new ArrayList<>(); 34 | 35 | public InnerJoin(TableSet ts, List asList) { 36 | this.deps = ts; 37 | this.exprs = asList; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/planbuilder/gen4/IntroducesTable.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.gen4; 20 | 21 | 22 | import vschema.Vschema; 23 | 24 | // IntroducesTable is used to make it possible to gather information about the table an operator introduces 25 | public interface IntroducesTable { 26 | QueryTable getQTable(); 27 | 28 | Vschema.Table getVTable(); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/planbuilder/gen4/Offsets.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.gen4; 20 | 21 | import lombok.AllArgsConstructor; 22 | import lombok.Getter; 23 | import lombok.Setter; 24 | 25 | @AllArgsConstructor 26 | public class Offsets { 27 | @Getter 28 | private Integer col; 29 | 30 | @Setter 31 | @Getter 32 | private Integer wsCol; 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/planbuilder/gen4/PlanVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.gen4; 20 | 21 | import com.jd.jdbc.common.tuple.Pair; 22 | import com.jd.jdbc.planbuilder.gen4.logical.LogicalPlan; 23 | import java.sql.SQLException; 24 | 25 | @FunctionalInterface 26 | public interface PlanVisitor { 27 | Pair func(LogicalPlan logicalPlan) throws SQLException; 28 | } -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/planbuilder/gen4/operator/physical/Cost.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.gen4.operator.physical; 20 | 21 | import com.jd.jdbc.engine.Engine; 22 | import lombok.Getter; 23 | import lombok.Setter; 24 | 25 | @Getter 26 | @Setter 27 | // Cost is used to make it easy to compare the Cost of two plans with each other 28 | public class Cost { 29 | 30 | private int vindexCost; 31 | 32 | private boolean isUnique; 33 | 34 | private Engine.RouteOpcode opCode; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/planbuilder/gen4/operator/physical/OpCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.gen4.operator.physical; 20 | 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | import lombok.Getter; 24 | import lombok.Setter; 25 | 26 | @Getter 27 | @Setter 28 | public class OpCache { 29 | private Map opCacheMap; 30 | 31 | public OpCache() { 32 | opCacheMap = new HashMap<>(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/planbuilder/semantics/ColumnInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.semantics; 20 | 21 | import lombok.Data; 22 | 23 | /** 24 | * ColumnInfo contains information about columns 25 | */ 26 | @Data 27 | public class ColumnInfo { 28 | 29 | private String name; 30 | 31 | private Type type; 32 | 33 | public ColumnInfo(String name, Type type) { 34 | this.name = name; 35 | this.type = type; 36 | } 37 | 38 | public ColumnInfo(String name) { 39 | this.name = name; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/planbuilder/semantics/Nothing.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.semantics; 20 | 21 | import java.sql.SQLException; 22 | 23 | public class Nothing implements Dependencies { 24 | 25 | public Nothing() { 26 | } 27 | 28 | @Override 29 | public boolean empty() { 30 | return true; 31 | } 32 | 33 | @Override 34 | public Dependency get() throws SQLException { 35 | return new Dependency(); 36 | } 37 | 38 | @Override 39 | public Dependencies merge(Dependencies d, boolean allowMulti) { 40 | return d; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/planbuilder/semantics/Type.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.semantics; 20 | 21 | import io.vitess.proto.Query; 22 | import lombok.Getter; 23 | 24 | /** 25 | * Type is the normal querypb.Type with collation 26 | */ 27 | @Getter 28 | public class Type { 29 | 30 | private Query.Type type; 31 | 32 | private int collations; 33 | 34 | public Type(Query.Type type) { 35 | this.type = type; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/pool/ExecuteResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.pool; 18 | 19 | import java.sql.Statement; 20 | 21 | public class ExecuteResult { 22 | private final Statement statement; 23 | 24 | private final boolean queryFlag; 25 | 26 | public ExecuteResult(Statement statement, boolean queryFlag) { 27 | this.statement = statement; 28 | this.queryFlag = queryFlag; 29 | } 30 | 31 | public Statement getStatement() { 32 | return statement; 33 | } 34 | 35 | public boolean getQueryFlag() { 36 | return queryFlag; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/queryservice/AbstractQueryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.queryservice; 20 | 21 | public abstract class AbstractQueryService implements QueryService { 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/queryservice/IHealthCheckQueryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.queryservice; 20 | 21 | import com.jd.jdbc.discovery.TabletHealthCheck; 22 | import io.grpc.stub.StreamObserver; 23 | import io.vitess.proto.Query; 24 | 25 | public interface IHealthCheckQueryService extends IParentQueryService { 26 | 27 | void streamHealth(TabletHealthCheck thc, StreamObserver responseObserver) throws Exception; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/queryservice/IParentQueryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.queryservice; 20 | 21 | public interface IParentQueryService { 22 | 23 | void close(); 24 | 25 | default void closeNativeQueryService() { 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/queryservice/QueryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.queryservice; 20 | 21 | public interface QueryService extends BlockingQueryService, AsyncQueryService { 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/queryservice/VtIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.queryservice; 20 | 21 | import java.sql.SQLException; 22 | 23 | public interface VtIterator extends AutoCloseable { 24 | 25 | boolean hasNext() throws SQLException; 26 | 27 | T next() throws SQLException; 28 | } -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/SQLExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast; 18 | 19 | import java.util.List; 20 | 21 | public interface SQLExpr extends SQLObject, Cloneable { 22 | SQLExpr clone(); 23 | 24 | SQLDataType computeDataType(); 25 | 26 | List getChildren(); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/SQLHint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast; 18 | 19 | public interface SQLHint extends SQLObject { 20 | @Override 21 | SQLHint clone(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/SQLName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast; 18 | 19 | import com.jd.jdbc.planbuilder.Column; 20 | 21 | public interface SQLName extends SQLExpr { 22 | String getSimpleName(); 23 | 24 | @Override 25 | SQLName clone(); 26 | 27 | long nameHashCode64(); 28 | 29 | long hashCode64(); 30 | 31 | Column getMetadata(); 32 | 33 | void setMetadata(Column column); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/SQLObjectWithDataType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast; 18 | 19 | public interface SQLObjectWithDataType extends SQLObject { 20 | SQLDataType getDataType(); 21 | 22 | void setDataType(SQLDataType dataType); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/SQLOrderingSpecification.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast; 18 | 19 | public enum SQLOrderingSpecification { 20 | ASC("ASC"), DESC("DESC"); 21 | 22 | public final String name; 23 | public final String name_lcase; 24 | 25 | private SQLOrderingSpecification(String name) { 26 | this.name = name; 27 | this.name_lcase = name.toLowerCase(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/SQLReplaceable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast; 18 | 19 | public interface SQLReplaceable { 20 | boolean replace(SQLExpr expr, SQLExpr target); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/SQLSetQuantifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast; 18 | 19 | public interface SQLSetQuantifier { 20 | 21 | // SQL 92 22 | public final static int ALL = 1; 23 | public final static int DISTINCT = 2; 24 | 25 | public final static int UNIQUE = 3; 26 | public final static int DISTINCTROW = 4; 27 | 28 | // 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/SQLStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast; 18 | 19 | import java.util.List; 20 | 21 | public interface SQLStatement extends SQLObject { 22 | String getDbType(); 23 | 24 | boolean isAfterSemi(); 25 | 26 | void setAfterSemi(boolean afterSemi); 27 | 28 | SQLStatement clone(); 29 | 30 | List getChildren(); 31 | 32 | String toLowerCaseString(); 33 | 34 | List getHeadHintsDirect(); 35 | 36 | void setHeadHints(List headHints); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/expr/SQLAggregateOption.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.expr; 18 | 19 | public enum SQLAggregateOption { 20 | 21 | DISTINCT, ALL, UNIQUE, // 22 | 23 | DEDUPLICATION // just for nut 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/expr/SQLIntervalUnit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.expr; 18 | 19 | public enum SQLIntervalUnit { 20 | YEAR, YEAR_MONTH, 21 | 22 | QUARTER, 23 | 24 | MONTH, WEEK, DAY, DAY_HOUR, DAY_MINUTE, DAY_SECOND, DAY_MICROSECOND, 25 | 26 | HOUR, HOUR_MINUTE, HOUR_SECOND, HOUR_MICROSECOND, 27 | 28 | MINUTE, MINUTE_SECOND, MINUTE_MICROSECOND, 29 | 30 | SECOND, SECOND_MICROSECOND, 31 | 32 | MICROSECOND; 33 | 34 | public final String name_lcase; 35 | 36 | private SQLIntervalUnit() { 37 | this.name_lcase = name().toLowerCase(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/expr/SQLLiteralExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.expr; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLExpr; 20 | 21 | public interface SQLLiteralExpr extends SQLExpr { 22 | SQLLiteralExpr clone(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/expr/SQLValuableExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.expr; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLExpr; 20 | 21 | public interface SQLValuableExpr extends SQLExpr { 22 | 23 | Object getValue(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/expr/SQLVariantRefListExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.expr; 18 | 19 | 20 | public class SQLVariantRefListExpr extends SQLVariantRefExpr { 21 | 22 | public SQLVariantRefListExpr(String name) { 23 | super(name); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLAlterStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLStatement; 20 | 21 | public interface SQLAlterStatement extends SQLStatement { 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLAlterTableDisableKeys.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLObjectImpl; 20 | import com.jd.jdbc.sqlparser.visitor.SQLASTVisitor; 21 | 22 | public class SQLAlterTableDisableKeys extends SQLObjectImpl implements SQLAlterTableItem { 23 | 24 | @Override 25 | protected void accept0(SQLASTVisitor visitor) { 26 | visitor.visit(this); 27 | visitor.endVisit(this); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLAlterTableDropPrimaryKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLObjectImpl; 20 | import com.jd.jdbc.sqlparser.visitor.SQLASTVisitor; 21 | 22 | public class SQLAlterTableDropPrimaryKey extends SQLObjectImpl implements SQLAlterTableItem { 23 | 24 | @Override 25 | protected void accept0(SQLASTVisitor visitor) { 26 | visitor.visit(this); 27 | visitor.endVisit(this); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLAlterTableEnableKeys.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLObjectImpl; 20 | import com.jd.jdbc.sqlparser.visitor.SQLASTVisitor; 21 | 22 | public class SQLAlterTableEnableKeys extends SQLObjectImpl implements SQLAlterTableItem { 23 | 24 | @Override 25 | protected void accept0(SQLASTVisitor visitor) { 26 | visitor.visit(this); 27 | visitor.endVisit(this); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLAlterTableItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLObject; 20 | 21 | public interface SQLAlterTableItem extends SQLObject { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLColumnConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.ast.statement; 17 | 18 | public interface SQLColumnConstraint extends SQLConstraint { 19 | SQLColumnConstraint clone(); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLExpr; 20 | import com.jd.jdbc.sqlparser.ast.SQLName; 21 | import com.jd.jdbc.sqlparser.ast.SQLObject; 22 | 23 | public interface SQLConstraint extends SQLObject { 24 | 25 | SQLName getName(); 26 | 27 | void setName(SQLName value); 28 | 29 | SQLExpr getComment(); 30 | 31 | void setComment(SQLExpr x); 32 | 33 | void simplify(); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLCreateStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | public interface SQLCreateStatement extends SQLDDLStatement { 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLDDLStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLStatement; 20 | 21 | 22 | public interface SQLDDLStatement extends SQLStatement { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLDropStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | public interface SQLDropStatement extends SQLDDLStatement { 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLForeignKeyConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLName; 20 | 21 | import java.util.List; 22 | 23 | public interface SQLForeignKeyConstraint extends SQLConstraint, SQLTableElement, SQLTableConstraint { 24 | 25 | List getReferencingColumns(); 26 | 27 | SQLExprTableSource getReferencedTable(); 28 | 29 | SQLName getReferencedTableName(); 30 | 31 | void setReferencedTableName(SQLName value); 32 | 33 | List getReferencedColumns(); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLNullConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.visitor.SQLASTVisitor; 20 | 21 | public class SQLNullConstraint extends SQLConstraintImpl implements SQLColumnConstraint { 22 | 23 | public SQLNullConstraint() { 24 | } 25 | 26 | @Override 27 | protected void accept0(SQLASTVisitor visitor) { 28 | visitor.visit(this); 29 | visitor.endVisit(this); 30 | } 31 | 32 | public SQLNullConstraint clone() { 33 | SQLNullConstraint x = new SQLNullConstraint(); 34 | super.cloneTo(x); 35 | return x; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLPrimaryKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.ast.statement; 17 | 18 | public interface SQLPrimaryKey extends SQLUniqueConstraint, SQLTableElement { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLScriptCommitStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.ast.SQLStatementImpl; 19 | import com.jd.jdbc.sqlparser.visitor.SQLASTVisitor; 20 | 21 | public class SQLScriptCommitStatement extends SQLStatementImpl { 22 | 23 | public SQLScriptCommitStatement() { 24 | 25 | } 26 | 27 | public void accept0(SQLASTVisitor visitor) { 28 | visitor.visit(this); 29 | visitor.endVisit(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLSelectQuery.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLObject; 20 | 21 | public interface SQLSelectQuery extends SQLObject { 22 | boolean isBracket(); 23 | 24 | void setBracket(boolean bracket); 25 | 26 | SQLSelectQuery clone(); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLShowErrorsStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLStatementImpl; 20 | import com.jd.jdbc.sqlparser.visitor.SQLASTVisitor; 21 | 22 | public class SQLShowErrorsStatement extends SQLStatementImpl { 23 | @Override 24 | protected void accept0(SQLASTVisitor visitor) { 25 | visitor.visit(this); 26 | visitor.endVisit(this); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLTableConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.ast.statement; 17 | 18 | public interface SQLTableConstraint extends SQLConstraint, SQLTableElement { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLTableElement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.ast.statement; 18 | 19 | import com.jd.jdbc.sqlparser.ast.SQLObject; 20 | 21 | public interface SQLTableElement extends SQLObject { 22 | SQLTableElement clone(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLUnionOperator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.ast.statement; 17 | 18 | public enum SQLUnionOperator { 19 | UNION("UNION"), 20 | UNION_ALL("UNION ALL"), 21 | MINUS("MINUS"), EXCEPT("EXCEPT"), 22 | INTERSECT("INTERSECT"), 23 | DISTINCT("UNION DISTINCT"); 24 | 25 | public final String name; 26 | public final String name_lcase; 27 | 28 | private SQLUnionOperator(String name) { 29 | this.name = name; 30 | this.name_lcase = name.toLowerCase(); 31 | } 32 | 33 | public String toString() { 34 | return name; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/ast/statement/SQLUniqueConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.ast.statement; 17 | 18 | import java.util.List; 19 | 20 | public interface SQLUniqueConstraint extends SQLConstraint { 21 | 22 | List getColumns(); 23 | 24 | boolean containsColumn(String column); 25 | 26 | boolean containsColumn(long columnNameHash); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/MySqlForceIndexHint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlForceIndexHint extends MySqlIndexHintImpl { 21 | 22 | @Override 23 | public void accept0(MySqlASTVisitor visitor) { 24 | if (visitor.visit(this)) { 25 | acceptChild(visitor, getIndexList()); 26 | } 27 | visitor.endVisit(this); 28 | } 29 | 30 | public MySqlForceIndexHint clone() { 31 | MySqlForceIndexHint x = new MySqlForceIndexHint(); 32 | cloneTo(x); 33 | return x; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/MySqlHint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast; 17 | 18 | import com.jd.jdbc.sqlparser.ast.SQLHint; 19 | 20 | 21 | public interface MySqlHint extends SQLHint, MySqlObject { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/MySqlIndexHint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast; 17 | 18 | public interface MySqlIndexHint extends MySqlHint { 19 | public static enum Option { 20 | JOIN("JOIN"), 21 | ORDER_BY("ORDER BY"), 22 | GROUP_BY("GROUP BY"); 23 | 24 | public final String name; 25 | public final String name_lcase; 26 | 27 | Option(String name) { 28 | this.name = name; 29 | this.name_lcase = name.toLowerCase(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/MySqlObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast; 17 | 18 | import com.jd.jdbc.sqlparser.ast.SQLObject; 19 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 20 | 21 | 22 | public interface MySqlObject extends SQLObject { 23 | void accept0(MySqlASTVisitor visitor); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/MySqlUseIndexHint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlUseIndexHint extends MySqlIndexHintImpl { 21 | 22 | @Override 23 | public void accept0(MySqlASTVisitor visitor) { 24 | if (visitor.visit(this)) { 25 | acceptChild(visitor, getIndexList()); 26 | } 27 | visitor.endVisit(this); 28 | } 29 | 30 | public MySqlUseIndexHint clone() { 31 | MySqlUseIndexHint x = new MySqlUseIndexHint(); 32 | cloneTo(x); 33 | return x; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/clause/MySqlExplainType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.clause; 17 | 18 | public enum MySqlExplainType { 19 | 20 | EXTENDED, 21 | PARTITIONS, 22 | FORMAT 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/clause/MySqlFormatName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.clause; 17 | 18 | public enum MySqlFormatName { 19 | 20 | TRADITIONAL, 21 | JSON 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/clause/MySqlHandlerType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.clause; 17 | 18 | /** 19 | * @author zhujun [zhujunxxxxx@163.com] 20 | */ 21 | public enum MySqlHandlerType { 22 | //DECLARE处理程序handler_type 23 | 24 | CONTINUE, 25 | EXIT, 26 | UNDO 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/expr/MySqlExpr.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.expr; 17 | 18 | import com.jd.jdbc.sqlparser.ast.SQLExpr; 19 | 20 | public interface MySqlExpr extends SQLExpr { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/expr/MySqlExprImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.expr; 17 | 18 | import com.jd.jdbc.sqlparser.ast.SQLExpr; 19 | import com.jd.jdbc.sqlparser.dialect.mysql.ast.MySqlObjectImpl; 20 | 21 | public abstract class MySqlExprImpl extends MySqlObjectImpl implements SQLExpr { 22 | public SQLExpr clone() { 23 | throw new UnsupportedOperationException(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/CobarShowStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class CobarShowStatus extends MySqlStatementImpl { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | 25 | visitor.endVisit(this); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowAuthorsStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlShowAuthorsStatement extends MySqlStatementImpl implements MySqlShowStatement { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowBinaryLogsStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlShowBinaryLogsStatement extends MySqlStatementImpl implements MySqlShowStatement { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowContributorsStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlShowContributorsStatement extends MySqlStatementImpl implements MySqlShowStatement { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowMasterLogsStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlShowMasterLogsStatement extends MySqlStatementImpl implements MySqlShowStatement { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowMasterStatusStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlShowMasterStatusStatement extends MySqlStatementImpl implements MySqlShowStatement { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowPluginsStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlShowPluginsStatement extends MySqlStatementImpl implements MySqlShowStatement { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowPrivilegesStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlShowPrivilegesStatement extends MySqlStatementImpl implements MySqlShowStatement { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowProfilesStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlShowProfilesStatement extends MySqlStatementImpl implements MySqlShowStatement { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowSlaveHostsStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlShowSlaveHostsStatement extends MySqlStatementImpl implements MySqlShowStatement { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowSlaveStatusStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlShowSlaveStatusStatement extends MySqlStatementImpl implements MySqlShowStatement { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlShowStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | public interface MySqlShowStatement extends MySqlStatement { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.ast.SQLStatement; 19 | import com.jd.jdbc.sqlparser.dialect.mysql.ast.MySqlObject; 20 | 21 | public interface MySqlStatement extends SQLStatement, MySqlObject { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/ast/statement/MySqlUnlockTablesStatement.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.dialect.mysql.ast.statement; 17 | 18 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitor; 19 | 20 | public class MySqlUnlockTablesStatement extends MySqlStatementImpl { 21 | 22 | public void accept0(MySqlASTVisitor visitor) { 23 | visitor.visit(this); 24 | visitor.endVisit(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/dialect/mysql/visitor/AddDualVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.dialect.mysql.visitor; 18 | 19 | import com.jd.jdbc.sqlparser.ast.expr.SQLIdentifierExpr; 20 | import com.jd.jdbc.sqlparser.ast.statement.SQLExprTableSource; 21 | import com.jd.jdbc.sqlparser.dialect.mysql.ast.statement.MySqlSelectQueryBlock; 22 | import com.jd.jdbc.sqlparser.parser.Token; 23 | 24 | public class AddDualVisitor extends MySqlASTVisitorAdapter { 25 | @Override 26 | public boolean visit(MySqlSelectQueryBlock x) { 27 | if (x.getFrom() == null) { 28 | x.setFrom(new SQLExprTableSource(new SQLIdentifierExpr(Token.DUAL.name))); 29 | } 30 | return true; 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/parser/EOFParserException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.parser; 17 | 18 | @SuppressWarnings("serial") 19 | public class EOFParserException extends ParserException { 20 | 21 | public EOFParserException() { 22 | super("EOF"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/parser/NotAllowCommentException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.parser; 17 | 18 | public class NotAllowCommentException extends ParserException { 19 | 20 | private static final long serialVersionUID = 1L; 21 | 22 | public NotAllowCommentException() { 23 | this("comment not allow"); 24 | } 25 | 26 | public NotAllowCommentException(String message, Throwable e) { 27 | super(message, e); 28 | } 29 | 30 | public NotAllowCommentException(String message) { 31 | super(message); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/parser/SQLParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.parser; 17 | 18 | /** 19 | * @author wenshao [szujobs@hotmail.com] 20 | */ 21 | @SuppressWarnings("serial") 22 | @Deprecated 23 | public class SQLParseException extends VitessRuntimeException { 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/parser/VitessRuntimeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.parser; 18 | 19 | /** 20 | * @date 2020/8/25 11:29 上午 21 | * @description 22 | */ 23 | public class VitessRuntimeException extends RuntimeException { 24 | 25 | public VitessRuntimeException() { 26 | super(); 27 | } 28 | 29 | public VitessRuntimeException(String msg) { 30 | super(msg); 31 | } 32 | 33 | public VitessRuntimeException(String msg, Exception e) { 34 | super(msg, e); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/repository/SchemaObjectType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.repository; 17 | 18 | /** 19 | * Created by wenshao on 08/06/2017. 20 | */ 21 | public enum SchemaObjectType { 22 | Sequence, Table, View, Index, Function 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/support/json/JSONUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.support.json; 17 | 18 | public class JSONUtils { 19 | 20 | public static String toJSONString(Object o) { 21 | JSONWriter writer = new JSONWriter(); 22 | writer.writeObject(o); 23 | return writer.toString(); 24 | } 25 | 26 | public static Object parse(String text) { 27 | JSONParser parser = new JSONParser(text); 28 | return parser.parse(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/utils/Consumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.utils; 17 | 18 | /** 19 | * Created by wenshao on 20/06/2017. 20 | */ 21 | public interface Consumer { 22 | void accept(T t); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/utils/ResultSetConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.utils; 18 | 19 | import java.sql.ResultSet; 20 | import java.sql.SQLException; 21 | 22 | public interface ResultSetConsumer { 23 | T apply(ResultSet rs) throws SQLException; 24 | 25 | void accept(T object); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/visitor/CheckUnionVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.sqlparser.visitor; 20 | 21 | import com.jd.jdbc.sqlparser.ast.expr.SQLPropertyExpr; 22 | import com.jd.jdbc.sqlparser.dialect.mysql.visitor.MySqlASTVisitorAdapter; 23 | import lombok.Getter; 24 | 25 | public class CheckUnionVisitor extends MySqlASTVisitorAdapter { 26 | @Getter 27 | private String err; 28 | 29 | @Override 30 | public boolean visit(SQLPropertyExpr x) { 31 | err = "Table '" + x.getOwnernName() + "' from one of the SELECTs cannot be used in global ORDER clause"; 32 | return false; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/visitor/ExportParameterVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.visitor; 18 | 19 | import java.util.List; 20 | 21 | 22 | public interface ExportParameterVisitor extends SQLASTVisitor { 23 | boolean isParameterizedMergeInList(); 24 | 25 | void setParameterizedMergeInList(boolean flag); 26 | 27 | List getParameters(); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/visitor/ParameterizedVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.visitor; 17 | 18 | import java.util.List; 19 | 20 | public interface ParameterizedVisitor extends PrintableVisitor { 21 | 22 | int getReplaceCount(); 23 | 24 | void incrementReplaceCunt(); 25 | 26 | String getDbType(); 27 | 28 | void setOutputParameters(List parameters); 29 | 30 | void config(VisitorFeature feature, boolean state); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/visitor/PrintableVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.visitor; 18 | 19 | public interface PrintableVisitor extends SQLASTVisitor { 20 | boolean isUppCase(); 21 | 22 | void print(char value); 23 | 24 | void print(String text); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/visitor/SQLTransformVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.visitor; 17 | 18 | /** 19 | * Created by wenshao on 16/07/2017. 20 | */ 21 | public interface SQLTransformVisitor extends SQLASTVisitor { 22 | String getSrcDbType(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/visitor/functions/Function.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2017 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqlparser.visitor.functions; 18 | 19 | import com.jd.jdbc.sqlparser.ast.expr.SQLMethodInvokeExpr; 20 | import com.jd.jdbc.sqlparser.visitor.SQLEvalVisitor; 21 | 22 | public interface Function { 23 | Object eval(SQLEvalVisitor visitor, SQLMethodInvokeExpr x); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/visitor/functions/Nil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.visitor.functions; 17 | 18 | import com.jd.jdbc.sqlparser.ast.expr.SQLMethodInvokeExpr; 19 | import com.jd.jdbc.sqlparser.visitor.SQLEvalVisitor; 20 | 21 | public class Nil implements Function { 22 | 23 | public final static Nil instance = new Nil(); 24 | 25 | @Override 26 | public Object eval(SQLEvalVisitor visitor, SQLMethodInvokeExpr x) { 27 | return null; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqlparser/visitor/functions/Now.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jd.jdbc.sqlparser.visitor.functions; 17 | 18 | import com.jd.jdbc.sqlparser.ast.expr.SQLMethodInvokeExpr; 19 | import com.jd.jdbc.sqlparser.visitor.SQLEvalVisitor; 20 | 21 | import java.util.Date; 22 | 23 | 24 | public class Now implements Function { 25 | public final static Now instance = new Now(); 26 | 27 | public Object eval(SQLEvalVisitor visitor, SQLMethodInvokeExpr x) { 28 | return new Date(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqltypes/BatchVtResultSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqltypes; 18 | 19 | import java.util.List; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Getter; 22 | 23 | @AllArgsConstructor 24 | @Getter 25 | public class BatchVtResultSet implements VtResultSetMessage { 26 | List vtResultSets; 27 | } -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqltypes/BeginBatchVtResultSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqltypes; 18 | 19 | import io.vitess.proto.Topodata; 20 | import java.util.List; 21 | import lombok.AllArgsConstructor; 22 | import lombok.Getter; 23 | 24 | @AllArgsConstructor 25 | @Getter 26 | public class BeginBatchVtResultSet implements VtResultSetMessage { 27 | private final Topodata.TabletAlias alias; 28 | 29 | private final Long transactionId; 30 | 31 | List vtResultSets; 32 | } -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqltypes/BeginVtResultSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.sqltypes; 18 | 19 | import io.vitess.proto.Topodata; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Getter; 22 | 23 | @AllArgsConstructor 24 | @Getter 25 | public class BeginVtResultSet implements VtResultSetMessage { 26 | private final Topodata.TabletAlias alias; 27 | 28 | private final Long transactionId; 29 | 30 | private final VtResultSet vtResultSet; 31 | } -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/sqltypes/VtResultSetMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.sqltypes; 20 | 21 | public interface VtResultSetMessage { 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/srvtopo/ResolvedShard.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.srvtopo; 20 | 21 | import com.jd.jdbc.queryservice.IQueryService; 22 | import com.jd.jdbc.queryservice.RetryTabletQueryService; 23 | import io.vitess.proto.Query; 24 | import lombok.Data; 25 | 26 | @Data 27 | public class ResolvedShard { 28 | Query.Target target; 29 | 30 | Gateway gateway; 31 | 32 | public IQueryService getQueryService() { 33 | return new RetryTabletQueryService(gateway); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/srvtopo/SrvTopoException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.srvtopo; 20 | 21 | public class SrvTopoException extends Exception { 22 | /** 23 | * Constructs a new exception with the specified detail message. The 24 | * cause is not initialized, and may subsequently be initialized by 25 | * a call to {@link #initCause}. 26 | * 27 | * @param message the detail message. The detail message is saved for 28 | * later retrieval by the {@link #getMessage()} method. 29 | */ 30 | public SrvTopoException(String message) { 31 | super(message); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/tindexes/TableIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.tindexes; 18 | 19 | import com.google.protobuf.ByteString; 20 | 21 | public interface TableIndex { 22 | int getIndex(ByteString value, int tablesNum); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/tindexes/TableRuleMod.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.tindexes; 18 | 19 | import com.google.protobuf.ByteString; 20 | 21 | public class TableRuleMod implements TableIndex { 22 | @Override 23 | public int getIndex(final ByteString value, final int tablesNum) { 24 | int inth = Math.abs(value.hashCode()); 25 | return inth % tablesNum; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/tindexes/config/LogicTableConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.tindexes.config; 18 | 19 | import lombok.Getter; 20 | import lombok.Setter; 21 | 22 | @Setter 23 | @Getter 24 | public class LogicTableConfig { 25 | private String logicTable; 26 | 27 | private String actualTableExprs; 28 | 29 | private String shardingColumnName; 30 | 31 | private String shardingColumnType; 32 | 33 | private String shardingAlgorithms; 34 | 35 | private String sequenceColumnName; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/tindexes/config/SchemaConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.tindexes.config; 18 | 19 | import java.util.List; 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | @Setter 24 | @Getter 25 | public class SchemaConfig { 26 | private String schema; 27 | 28 | private List logicTables; 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/tindexes/config/SplitTableConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.tindexes.config; 18 | 19 | import java.util.List; 20 | import lombok.Getter; 21 | import lombok.Setter; 22 | 23 | @Setter 24 | @Getter 25 | public class SplitTableConfig { 26 | private List schemas; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/topo/Resource.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.topo; 20 | 21 | public interface Resource { 22 | /** 23 | * 24 | */ 25 | void close(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/topo/TopoCellInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.topo; 20 | 21 | import com.jd.jdbc.context.IContext; 22 | import io.vitess.proto.Topodata; 23 | 24 | public interface TopoCellInfo { 25 | 26 | /** 27 | * @param ctx 28 | * @param cell 29 | * @param strongRead 30 | * @return 31 | * @throws TopoException 32 | */ 33 | Topodata.CellInfo getCellInfo(IContext ctx, String cell, Boolean strongRead) throws TopoException; 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/topo/TopoFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.topo; 20 | 21 | public interface TopoFactory { 22 | 23 | /** 24 | * @param name 25 | * @param id 26 | * @return 27 | */ 28 | Boolean hasGlobalReadOnlyCell(String name, String id); 29 | 30 | /** 31 | * @param cell 32 | * @param serverAddr 33 | * @param root 34 | * @return 35 | * @throws TopoException 36 | */ 37 | TopoConnection create(String cell, String serverAddr, String root) throws TopoException; 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/topo/TopoSrvKeyspace.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.topo; 20 | 21 | import com.jd.jdbc.context.IContext; 22 | import io.vitess.proto.Topodata; 23 | 24 | public interface TopoSrvKeyspace { 25 | 26 | /** 27 | * @param ctx 28 | * @param cell 29 | * @param keyspace 30 | * @return 31 | * @throws TopoException 32 | */ 33 | Topodata.SrvKeyspace getSrvKeyspace(IContext ctx, String cell, String keyspace) throws TopoException; 34 | 35 | Topodata.SrvKeyspace getAndWatchSrvKeyspace(IContext ctx, String cell, String keyspace) throws TopoException; 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/topo/TopoVschema.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.topo; 20 | 21 | import com.jd.jdbc.context.IContext; 22 | import vschema.Vschema; 23 | 24 | public interface TopoVschema { 25 | 26 | /** 27 | * @param ctx 28 | * @param keyspace 29 | * @return 30 | * @throws TopoException 31 | */ 32 | Vschema.Keyspace getVschema(IContext ctx, String keyspace) throws TopoException; 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/util/TimeUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.util; 18 | 19 | import com.jd.jdbc.vitess.mysql.VitessPropertyKey; 20 | import java.util.Properties; 21 | import java.util.TimeZone; 22 | 23 | public class TimeUtil { 24 | public static TimeZone getTimeZone(Properties prop) { 25 | String canonicalTimezone = prop.getProperty(VitessPropertyKey.SERVER_TIMEZONE.getKeyName()); 26 | return TimeZone.getTimeZone(canonicalTimezone); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/util/cache/CacheBase.java: -------------------------------------------------------------------------------- 1 | package com.jd.jdbc.util.cache; 2 | 3 | public interface CacheBase { 4 | 5 | /** 6 | * @param key 7 | * @return 8 | */ 9 | T get(String key); 10 | 11 | /** 12 | * @param key 13 | * @param value 14 | */ 15 | void set(String key, T value); 16 | 17 | /** 18 | * @return 19 | */ 20 | Integer size(); 21 | 22 | /** 23 | * @return 24 | */ 25 | Integer capacity(); 26 | 27 | /** 28 | * 29 | */ 30 | void clear(); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/util/consolidator/Result.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.util.consolidator; 20 | 21 | import com.jd.jdbc.Executor; 22 | import java.sql.SQLException; 23 | import java.util.concurrent.atomic.AtomicInteger; 24 | import lombok.AllArgsConstructor; 25 | import lombok.Getter; 26 | import lombok.Setter; 27 | 28 | @AllArgsConstructor 29 | @Setter 30 | @Getter 31 | public class Result { 32 | private Executor.ExecuteResponse executeResponse; 33 | 34 | private AtomicInteger queryCounter; 35 | 36 | private SQLException e; 37 | 38 | public Result() { 39 | this.queryCounter = new AtomicInteger(0); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/vindexes/LookupPlanable.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2023 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2022 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.vindexes; 20 | 21 | import com.jd.jdbc.key.Destination; 22 | import com.jd.jdbc.sqltypes.VtResultSet; 23 | import com.jd.jdbc.sqltypes.VtValue; 24 | 25 | // LookupPlanable are for lookup vindexes where we can extract the lookup query at plan time 26 | public interface LookupPlanable { 27 | String String(); 28 | 29 | String[] Query(); // (selQuery string, arguments []string) 30 | 31 | Destination[] MapResult(VtValue[] ids, VtResultSet[] results); 32 | 33 | Boolean AllowBatch(); 34 | 35 | Object GetCommitOrder(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/vindexes/VschemaConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.vindexes; 20 | 21 | public class VschemaConstant { 22 | public static final String TYPE_PINNED_TABLE = ""; 23 | 24 | public static final String CODE_PINNED_TABLE = "00"; 25 | 26 | public static final String TYPE_SEQUENCE = "sequence"; 27 | 28 | public static final String TYPE_REFERENCE = "reference"; 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/vindexes/hash/MurmurVtValueIndex.java: -------------------------------------------------------------------------------- 1 | package com.jd.jdbc.vindexes.hash; 2 | 3 | import com.google.common.hash.HashCode; 4 | import com.google.common.hash.HashFunction; 5 | import com.google.common.hash.Hashing; 6 | import com.jd.jdbc.sqltypes.VtValue; 7 | import java.math.BigInteger; 8 | 9 | public class MurmurVtValueIndex implements VtValueIndex { 10 | @Override 11 | public BigInteger getIndex(VtValue vtValue) { 12 | BigInteger bi; 13 | if (vtValue.isSigned()) { 14 | bi = new BigInteger(vtValue.toString()); 15 | } else { 16 | try { 17 | bi = Arithmetic.toUint64(vtValue); 18 | } catch (Exception e) { 19 | HashFunction hashFunction = Hashing.murmur3_128(); 20 | HashCode hashCode = hashFunction.hashBytes(vtValue.raw() == null ? "".getBytes() : vtValue.toString().trim().toLowerCase().getBytes()); 21 | bi = BigInteger.valueOf(hashCode.asLong()); 22 | } 23 | } 24 | return bi; 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/java/com/jd/jdbc/vindexes/hash/VtValueIndex.java: -------------------------------------------------------------------------------- 1 | package com.jd.jdbc.vindexes.hash; 2 | 3 | import com.jd.jdbc.sqltypes.VtValue; 4 | import java.math.BigInteger; 5 | 6 | public interface VtValueIndex { 7 | BigInteger getIndex(VtValue id); 8 | } 9 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/com.jd.jdbc.tindexes.TableIndex: -------------------------------------------------------------------------------- 1 | # Copyright 2021 JD Project Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | com.jd.jdbc.tindexes.TableRuleMod 16 | com.jd.jdbc.tindexes.ShardTableByMurmur -------------------------------------------------------------------------------- /src/main/resources/META-INF/services/java.sql.Driver: -------------------------------------------------------------------------------- 1 | # Copyright 2021 JD Project Authors. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | com.jd.jdbc.vitess.VitessDriver -------------------------------------------------------------------------------- /src/main/resources/vtdriver-version.properties: -------------------------------------------------------------------------------- 1 | version=${project.version} -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Authoritative.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class Authoritative extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/AutoIncrement.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class AutoIncrement { 24 | 25 | @JsonProperty("sequence") 26 | private String sequence; 27 | 28 | @JsonProperty("column") 29 | private String column; 30 | 31 | public String getSequence() { 32 | return sequence; 33 | } 34 | 35 | public String getColumn() { 36 | return column; 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/ColumnVindexesItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class ColumnVindexesItem { 24 | 25 | @JsonProperty("column") 26 | private String column; 27 | 28 | @JsonProperty("name") 29 | private String name; 30 | 31 | public String getColumn() { 32 | return column; 33 | } 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/ColumnsItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class ColumnsItem { 24 | 25 | @JsonProperty("name") 26 | private String name; 27 | 28 | @JsonProperty("type") 29 | private String type; 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public String getType() { 36 | return type; 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Dual.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class Dual extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Foo.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class Foo extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Hash.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class Hash { 24 | 25 | @JsonProperty("type") 26 | private String type; 27 | 28 | public String getType() { 29 | return type; 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Keyspaces.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class Keyspaces { 24 | 25 | @JsonProperty("second_user") 26 | private SecondUser secondUser; 27 | 28 | @JsonProperty("main") 29 | private Main main; 30 | 31 | @JsonProperty("user") 32 | private User user; 33 | 34 | public SecondUser getSecondUser() { 35 | return secondUser; 36 | } 37 | 38 | public Main getMain() { 39 | return main; 40 | } 41 | 42 | public User getUser() { 43 | return user; 44 | } 45 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/M1.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class M1 extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class Main { 24 | 25 | @JsonProperty("tables") 26 | private Tables tables; 27 | 28 | public Tables getTables() { 29 | return tables; 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Multicolvin.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class Multicolvin extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Music.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class Music extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/MusicExtra.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class MusicExtra extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/OverlapVindex.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class OverlapVindex extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/PinTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class PinTest extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/PlanVschema.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class PlanVschema { 24 | 25 | @JsonProperty("keyspaces") 26 | private Keyspaces keyspaces; 27 | 28 | public Keyspaces getKeyspaces() { 29 | return keyspaces; 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Samecolvin.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class Samecolvin extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Seq.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class Seq extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Test.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class Test extends AbstractTable { 22 | } 23 | -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Unsharded.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class Unsharded extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/UnshardedA.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class UnshardedA extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/UnshardedAuthoritative.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class UnshardedAuthoritative extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/UnshardedAuto.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class UnshardedAuto extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/UnshardedB.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class UnshardedB extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/UserExtra.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class UserExtra extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/UserMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class UserMetadata extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/Vindexes.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | public class Vindexes { 24 | 25 | @JsonProperty("hash") 26 | private Hash hash; 27 | 28 | public Hash getHash() { 29 | return hash; 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/planbuilder/vschema/WeirdName.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.planbuilder.vschema; 20 | 21 | public class WeirdName extends AbstractTable { 22 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/queryservice/TabletDialerAgent.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. Licensed under Apache-2.0. 3 | 4 | Copyright 2019 The Vitess Authors. 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); 7 | you may not use this file except in compliance with the License. 8 | You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | See the License for the specific language governing permissions and 16 | limitations under the License. 17 | */ 18 | 19 | package com.jd.jdbc.queryservice; 20 | 21 | import io.vitess.proto.Topodata; 22 | 23 | public class TabletDialerAgent { 24 | public static void registerTabletCache(final Topodata.Tablet tablet, final IParentQueryService combinedQueryService) { 25 | TabletDialer.registerTabletCache(tablet, combinedQueryService); 26 | } 27 | 28 | public static void clearTabletCache() { 29 | TabletDialer.clearTabletCache(); 30 | } 31 | 32 | public static void close(final Topodata.Tablet tablet) { 33 | TabletDialer.close(tablet); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/table/engine/unshard/DeleteUnShardTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.table.engine.unshard; 18 | 19 | import com.jd.jdbc.table.engine.DeleteTest; 20 | import java.sql.SQLException; 21 | import testsuite.internal.TestSuiteShardSpec; 22 | 23 | public class DeleteUnShardTest extends DeleteTest { 24 | 25 | @Override 26 | protected void getConn() throws SQLException { 27 | conn = getConnection(Driver.of(TestSuiteShardSpec.NO_SHARDS)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/table/engine/unshard/UpdateUnShardTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.table.engine.unshard; 18 | 19 | import com.jd.jdbc.table.engine.UpdateTest; 20 | import java.sql.SQLException; 21 | import testsuite.internal.TestSuiteShardSpec; 22 | 23 | public class UpdateUnShardTest extends UpdateTest { 24 | 25 | @Override 26 | protected void getConn() throws SQLException { 27 | conn = getConnection(Driver.of(TestSuiteShardSpec.NO_SHARDS)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/table/unshard/ConcurrentSplitTableUnshardTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.table.unshard; 18 | 19 | import com.jd.jdbc.table.ConcurrentSplitTableTest; 20 | import java.sql.Connection; 21 | import java.sql.SQLException; 22 | import testsuite.internal.TestSuiteShardSpec; 23 | 24 | public class ConcurrentSplitTableUnshardTest extends ConcurrentSplitTableTest { 25 | @Override 26 | protected Connection getTaskConnection() throws SQLException { 27 | return getConnection(Driver.of(TestSuiteShardSpec.NO_SHARDS)); 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/table/unshard/LastInsertIdUnShardTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.table.unshard; 18 | 19 | import com.jd.jdbc.table.LastInsertIdTest; 20 | import java.sql.SQLException; 21 | import testsuite.internal.TestSuiteShardSpec; 22 | 23 | public class LastInsertIdUnShardTest extends LastInsertIdTest { 24 | 25 | @Override 26 | protected void getConn() throws SQLException { 27 | driverConnection = getConnection(Driver.of(TestSuiteShardSpec.NO_SHARDS)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/com/jd/jdbc/table/unshard/TableAutoGeneratedKeysUnShardTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package com.jd.jdbc.table.unshard; 18 | 19 | import com.jd.jdbc.table.TableAutoGeneratedKeysTest; 20 | import java.sql.SQLException; 21 | import testsuite.internal.TestSuiteShardSpec; 22 | 23 | public class TableAutoGeneratedKeysUnShardTest extends TableAutoGeneratedKeysTest { 24 | 25 | @Override 26 | protected void getConn() throws SQLException { 27 | conn = getConnection(Driver.of(TestSuiteShardSpec.NO_SHARDS)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/test/java/testsuite/internal/config/TestSuiteCfgPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 JD Project Authors. 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package testsuite.internal.config; 18 | 19 | public enum TestSuiteCfgPath { 20 | /** 21 | * dev config path 22 | */ 23 | DEV("testsuite-dev.properties"); 24 | 25 | public String path; 26 | 27 | TestSuiteCfgPath(String path) { 28 | this.path = path; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/test/resources/engine/selectengine/bug_in_resolve_cases/select_cases.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "comment": "# Booleans and parenthesis", 4 | "initSql": [ 5 | "delete from plan_test", 6 | "insert into plan_test(f_tinyint, f_bit) values (1, true)", 7 | "insert into plan_test(f_tinyint, f_bit) values (2, true)" 8 | ], 9 | "fields": [ 10 | { 11 | "name": "f_tinyint" 12 | }, 13 | { 14 | "name": "f_timestamp" 15 | }, 16 | { 17 | "name": "f_bit" 18 | } 19 | ], 20 | "query": "select * from plan_test where (f_tinyint = 1) AND f_bit = true limit 5", 21 | "verifyResult": [ 22 | { 23 | "f_tinyint": "1", 24 | "f_bit": true 25 | } 26 | ] 27 | } 28 | ] -------------------------------------------------------------------------------- /src/test/resources/engine/tableengine/multiquery/select_case.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "comment": "# '*' expression for simple route", 4 | "initSql": [ 5 | "delete from table_engine_test", 6 | "insert into table_engine_test(id,f_key,f_tinyint,f_bit) values(1,'11',0,true),(2,'11',1,false),(3,'22',0,true)" 7 | ], 8 | "query": "select table_engine_test.* from table_engine_test; select table_engine_test.* from table_engine_test", 9 | "fields": [ 10 | { 11 | "name": "id", 12 | "javaType": "java.lang.Long" 13 | }, 14 | { 15 | "name": "f_key", 16 | "javaType": "java.lang.String" 17 | }, 18 | { 19 | "name": "f_tinyint", 20 | "javaType": "java.lang.Integer" 21 | }, 22 | { 23 | "name": "f_bit", 24 | "javaType": "java.lang.Boolean" 25 | } 26 | ], 27 | "verifyResult": [ 28 | ] 29 | } 30 | ] -------------------------------------------------------------------------------- /src/test/resources/engine/tableengine/split-table_1.yml: -------------------------------------------------------------------------------- 1 | # 分片、分表键一致测试配置 2 | schemas: 3 | - schema: commerce 4 | logicTables: 5 | - { actualTableExprs: 'table_engine_test_${1..4}', 6 | logicTable: table_engine_test, 7 | shardingAlgorithms: TableRuleMod, 8 | shardingColumnName: f_key, 9 | shardingColumnType: INT32 } 10 | 11 | - schema: customer 12 | logicTables: 13 | - { actualTableExprs: 'table_engine_test_${1..4}', 14 | logicTable: table_engine_test, 15 | shardingAlgorithms: TableRuleMod, 16 | shardingColumnName: f_key, 17 | shardingColumnType: INT32 } -------------------------------------------------------------------------------- /src/test/resources/engine/tableengine/split-table_2.yml: -------------------------------------------------------------------------------- 1 | # 分片、分表键不一致测试配置 2 | schemas: 3 | - schema: commerce 4 | logicTables: 5 | - { actualTableExprs: 'table_engine_test_${1..4}', 6 | logicTable: table_engine_test, 7 | shardingAlgorithms: TableRuleMod, 8 | shardingColumnName: id, 9 | shardingColumnType: INT32 } 10 | 11 | - schema: customer 12 | logicTables: 13 | - { actualTableExprs: 'table_engine_test_${1..4}', 14 | logicTable: table_engine_test, 15 | shardingAlgorithms: TableRuleMod, 16 | shardingColumnName: id, 17 | shardingColumnType: INT32 } -------------------------------------------------------------------------------- /src/test/resources/engine/tableengine/streamquery/select_case.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "comment": "# '*' expression for simple route", 4 | "initSql": [ 5 | "delete from table_engine_test", 6 | "insert into table_engine_test(id,f_key,f_tinyint,f_bit) values(1,'11',0,true),(2,'11',1,false),(3,'22',0,true)" 7 | ], 8 | "query": "select table_engine_test.* from table_engine_test", 9 | "fields": [ 10 | ] 11 | } 12 | ] -------------------------------------------------------------------------------- /src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=INFO,console,logFile 2 | 3 | log4j.additivity.org.apache=true 4 | 5 | log4j.appender.console=org.apache.log4j.ConsoleAppender 6 | log4j.appender.console.Threshold=ERROR 7 | log4j.appender.console.ImmediateFlush=true 8 | log4j.appender.console.Target=System.err 9 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 10 | log4j.appender.console.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n 11 | 12 | log4j.appender.logFile=org.apache.log4j.FileAppender 13 | 14 | log4j.appender.logFile.ImmediateFlush=true 15 | log4j.appender.logFile.Append=true 16 | log4j.appender.logFile.File=logs/log4j.log 17 | log4j.appender.logFile.layout=org.apache.log4j.PatternLayout 18 | log4j.appender.logFile.layout.ConversionPattern=[%-5p] %d(%r) --> [%t] %l: %m %x %n 19 | 20 | log4j.logger.com.jd.zaxxer=ERROR 21 | log4j.logger.com.jd.jdbc.topo=DEBUG 22 | log4j.logger.com.jd.jdbc.pool=DEBUG 23 | -------------------------------------------------------------------------------- /src/test/resources/plan/Gen4/operator_test_data_one.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jd-opensource/vtdriver/4ec144cc589c232610dea62054cae16d7a75aa98/src/test/resources/plan/Gen4/operator_test_data_one.txt -------------------------------------------------------------------------------- /src/test/resources/plan/destination_cases_error.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/test/resources/plan/one_cases.txt: -------------------------------------------------------------------------------- 1 | "select *, id, name from pin_test" 2 | { 3 | "QueryType": "SELECT", 4 | "Original": "select *, id, name from pin_test", 5 | "Instructions": { 6 | "OperatorType": "Route", 7 | "Variant": "SelectEqualUnique", 8 | "Keyspace": { 9 | "Name": "user", 10 | "Sharded": true 11 | }, 12 | "FieldQuery": "select *, id, name from pin_test where 1 != 1", 13 | "Query": "select *, id, name from pin_test", 14 | "Table": "pin_test", 15 | "Values": [ 16 | "VARBINARY(\"\b\u0000\")" 17 | ], 18 | "Vindex": "binary" 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/plan/postprocess_cases_unsupported.txt: -------------------------------------------------------------------------------- 1 | # Reason: Routing rules 2 | # routing rules: order by gets pushed for routes 3 | "select col from route1 where id = 1 order by col" 4 | { 5 | "QueryType": "SELECT", 6 | "Original": "select col from route1 where id = 1 order by col", 7 | "Instructions": { 8 | "OperatorType": "Route", 9 | "Variant": "EqualUnique", 10 | "Keyspace": { 11 | "Name": "user", 12 | "Sharded": true 13 | }, 14 | "FieldQuery": "select col from `user` as route1 where 1 != 1", 15 | "Query": "select col from `user` as route1 where id = 1 order by col asc", 16 | "Table": "`user`", 17 | "Values": [ 18 | "INT64(1)" 19 | ], 20 | "Vindex": "user_index" 21 | } 22 | } 23 | Gen4 plan same as above 24 | 25 | # Reason: reference table 26 | # limit on reference table 27 | "select col from ref limit 1" 28 | { 29 | "QueryType": "SELECT", 30 | "Original": "select col from ref limit 1", 31 | "Instructions": { 32 | "OperatorType": "Route", 33 | "Variant": "SelectReference", 34 | "Keyspace": { 35 | "Name": "user", 36 | "Sharded": true 37 | }, 38 | "FieldQuery": "select col from ref where 1 != 1", 39 | "Query": "select col from ref limit 1", 40 | "Table": "ref" 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/test/resources/table/autoGeneratedKeys.yml: -------------------------------------------------------------------------------- 1 | schemas: 2 | - schema: commerce 3 | logicTables: 4 | - { actualTableExprs: 'table_engine_test_${1..4}', 5 | logicTable: table_engine_test, 6 | shardingAlgorithms: TableRuleMod, 7 | shardingColumnName: f_key, 8 | shardingColumnType: INT32 } 9 | - { actualTableExprs: 'table_auto_${1..4}', 10 | logicTable: table_auto, 11 | shardingAlgorithms: TableRuleMod, 12 | shardingColumnName: ai, 13 | shardingColumnType: INT32 } 14 | - schema: customer 15 | logicTables: 16 | - { actualTableExprs: 'table_engine_test_${1..4}', 17 | logicTable: table_engine_test, 18 | shardingAlgorithms: TableRuleMod, 19 | shardingColumnName: f_key, 20 | shardingColumnType: INT32 } 21 | - { actualTableExprs: 'table_auto_${1..4}', 22 | logicTable: table_auto, 23 | shardingAlgorithms: TableRuleMod, 24 | shardingColumnName: ai, 25 | shardingColumnType: INT32 } -------------------------------------------------------------------------------- /src/test/resources/table/shardTableByLong.yml: -------------------------------------------------------------------------------- 1 | schemas: 2 | - schema: customer 3 | logicTables: 4 | - { actualTableExprs: 'table_engine_test_${1..4}', 5 | logicTable: table_engine_test, 6 | shardingAlgorithms: TableRuleMod, 7 | shardingColumnName: f_int, 8 | shardingColumnType: INT32 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/table/shardTableByMode.yml: -------------------------------------------------------------------------------- 1 | schemas: 2 | - schema: commerce 3 | logicTables: 4 | - { actualTableExprs: 'table_engine_test_${1..4}', 5 | logicTable: table_engine_test, 6 | shardingAlgorithms: TableRuleMod, 7 | shardingColumnName: f_int, 8 | shardingColumnType: INT32} 9 | - schema: customer 10 | logicTables: 11 | - { actualTableExprs: 'table_engine_test_${1..4}', 12 | logicTable: table_engine_test, 13 | shardingAlgorithms: TableRuleMod, 14 | shardingColumnName: f_int, 15 | shardingColumnType: INT32} -------------------------------------------------------------------------------- /src/test/resources/table/shardTableByString.yml: -------------------------------------------------------------------------------- 1 | schemas: 2 | - schema: customer 3 | logicTables: 4 | - { actualTableExprs: 'table_engine_test_${1..4}', 5 | logicTable: table_engine_test, 6 | shardingAlgorithms: TableRuleMod, 7 | shardingColumnName: f_key, 8 | shardingColumnType: INT32 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/testsuite-dev.properties: -------------------------------------------------------------------------------- 1 | # common config 2 | driver.jdbc.url.prefix=jdbc:vitess://127.0.0.1:2379 3 | character.encoding=UTF-8 4 | server.timezone=UTC 5 | socket.timeout=10000 6 | # no shards - driver 7 | driver.jdbc.0.keyspace=commerce 8 | driver.jdbc.0.username=vtdriver 9 | driver.jdbc.0.password=vtdriver_password 10 | driver.jdbc.0.cell=zone1 11 | # 2 shards - driver 12 | driver.jdbc.2.keyspace=customer 13 | driver.jdbc.2.username=vtdriver 14 | driver.jdbc.2.password=vtdriver_password 15 | driver.jdbc.2.cell=zone1 -------------------------------------------------------------------------------- /src/test/resources/vitess_env/create_tables.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # this script create test tables and change the vschema for vtdriver testcase. 4 | # Run this script in the vtdriver config directory 5 | # Before executing the script, please make sure that ‘vtctlclient’ already exists in the environment variable. 6 | 7 | echo "Create test tables and change the vschema for vtdriver testcase..." 8 | 9 | vtctlclient -server localhost:15999 ApplySchema \ 10 | -sql-file `pwd`/customer_sharded.sql customer 11 | 12 | vtctlclient -server localhost:15999 ApplyVSchema \ 13 | -vschema_file `pwd`/vschema_customer_sharded.json customer 14 | 15 | vtctlclient -server localhost:15999 ApplySchema \ 16 | -sql-file `pwd`/commerce_unsharded.sql commerce 17 | 18 | vtctlclient -server localhost:15999 ApplyVSchema \ 19 | -vschema_file `pwd`/vschema_commerce_unsharded.json commerce 20 | -------------------------------------------------------------------------------- /src/test/resources/vitess_env/init_mysql_user.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # add user to mysql for vtdriver. 4 | # Run this script in the vtdriver config director 5 | 6 | echo "Add remote user in MySQL for vtdriver..." 7 | for i in 100 300 400 8 | do 9 | mysql -hlocalhost -P $[17000 + $i] -uroot \ 10 | --socket ../vtdataroot/vt_0000000$i/mysql.sock \ 11 | -e "source mysql_user.sql" 12 | done 13 | 14 | 15 | for i in 100 101 102 300 301 302 400 401 402 16 | do 17 | mysql -hlocalhost -P $[17000 + $i] -uroot \ 18 | --socket ../vtdataroot/vt_0000000$i/mysql.sock \ 19 | -e "set global sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION';" 20 | done 21 | -------------------------------------------------------------------------------- /src/test/resources/vitess_env/vtdriver/mysql_user.sql: -------------------------------------------------------------------------------- 1 | create user 'vtdriver' @'%' identified by 'vtdriver_password'; 2 | grant all privileges on *.* to 'vtdriver' @'%'; 3 | flush privileges; 4 | -------------------------------------------------------------------------------- /src/test/resources/vitess_env/vtdriver/vschema_commerce_unsharded.json: -------------------------------------------------------------------------------- 1 | { 2 | "tables": { 3 | "product": {}, 4 | "customer": {}, 5 | "plan_test": {}, 6 | "engine_test": {}, 7 | "user_unsharded": {}, 8 | "user_unsharded_extra": {}, 9 | "music": {}, 10 | "unsharded_auto": {}, 11 | "unsharded": {}, 12 | "unsharded_authoritative": {}, 13 | "corder": {}, 14 | "table_engine_test_1": {}, 15 | "table_engine_test_2": {}, 16 | "table_engine_test_3": {}, 17 | "table_engine_test_4": {}, 18 | "shard_by_long_test_1": {}, 19 | "shard_by_long_test_2": {}, 20 | "shard_by_long_test_3": {}, 21 | "shard_by_long_test_4": {}, 22 | "shard_by_murmur_test_1": {}, 23 | "shard_by_murmur_test_2": {}, 24 | "shard_by_murmur_test_3": {}, 25 | "shard_by_murmur_test_4": {}, 26 | "shard_rule_mod_1": {}, 27 | "shard_rule_mod_2": {}, 28 | "shard_rule_mod_3": {}, 29 | "shard_rule_mod_4": {}, 30 | "table_auto_1": {}, 31 | "table_auto_2": {}, 32 | "table_auto_3": {}, 33 | "table_auto_4": {}, 34 | "sbtest1": {}, 35 | "all_type_test": {}, 36 | "auto": {}, 37 | "user": {}, 38 | "table_engine_test_seq": {} 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/test/resources/vtdriver-split-table.yml: -------------------------------------------------------------------------------- 1 | schemas: 2 | - schema: commerce 3 | logicTables: 4 | - { actualTableExprs: 'table_engine_test_${1..4}', 5 | logicTable: table_engine_test, 6 | shardingAlgorithms: TableRuleMod, 7 | shardingColumnName: f_key, 8 | shardingColumnType: INT32 } 9 | 10 | - schema: customer 11 | logicTables: 12 | - { actualTableExprs: 'table_engine_test_${1..4}', 13 | logicTable: table_engine_test, 14 | shardingAlgorithms: TableRuleMod, 15 | shardingColumnName: f_key, 16 | shardingColumnType: INT32 } 17 | -------------------------------------------------------------------------------- /vtdriver-spring-boot-starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.jd.vtdriver.spring.boot.autoconfigure.VtDriverAutoConfiguration -------------------------------------------------------------------------------- /vtdriver-spring-boot-starter/src/test/java/com/jd/vtdriver/spring/boot/demo/VtdriverSpringbootApplication.java: -------------------------------------------------------------------------------- 1 | package com.jd.vtdriver.spring.boot.demo; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @MapperScan("com.jd.vtdriver.spring.boot.demo.mapper") 8 | @SpringBootApplication 9 | public class VtdriverSpringbootApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(VtdriverSpringbootApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /vtdriver-spring-boot-starter/src/test/java/com/jd/vtdriver/spring/boot/demo/mapper/TableMapper.java: -------------------------------------------------------------------------------- 1 | package com.jd.vtdriver.spring.boot.demo.mapper; 2 | 3 | import com.jd.vtdriver.spring.boot.demo.model.Table; 4 | import java.util.List; 5 | import org.apache.ibatis.annotations.Result; 6 | import org.apache.ibatis.annotations.Results; 7 | import org.apache.ibatis.annotations.Select; 8 | 9 | public interface TableMapper { 10 | 11 | @Select("select * from table_engine_test limit 10") 12 | @Results({ 13 | @Result(property = "id", column = "id"), 14 | @Result(property = "fKey", column = "f_key") 15 | }) 16 | List getTen(); 17 | } 18 | -------------------------------------------------------------------------------- /vtdriver-spring-boot-starter/src/test/java/com/jd/vtdriver/spring/boot/demo/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.jd.vtdriver.spring.boot.demo.mapper; 2 | 3 | import com.jd.vtdriver.spring.boot.demo.model.User; 4 | import java.util.List; 5 | import org.apache.ibatis.annotations.Result; 6 | import org.apache.ibatis.annotations.Results; 7 | import org.apache.ibatis.annotations.Select; 8 | 9 | public interface UserMapper { 10 | 11 | @Select("select * from user") 12 | @Results({ 13 | @Result(property = "id", column = "id"), 14 | @Result(property = "name", column = "name") 15 | }) 16 | List getAll(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /vtdriver-spring-boot-starter/src/test/java/com/jd/vtdriver/spring/boot/demo/model/Table.java: -------------------------------------------------------------------------------- 1 | package com.jd.vtdriver.spring.boot.demo.model; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class Table { 7 | private String id; 8 | 9 | private String fKey; 10 | } 11 | -------------------------------------------------------------------------------- /vtdriver-spring-boot-starter/src/test/java/com/jd/vtdriver/spring/boot/demo/model/User.java: -------------------------------------------------------------------------------- 1 | package com.jd.vtdriver.spring.boot.demo.model; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class User { 7 | private Long id; 8 | 9 | private String name; 10 | } 11 | -------------------------------------------------------------------------------- /vtdriver-spring-boot-starter/src/test/resources/application-yaml.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | url: "jdbc:vitess://127.0.0.1:2379/customer?cell=zone1&serverTimezone=Asia/Shanghai" 4 | username: "vtdriver" 5 | password: "vtdriver_password" 6 | driver-class-name: "com.jd.jdbc.vitess.VitessDriver" 7 | 8 | vtdriver: 9 | split-table: 10 | schemas: 11 | - schema: 'customer' 12 | logic-tables: 13 | - actualTableExprs: 'table_engine_test_${1..4}' 14 | logicTable: table_engine_test 15 | shardingAlgorithms: TableRuleMod 16 | shardingColumnName: f_key 17 | shardingColumnType: INT32 -------------------------------------------------------------------------------- /vtdriver-spring-boot-starter/src/test/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:vitess://127.0.0.1:2379/customer?cell=zone1&serverTimezone=Asia/Shanghai 2 | spring.datasource.username=vtdriver 3 | spring.datasource.password=vtdriver_password 4 | 5 | vtdriver.split-table.schemas[1].schema=customer 6 | vtdriver.split-table.schemas[1].logic-tables[0].actual-table-exprs=table_engine_test_${1..4} 7 | vtdriver.split-table.schemas[1].logic-tables[0].logic-table=table_engine_test 8 | vtdriver.split-table.schemas[1].logic-tables[0].sharding-algorithms=TableRuleMod 9 | vtdriver.split-table.schemas[1].logic-tables[0].sharding-column-name=f_key 10 | vtdriver.split-table.schemas[1].logic-tables[0].sharding-column-type=INT32 --------------------------------------------------------------------------------