-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for SQLServer parse update statistics sql (#29655)
* add update statistics Segment * Add support for update statistics * Add test rules for update statistics * replace import collection * add java doc in segment * Adjust spotless appley * Adjust spotless appley
- Loading branch information
1 parent
518f352
commit d30870a
Showing
28 changed files
with
1,220 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,5 +78,6 @@ execute | |
| explain | ||
| setUser | ||
| revert | ||
| updateStatistics | ||
) SEMI_? | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...re/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerUpdateStatisticsStatement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.ddl; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.index.IndexSegment; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.SimpleTableSegment; | ||
import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement; | ||
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement; | ||
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.SQLServerStatement; | ||
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.segment.StatisticsStrategySegment; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* SQLServer update statistics statement. | ||
*/ | ||
@Getter | ||
public final class SQLServerUpdateStatisticsStatement extends AbstractSQLStatement implements DDLStatement, SQLServerStatement { | ||
|
||
@Setter | ||
private List<IndexSegment> indexes; | ||
|
||
@Setter | ||
private SimpleTableSegment table; | ||
|
||
@Setter | ||
private StatisticsStrategySegment strategy; | ||
} |
53 changes: 53 additions & 0 deletions
53
...hardingsphere/sql/parser/sql/dialect/statement/sqlserver/segment/SampleOptionSegment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.segment; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import org.apache.shardingsphere.sql.parser.sql.common.segment.SQLSegment; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Update statistics sample option segment. | ||
*/ | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
public final class SampleOptionSegment implements SQLSegment { | ||
|
||
private int startIndex; | ||
|
||
private int stopIndex; | ||
|
||
private boolean persistSamplePercent; | ||
|
||
private String sampleNumber; | ||
|
||
private SampleStrategy strategy; | ||
|
||
private ScanUnit scanUnit; | ||
|
||
private List<String> partitions; | ||
|
||
public SampleOptionSegment(final int startIndex, final int stopIndex) { | ||
this.startIndex = startIndex; | ||
this.stopIndex = stopIndex; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...che/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/segment/SampleStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.segment; | ||
|
||
/** | ||
* Update statistics sample strategy enum. | ||
*/ | ||
public enum SampleStrategy { | ||
|
||
FULLSCAN, | ||
|
||
SAMPLE, | ||
|
||
RESAMPLE | ||
} |
Oops, something went wrong.