You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2019/10/11 02:22:20 UTC
[incubator-iotdb] branch master updated: enable lowercase of
datatype, encoding, compressor in create_timeseries sqls (#442)
This is an automated email from the ASF dual-hosted git repository.
jiangtian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new bee3539 enable lowercase of datatype,encoding,compressor in create_timeseries sqls (#442)
bee3539 is described below
commit bee3539ae20e9fe8ef927d62a21b27fcb65b98f0
Author: Lei Rui <33...@users.noreply.github.com>
AuthorDate: Fri Oct 11 10:22:16 2019 +0800
enable lowercase of datatype,encoding,compressor in create_timeseries sqls (#442)
---
.../java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java | 9 ++++-----
.../java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java | 10 ++++++++++
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
index c093e2d..f888f6d 100644
--- a/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
+++ b/server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java
@@ -57,7 +57,6 @@ import org.apache.iotdb.db.query.fill.PreviousFill;
import org.apache.iotdb.db.sql.parse.AstNode;
import org.apache.iotdb.db.sql.parse.Node;
import org.apache.iotdb.db.sql.parse.TSParser;
-import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
@@ -392,16 +391,16 @@ public class LogicalGenerator {
private void analyzeMetadataCreate(AstNode astNode) throws MetadataErrorException {
Path series = parsePath(astNode.getChild(0).getChild(0));
AstNode paramNode = astNode.getChild(1);
- String dataType = paramNode.getChild(0).getChild(0).getText();
- String encodingType = paramNode.getChild(1).getChild(0).getText();
+ String dataType = paramNode.getChild(0).getChild(0).getText().toUpperCase();
+ String encodingType = paramNode.getChild(1).getChild(0).getText().toUpperCase();
String compressor;
int offset = 2;
if (paramNode.getChildren().size() > offset
&& paramNode.getChild(offset).getToken().getText().equals("TOK_COMPRESSOR")) {
- compressor = paramNode.getChild(offset).getChild(0).getText();
+ compressor = paramNode.getChild(offset).getChild(0).getText().toUpperCase();
offset++;
} else {
- compressor = TSFileDescriptor.getInstance().getConfig().getCompressor();
+ compressor = TSFileDescriptor.getInstance().getConfig().getCompressor().toUpperCase();
}
checkMetadataArgs(dataType, encodingType, compressor);
Map<String, String> props = new HashMap<>(paramNode.getChildCount() - offset + 1, 1);
diff --git a/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java b/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java
index 85dcdc9..3cdfb1e 100644
--- a/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java
@@ -95,6 +95,16 @@ public class PhysicalPlanTest {
}
@Test
+ public void testMetadata2()
+ throws QueryProcessorException, ArgsErrorException, MetadataErrorException {
+ String metadata = "create timeseries root.vehicle.d1.s2 with datatype=int32,encoding=rle";
+ QueryProcessor processor = new QueryProcessor(new MemIntQpExecutor());
+ MetadataPlan plan = (MetadataPlan) processor.parseSQLToPhysicalPlan(metadata);
+ assertEquals(String.format("seriesPath: root.vehicle.d1.s2%n" + "resultDataType: INT32%n" +
+ "encoding: RLE%nnamespace type: ADD_PATH%n" + "args: "), plan.toString());
+ }
+
+ @Test
public void testAuthor()
throws QueryProcessorException, ArgsErrorException, MetadataErrorException {
String sql = "grant role xm privileges 'SET_STORAGE_GROUP','DELETE_TIMESERIES' on root.vehicle.d1.s1";