Skip to content

Commit bee3539

Browse files
LeiRuijt2594838
authored andcommitted
enable lowercase of datatype,encoding,compressor in create_timeseries sqls (#442)
1 parent 6d2f98b commit bee3539

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

server/src/main/java/org/apache/iotdb/db/qp/strategy/LogicalGenerator.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import org.apache.iotdb.db.sql.parse.AstNode;
5858
import org.apache.iotdb.db.sql.parse.Node;
5959
import org.apache.iotdb.db.sql.parse.TSParser;
60-
import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
6160
import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
6261
import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
6362
import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
@@ -392,16 +391,16 @@ private void analyzePropertyUnLink(AstNode astNode) {
392391
private void analyzeMetadataCreate(AstNode astNode) throws MetadataErrorException {
393392
Path series = parsePath(astNode.getChild(0).getChild(0));
394393
AstNode paramNode = astNode.getChild(1);
395-
String dataType = paramNode.getChild(0).getChild(0).getText();
396-
String encodingType = paramNode.getChild(1).getChild(0).getText();
394+
String dataType = paramNode.getChild(0).getChild(0).getText().toUpperCase();
395+
String encodingType = paramNode.getChild(1).getChild(0).getText().toUpperCase();
397396
String compressor;
398397
int offset = 2;
399398
if (paramNode.getChildren().size() > offset
400399
&& paramNode.getChild(offset).getToken().getText().equals("TOK_COMPRESSOR")) {
401-
compressor = paramNode.getChild(offset).getChild(0).getText();
400+
compressor = paramNode.getChild(offset).getChild(0).getText().toUpperCase();
402401
offset++;
403402
} else {
404-
compressor = TSFileDescriptor.getInstance().getConfig().getCompressor();
403+
compressor = TSFileDescriptor.getInstance().getConfig().getCompressor().toUpperCase();
405404
}
406405
checkMetadataArgs(dataType, encodingType, compressor);
407406
Map<String, String> props = new HashMap<>(paramNode.getChildCount() - offset + 1, 1);

server/src/test/java/org/apache/iotdb/db/qp/plan/PhysicalPlanTest.java

+10
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ public void testMetadata()
9494
"encoding: RLE%nnamespace type: ADD_PATH%n" + "args: "), plan.toString());
9595
}
9696

97+
@Test
98+
public void testMetadata2()
99+
throws QueryProcessorException, ArgsErrorException, MetadataErrorException {
100+
String metadata = "create timeseries root.vehicle.d1.s2 with datatype=int32,encoding=rle";
101+
QueryProcessor processor = new QueryProcessor(new MemIntQpExecutor());
102+
MetadataPlan plan = (MetadataPlan) processor.parseSQLToPhysicalPlan(metadata);
103+
assertEquals(String.format("seriesPath: root.vehicle.d1.s2%n" + "resultDataType: INT32%n" +
104+
"encoding: RLE%nnamespace type: ADD_PATH%n" + "args: "), plan.toString());
105+
}
106+
97107
@Test
98108
public void testAuthor()
99109
throws QueryProcessorException, ArgsErrorException, MetadataErrorException {

0 commit comments

Comments
 (0)