提交 beae099a 编写于 作者: H Haojun Liao

[td-13039] update the unit test.

上级 649905f4
...@@ -125,127 +125,633 @@ int main(int argc, char** argv) { ...@@ -125,127 +125,633 @@ int main(int argc, char** argv) {
TEST(testCase, build_executor_tree_Test) { TEST(testCase, build_executor_tree_Test) {
const char* msg = "{\n" const char* msg = "{\n"
"\t\"Id\":\t{\n" " \"Type\": \"33\",\n"
"\t\t\"QueryId\":\t1.3108161807422521e+19,\n" " \"Name\": \"PhysiProject\",\n"
"\t\t\"TemplateId\":\t0,\n" " \"PhysiProject\": {\n"
"\t\t\"SubplanId\":\t0\n" " \"OutputDataBlockDesc\": {\n"
"\t},\n" " \"Type\": \"19\",\n"
"\t\"Node\":\t{\n" " \"Name\": \"TupleDesc\",\n"
"\t\t\"Name\":\t\"TableScan\",\n" " \"TupleDesc\": {\n"
"\t\t\"Targets\":\t[{\n" " \"DataBlockId\": \"1\",\n"
"\t\t\t\t\"Base\":\t{\n" " \"Slots\": [\n"
"\t\t\t\t\t\"Schema\":\t{\n" " {\n"
"\t\t\t\t\t\t\"Type\":\t9,\n" " \"Type\": \"20\",\n"
"\t\t\t\t\t\t\"ColId\":\t5000,\n" " \"Name\": \"SlotDesc\",\n"
"\t\t\t\t\t\t\"Bytes\":\t8\n" " \"SlotDesc\": {\n"
"\t\t\t\t\t},\n" " \"SlotId\": \"0\",\n"
"\t\t\t\t\t\"Columns\":\t[{\n" " \"DataType\": {\n"
"\t\t\t\t\t\t\t\"TableId\":\t1,\n" " \"Type\": \"9\",\n"
"\t\t\t\t\t\t\t\"Flag\":\t0,\n" " \"Precision\": \"0\",\n"
"\t\t\t\t\t\t\t\"Info\":\t{\n" " \"Scale\": \"0\",\n"
"\t\t\t\t\t\t\t\t\"ColId\":\t1,\n" " \"Bytes\": \"8\"\n"
"\t\t\t\t\t\t\t\t\"Type\":\t9,\n" " },\n"
"\t\t\t\t\t\t\t\t\"Bytes\":\t8\n" " \"Reserve\": false,\n"
"\t\t\t\t\t\t\t}\n" " \"Output\": false\n"
"\t\t\t\t\t\t}],\n" " }\n"
"\t\t\t\t\t\"InterBytes\":\t0\n" " },\n"
"\t\t\t\t},\n" " {\n"
"\t\t\t\t\"Expr\":\t{\n" " \"Type\": \"20\",\n"
"\t\t\t\t\t\"Type\":\t4,\n" " \"Name\": \"SlotDesc\",\n"
"\t\t\t\t\t\"Column\":\t{\n" " \"SlotDesc\": {\n"
"\t\t\t\t\t\t\"Type\":\t9,\n" " \"SlotId\": \"1\",\n"
"\t\t\t\t\t\t\"ColId\":\t1,\n" " \"DataType\": {\n"
"\t\t\t\t\t\t\"Bytes\":\t8\n" " \"Type\": \"4\",\n"
"\t\t\t\t\t}\n" " \"Precision\": \"0\",\n"
"\t\t\t\t}\n" " \"Scale\": \"0\",\n"
"\t\t\t}, {\n" " \"Bytes\": \"4\"\n"
"\t\t\t\t\"Base\":\t{\n" " },\n"
"\t\t\t\t\t\"Schema\":\t{\n" " \"Reserve\": false,\n"
"\t\t\t\t\t\t\"Type\":\t4,\n" " \"Output\": false\n"
"\t\t\t\t\t\t\"ColId\":\t5001,\n" " }\n"
"\t\t\t\t\t\t\"Bytes\":\t4\n" " },\n"
"\t\t\t\t\t},\n" " {\n"
"\t\t\t\t\t\"Columns\":\t[{\n" " \"Type\": \"20\",\n"
"\t\t\t\t\t\t\t\"TableId\":\t1,\n" " \"Name\": \"SlotDesc\",\n"
"\t\t\t\t\t\t\t\"Flag\":\t0,\n" " \"SlotDesc\": {\n"
"\t\t\t\t\t\t\t\"Info\":\t{\n" " \"SlotId\": \"2\",\n"
"\t\t\t\t\t\t\t\t\"ColId\":\t2,\n" " \"DataType\": {\n"
"\t\t\t\t\t\t\t\t\"Type\":\t4,\n" " \"Type\": \"8\",\n"
"\t\t\t\t\t\t\t\t\"Bytes\":\t4\n" " \"Precision\": \"0\",\n"
"\t\t\t\t\t\t\t}\n" " \"Scale\": \"0\",\n"
"\t\t\t\t\t\t}],\n" " \"Bytes\": \"20\"\n"
"\t\t\t\t\t\"InterBytes\":\t0\n" " },\n"
"\t\t\t\t},\n" " \"Reserve\": false,\n"
"\t\t\t\t\"Expr\":\t{\n" " \"Output\": false\n"
"\t\t\t\t\t\"Type\":\t4,\n" " }\n"
"\t\t\t\t\t\"Column\":\t{\n" " },\n"
"\t\t\t\t\t\t\"Type\":\t4,\n" " {\n"
"\t\t\t\t\t\t\"ColId\":\t2,\n" " \"Type\": \"20\",\n"
"\t\t\t\t\t\t\"Bytes\":\t4\n" " \"Name\": \"SlotDesc\",\n"
"\t\t\t\t\t}\n" " \"SlotDesc\": {\n"
"\t\t\t\t}\n" " \"SlotId\": \"3\",\n"
"\t\t\t}],\n" " \"DataType\": {\n"
"\t\t\"InputSchema\":\t[{\n" " \"Type\": \"5\",\n"
"\t\t\t\t\"Type\":\t9,\n" " \"Precision\": \"0\",\n"
"\t\t\t\t\"ColId\":\t5000,\n" " \"Scale\": \"0\",\n"
"\t\t\t\t\"Bytes\":\t8\n" " \"Bytes\": \"8\"\n"
"\t\t\t}, {\n" " },\n"
"\t\t\t\t\"Type\":\t4,\n" " \"Reserve\": false,\n"
"\t\t\t\t\"ColId\":\t5001,\n" " \"Output\": false\n"
"\t\t\t\t\"Bytes\":\t4\n" " }\n"
"\t\t\t}],\n" " },\n"
"\t\t\"TableScan\":\t{\n" " {\n"
"\t\t\t\"TableId\":\t1,\n" " \"Type\": \"20\",\n"
"\t\t\t\"TableType\":\t2,\n" " \"Name\": \"SlotDesc\",\n"
"\t\t\t\"Flag\":\t0,\n" " \"SlotDesc\": {\n"
"\t\t\t\"Window\":\t{\n" " \"SlotId\": \"4\",\n"
"\t\t\t\t\"StartKey\":\t-9.2233720368547758e+18,\n" " \"DataType\": {\n"
"\t\t\t\t\"EndKey\":\t9.2233720368547758e+18\n" " \"Type\": \"7\",\n"
"\t\t\t}\n" " \"Precision\": \"0\",\n"
"\t\t}\n" " \"Scale\": \"0\",\n"
"\t},\n" " \"Bytes\": \"8\"\n"
"\t\"DataSink\":\t{\n" " },\n"
"\t\t\"Name\":\t\"Dispatch\",\n" " \"Reserve\": false,\n"
"\t\t\"Dispatch\":\t{\n" " \"Output\": false\n"
"\t\t}\n" " }\n"
"\t}\n" " },\n"
" {\n"
" \"Type\": \"20\",\n"
" \"Name\": \"SlotDesc\",\n"
" \"SlotDesc\": {\n"
" \"SlotId\": \"5\",\n"
" \"DataType\": {\n"
" \"Type\": \"7\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"Reserve\": false,\n"
" \"Output\": false\n"
" }\n"
" }\n"
" ]\n"
" }\n"
" },\n"
" \"Children\": [\n"
" {\n"
" \"Type\": \"30\",\n"
" \"Name\": \"PhysiTableScan\",\n"
" \"PhysiTableScan\": {\n"
" \"OutputDataBlockDesc\": {\n"
" \"Type\": \"19\",\n"
" \"Name\": \"TupleDesc\",\n"
" \"TupleDesc\": {\n"
" \"DataBlockId\": \"0\",\n"
" \"Slots\": [\n"
" {\n"
" \"Type\": \"20\",\n"
" \"Name\": \"SlotDesc\",\n"
" \"SlotDesc\": {\n"
" \"SlotId\": \"0\",\n"
" \"DataType\": {\n"
" \"Type\": \"9\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"Reserve\": false,\n"
" \"Output\": true\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"20\",\n"
" \"Name\": \"SlotDesc\",\n"
" \"SlotDesc\": {\n"
" \"SlotId\": \"1\",\n"
" \"DataType\": {\n"
" \"Type\": \"4\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"4\"\n"
" },\n"
" \"Reserve\": false,\n"
" \"Output\": true\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"20\",\n"
" \"Name\": \"SlotDesc\",\n"
" \"SlotDesc\": {\n"
" \"SlotId\": \"2\",\n"
" \"DataType\": {\n"
" \"Type\": \"8\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"20\"\n"
" },\n"
" \"Reserve\": false,\n"
" \"Output\": true\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"20\",\n"
" \"Name\": \"SlotDesc\",\n"
" \"SlotDesc\": {\n"
" \"SlotId\": \"3\",\n"
" \"DataType\": {\n"
" \"Type\": \"5\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"Reserve\": false,\n"
" \"Output\": true\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"20\",\n"
" \"Name\": \"SlotDesc\",\n"
" \"SlotDesc\": {\n"
" \"SlotId\": \"4\",\n"
" \"DataType\": {\n"
" \"Type\": \"7\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"Reserve\": false,\n"
" \"Output\": true\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"20\",\n"
" \"Name\": \"SlotDesc\",\n"
" \"SlotDesc\": {\n"
" \"SlotId\": \"5\",\n"
" \"DataType\": {\n"
" \"Type\": \"7\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"Reserve\": false,\n"
" \"Output\": true\n"
" }\n"
" }\n"
" ]\n"
" }\n"
" },\n"
" \"ScanCols\": [\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"0\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"9\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"AliasName\": \"ts\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"1\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"ts\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"0\"\n"
" }\n"
" }\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"1\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"4\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"4\"\n"
" },\n"
" \"AliasName\": \"c1\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"2\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"c1\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"0\"\n"
" }\n"
" }\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"2\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"8\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"20\"\n"
" },\n"
" \"AliasName\": \"c2\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"3\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"c2\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"0\"\n"
" }\n"
" }\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"3\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"5\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"AliasName\": \"c3\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"4\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"c3\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"0\"\n"
" }\n"
" }\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"4\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"7\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"AliasName\": \"c4\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"5\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"c4\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"0\"\n"
" }\n"
" }\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"5\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"7\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"AliasName\": \"c5\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"6\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"c5\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"0\"\n"
" }\n"
" }\n"
" }\n"
" }\n"
" ],\n"
" \"TableId\": \"1\",\n"
" \"TableType\": \"3\",\n"
" \"ScanOrder\": \"1\",\n"
" \"ScanCount\": \"1\",\n"
" \"ReverseScanCount\": \"0\",\n"
" \"ScanFlag\": \"0\",\n"
" \"StartKey\": \"-9223372036854775808\",\n"
" \"EndKey\": \"9223372036854775807\"\n"
" }\n"
" }\n"
" ],\n"
" \"Projections\": [\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"1\",\n"
" \"SlotId\": \"0\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"9\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"AliasName\": \"ts\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"1\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"ts\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"0\"\n"
" }\n"
" }\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"1\",\n"
" \"SlotId\": \"1\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"4\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"4\"\n"
" },\n"
" \"AliasName\": \"c1\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"2\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"c1\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"1\"\n"
" }\n"
" }\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"1\",\n"
" \"SlotId\": \"2\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"8\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"20\"\n"
" },\n"
" \"AliasName\": \"c2\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"3\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"c2\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"2\"\n"
" }\n"
" }\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"1\",\n"
" \"SlotId\": \"3\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"5\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"AliasName\": \"c3\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"4\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"c3\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"3\"\n"
" }\n"
" }\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"1\",\n"
" \"SlotId\": \"4\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"7\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"AliasName\": \"c4\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"5\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"c4\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"4\"\n"
" }\n"
" }\n"
" }\n"
" },\n"
" {\n"
" \"Type\": \"18\",\n"
" \"Name\": \"Target\",\n"
" \"Target\": {\n"
" \"DataBlockId\": \"1\",\n"
" \"SlotId\": \"5\",\n"
" \"Expr\": {\n"
" \"Type\": \"1\",\n"
" \"Name\": \"Column\",\n"
" \"Column\": {\n"
" \"DataType\": {\n"
" \"Type\": \"7\",\n"
" \"Precision\": \"0\",\n"
" \"Scale\": \"0\",\n"
" \"Bytes\": \"8\"\n"
" },\n"
" \"AliasName\": \"c5\",\n"
" \"TableId\": \"0\",\n"
" \"ColId\": \"6\",\n"
" \"ColType\": \"1\",\n"
" \"DbName\": \"test\",\n"
" \"TableName\": \"t1\",\n"
" \"TableAlias\": \"t1\",\n"
" \"ColName\": \"c5\",\n"
" \"DataBlockId\": \"0\",\n"
" \"SlotId\": \"5\"\n"
" }\n"
" }\n"
" }\n"
" }\n"
" ]\n"
" }\n"
"}"; "}";
SExecTaskInfo* pTaskInfo = nullptr; SExecTaskInfo* pTaskInfo = nullptr;
DataSinkHandle sinkHandle = nullptr; DataSinkHandle sinkHandle = nullptr;
SReadHandle handle = {.reader = reinterpret_cast<void*>(0x1), .meta = reinterpret_cast<void*>(0x1)}; SReadHandle handle = {.reader = reinterpret_cast<void*>(0x1), .meta = reinterpret_cast<void*>(0x1)};
// int32_t code = qCreateExecTask(&handle, 2, 1, NULL, (void**) &pTaskInfo, &sinkHandle); struct SSubplan *plan = NULL;
int32_t code = qStringToSubplan(msg, &plan);
ASSERT_EQ(code, 0);
code = qCreateExecTask(&handle, 2, 1, plan, (void**) &pTaskInfo, &sinkHandle);
ASSERT_EQ(code, 0);
} }
//TEST(testCase, inMem_sort_Test) { #if 0
// SArray* pOrderVal = taosArrayInit(4, sizeof(SOrder)); TEST(testCase, inMem_sort_Test) {
// SOrder o = {.order = TSDB_ORDER_ASC}; SArray* pOrderVal = taosArrayInit(4, sizeof(SOrder));
// o.col.info.colId = 1; SOrder o = {.order = TSDB_ORDER_ASC};
// o.col.info.type = TSDB_DATA_TYPE_INT; o.col.info.colId = 1;
// taosArrayPush(pOrderVal, &o); o.col.info.type = TSDB_DATA_TYPE_INT;
// taosArrayPush(pOrderVal, &o);
// SArray* pExprInfo = taosArrayInit(4, sizeof(SExprInfo));
// SExprInfo *exp = static_cast<SExprInfo*>(calloc(1, sizeof(SExprInfo))); SArray* pExprInfo = taosArrayInit(4, sizeof(SExprInfo));
// exp->base.resSchema = createSchema(TSDB_DATA_TYPE_INT, sizeof(int32_t), 1, "res"); SExprInfo *exp = static_cast<SExprInfo*>(calloc(1, sizeof(SExprInfo)));
// taosArrayPush(pExprInfo, &exp); exp->base.resSchema = createSchema(TSDB_DATA_TYPE_INT, sizeof(int32_t), 1, "res");
// taosArrayPush(pExprInfo, &exp);
// SExprInfo *exp1 = static_cast<SExprInfo*>(calloc(1, sizeof(SExprInfo)));
// exp1->base.resSchema = createSchema(TSDB_DATA_TYPE_BINARY, 40, 2, "res1"); SExprInfo *exp1 = static_cast<SExprInfo*>(calloc(1, sizeof(SExprInfo)));
// taosArrayPush(pExprInfo, &exp1); exp1->base.resSchema = createSchema(TSDB_DATA_TYPE_BINARY, 40, 2, "res1");
// taosArrayPush(pExprInfo, &exp1);
// SOperatorInfo* pOperator = createOrderOperatorInfo(createDummyOperator(5), pExprInfo, pOrderVal);
// SOperatorInfo* pOperator = createOrderOperatorInfo(createDummyOperator(5), pExprInfo, pOrderVal);
// bool newgroup = false;
// SSDataBlock* pRes = pOperator->exec(pOperator, &newgroup); bool newgroup = false;
// SSDataBlock* pRes = pOperator->exec(pOperator, &newgroup);
// SColumnInfoData* pCol1 = static_cast<SColumnInfoData*>(taosArrayGet(pRes->pDataBlock, 0));
// SColumnInfoData* pCol2 = static_cast<SColumnInfoData*>(taosArrayGet(pRes->pDataBlock, 1)); SColumnInfoData* pCol1 = static_cast<SColumnInfoData*>(taosArrayGet(pRes->pDataBlock, 0));
// for(int32_t i = 0; i < pRes->info.rows; ++i) { SColumnInfoData* pCol2 = static_cast<SColumnInfoData*>(taosArrayGet(pRes->pDataBlock, 1));
// char* p = colDataGet(pCol2, i); for(int32_t i = 0; i < pRes->info.rows; ++i) {
// printf("%d: %d, %s\n", i, ((int32_t*)pCol1->pData)[i], (char*)varDataVal(p)); char* p = colDataGet(pCol2, i);
// } printf("%d: %d, %s\n", i, ((int32_t*)pCol1->pData)[i], (char*)varDataVal(p));
//} }
}
#endif
typedef struct su { typedef struct su {
int32_t v; int32_t v;
...@@ -282,6 +788,7 @@ TEST(testCase, external_sort_Test) { ...@@ -282,6 +788,7 @@ TEST(testCase, external_sort_Test) {
return; return;
#endif #endif
#if 0
srand(time(NULL)); srand(time(NULL));
SArray* pOrderVal = taosArrayInit(4, sizeof(SOrder)); SArray* pOrderVal = taosArrayInit(4, sizeof(SOrder));
...@@ -342,5 +849,6 @@ TEST(testCase, external_sort_Test) { ...@@ -342,5 +849,6 @@ TEST(testCase, external_sort_Test) {
tfree(exp1); tfree(exp1);
taosArrayDestroy(pExprInfo); taosArrayDestroy(pExprInfo);
taosArrayDestroy(pOrderVal); taosArrayDestroy(pOrderVal);
#endif
} }
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册