-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implemented the alter encoding compression function for tree model #16672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
1ffc01c
ifpermitted
Caideyipi 190bb52
reconstruct
Caideyipi a9018d6
final-prev
Caideyipi 657fa31
complete-dn
Caideyipi ab8135e
partial
Caideyipi 37c4b51
very-partial
Caideyipi d42fe13
fix
Caideyipi 6608680
partial-set
Caideyipi c731628
fix
Caideyipi f6b6c07
test
Caideyipi 86c5f87
fix
Caideyipi 85603d5
shop
Caideyipi cc27849
fix
Caideyipi 6dc4da1
some
Caideyipi fddf768
partial
Caideyipi 3e71dff
bishop
Caideyipi 1e12177
fix
Caideyipi b51cb3e
fix
Caideyipi aa4eb73
grasia
Caideyipi 8246f5e
fix
Caideyipi 38d2b6a
main
Caideyipi 2616279
fix
Caideyipi 8e89fda
partial
Caideyipi 3153968
fix
Caideyipi d7f54f4
minor
Caideyipi e70895e
fix
Caideyipi fabfca9
Merge branch 'master' of https://github.com/apache/iotdb into large-p…
Caideyipi 4702762
fix
Caideyipi a7cd3e6
spotless
Caideyipi 58a580f
test
Caideyipi bd377c5
part
Caideyipi 7f71440
fix
Caideyipi cdd7a09
bug-fix
Caideyipi da7a080
fix
Caideyipi 27de58a
Revert "fix"
Caideyipi b260ef8
Reapply "fix"
Caideyipi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
187 changes: 187 additions & 0 deletions
187
...tion-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBAlterEncodingCompressorIT.java
This file contains hidden or 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,187 @@ | ||
| /* | ||
| * 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.iotdb.db.it.schema; | ||
|
|
||
| import org.apache.iotdb.it.env.EnvFactory; | ||
| import org.apache.iotdb.itbase.category.ClusterIT; | ||
| import org.apache.iotdb.itbase.category.LocalStandaloneIT; | ||
| import org.apache.iotdb.util.AbstractSchemaIT; | ||
|
|
||
| import org.junit.After; | ||
| import org.junit.Assert; | ||
| import org.junit.Test; | ||
| import org.junit.experimental.categories.Category; | ||
| import org.junit.runners.Parameterized; | ||
|
|
||
| import java.sql.Connection; | ||
| import java.sql.ResultSet; | ||
| import java.sql.SQLException; | ||
| import java.sql.Statement; | ||
|
|
||
| import static org.junit.Assert.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.fail; | ||
|
|
||
| @Category({LocalStandaloneIT.class, ClusterIT.class}) | ||
| public class IoTDBAlterEncodingCompressorIT extends AbstractSchemaIT { | ||
|
|
||
| public IoTDBAlterEncodingCompressorIT(SchemaTestMode schemaTestMode) { | ||
| super(schemaTestMode); | ||
| } | ||
|
|
||
| @Parameterized.BeforeParam | ||
| public static void before() throws Exception { | ||
| setUpEnvironment(); | ||
| EnvFactory.getEnv().initClusterEnvironment(); | ||
| } | ||
|
|
||
| @Parameterized.AfterParam | ||
| public static void after() throws Exception { | ||
| EnvFactory.getEnv().cleanClusterEnvironment(); | ||
| tearDownEnvironment(); | ||
| } | ||
|
|
||
| @After | ||
| public void tearDown() throws Exception { | ||
| clearSchema(); | ||
| } | ||
|
|
||
| @Test | ||
| public void alterEncodingAndCompressorTest() throws Exception { | ||
| if (schemaTestMode.equals(SchemaTestMode.PBTree)) { | ||
| return; | ||
| } | ||
| try (final Connection connection = EnvFactory.getEnv().getConnection(); | ||
| final Statement statement = connection.createStatement()) { | ||
| statement.execute("create timeSeries root.vehicle.wind.a int32"); | ||
|
|
||
| try { | ||
| statement.execute("alter timeSeries root.nonExist.** set encoding=PLAIN"); | ||
| fail(); | ||
| } catch (final SQLException e) { | ||
| Assert.assertEquals( | ||
| "508: Timeseries [root.nonExist.**] does not exist or is represented by device template", | ||
| e.getMessage()); | ||
| } | ||
|
|
||
| try { | ||
| statement.execute("alter timeSeries if exists root.nonExist.** set encoding=PLAIN"); | ||
| } catch (final SQLException e) { | ||
| fail( | ||
| "Alter encoding & compressor shall not fail when timeSeries not exists if set if exists"); | ||
| } | ||
|
|
||
| try { | ||
| statement.execute("alter timeSeries if exists root.vehicle.** set encoding=aaa"); | ||
| fail(); | ||
| } catch (final SQLException e) { | ||
| Assert.assertEquals("701: Unsupported encoding: AAA", e.getMessage()); | ||
| } | ||
|
|
||
| try { | ||
| statement.execute("alter timeSeries if exists root.vehicle.** set compressor=aaa"); | ||
| fail(); | ||
| } catch (final SQLException e) { | ||
| Assert.assertEquals("701: Unsupported compressor: AAA", e.getMessage()); | ||
| } | ||
|
|
||
| try { | ||
| statement.execute("alter timeSeries if exists root.vehicle.** set falseKey=aaa"); | ||
| fail(); | ||
| } catch (final SQLException e) { | ||
| Assert.assertEquals("701: property falsekey is unsupported yet.", e.getMessage()); | ||
| } | ||
|
|
||
| try { | ||
| statement.execute("alter timeSeries if exists root.vehicle.** set encoding=DICTIONARY"); | ||
| fail(); | ||
| } catch (final SQLException e) { | ||
| Assert.assertTrue(e.getMessage().contains("encoding DICTIONARY does not support INT32")); | ||
| } | ||
|
|
||
| statement.execute("alter timeSeries root.** set encoding=Plain, compressor=LZMA2"); | ||
|
|
||
| try (final ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES")) { | ||
| while (resultSet.next()) { | ||
| assertEquals("PLAIN", resultSet.getString(5)); | ||
| assertEquals("LZMA2", resultSet.getString(6)); | ||
| } | ||
| } | ||
|
|
||
| statement.execute("create user IoTDBUser '!@#$!dfdfzvd343'"); | ||
| statement.execute("grant write on root.vehicle.wind.a to user IoTDBUser"); | ||
| statement.execute("create timeSeries root.vehicle.wind.b int32"); | ||
| } | ||
|
|
||
| try (final Connection connection = | ||
| EnvFactory.getEnv().getConnection("IoTDBUser", "!@#$!dfdfzvd343"); | ||
| final Statement statement = connection.createStatement()) { | ||
| try { | ||
| statement.execute("alter timeSeries root.vechile.** set encoding=PLAIN, compressor=LZMA2"); | ||
| fail(); | ||
| } catch (final SQLException e) { | ||
| Assert.assertEquals( | ||
| "803: No permissions for this operation, please add privilege WRITE_SCHEMA on [root.vechile.**]", | ||
| e.getMessage()); | ||
| } | ||
|
|
||
| try { | ||
| statement.execute( | ||
| "alter timeSeries root.vechile.wind.a, root.__audit.** set encoding=PLAIN, compressor=LZMA2"); | ||
| fail(); | ||
| } catch (final SQLException e) { | ||
| Assert.assertEquals( | ||
| "803: 'AUDIT' permission is needed to alter the encoding and compressor of database root.__audit", | ||
| e.getMessage()); | ||
| } | ||
|
|
||
| try { | ||
| statement.execute( | ||
| "alter timeSeries if permitted root.vehicle.**, root.__audit.** set encoding=GORILLA, compressor=GZIP"); | ||
| } catch (final SQLException e) { | ||
| fail("Alter encoding & compressor shall not fail when no privileges if set if permitted"); | ||
| } | ||
| } | ||
|
|
||
| try (final Connection connection = EnvFactory.getEnv().getConnection(); | ||
| final Statement statement = connection.createStatement()) { | ||
| try (final ResultSet resultSet = | ||
| statement.executeQuery("SHOW TIMESERIES root.__audit.**._0.password")) { | ||
| while (resultSet.next()) { | ||
| assertEquals("PLAIN", resultSet.getString(5)); | ||
| assertEquals("LZMA2", resultSet.getString(6)); | ||
| } | ||
| } | ||
|
|
||
| try (final ResultSet resultSet = | ||
| statement.executeQuery("SHOW TIMESERIES root.vehicle.wind.b")) { | ||
| resultSet.next(); | ||
| assertEquals("TS_2DIFF", resultSet.getString(5)); | ||
| assertEquals("LZ4", resultSet.getString(6)); | ||
| } | ||
|
|
||
| try (final ResultSet resultSet = | ||
| statement.executeQuery("SHOW TIMESERIES root.vehicle.wind.a")) { | ||
| resultSet.next(); | ||
| assertEquals("GORILLA", resultSet.getString(5)); | ||
| assertEquals("GZIP", resultSet.getString(6)); | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -610,6 +610,10 @@ PATHS | |
| : P A T H S | ||
| ; | ||
|
|
||
| PERMITTED | ||
| : P E R M I T T E D | ||
| ; | ||
|
|
||
| PIPE | ||
| : P I P E | ||
| ; | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.