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

[td-13039] update the unit test.

上级 649905f4
......@@ -125,127 +125,633 @@ int main(int argc, char** argv) {
TEST(testCase, build_executor_tree_Test) {
const char* msg = "{\n"
"\t\"Id\":\t{\n"
"\t\t\"QueryId\":\t1.3108161807422521e+19,\n"
"\t\t\"TemplateId\":\t0,\n"
"\t\t\"SubplanId\":\t0\n"
"\t},\n"
"\t\"Node\":\t{\n"
"\t\t\"Name\":\t\"TableScan\",\n"
"\t\t\"Targets\":\t[{\n"
"\t\t\t\t\"Base\":\t{\n"
"\t\t\t\t\t\"Schema\":\t{\n"
"\t\t\t\t\t\t\"Type\":\t9,\n"
"\t\t\t\t\t\t\"ColId\":\t5000,\n"
"\t\t\t\t\t\t\"Bytes\":\t8\n"
"\t\t\t\t\t},\n"
"\t\t\t\t\t\"Columns\":\t[{\n"
"\t\t\t\t\t\t\t\"TableId\":\t1,\n"
"\t\t\t\t\t\t\t\"Flag\":\t0,\n"
"\t\t\t\t\t\t\t\"Info\":\t{\n"
"\t\t\t\t\t\t\t\t\"ColId\":\t1,\n"
"\t\t\t\t\t\t\t\t\"Type\":\t9,\n"
"\t\t\t\t\t\t\t\t\"Bytes\":\t8\n"
"\t\t\t\t\t\t\t}\n"
"\t\t\t\t\t\t}],\n"
"\t\t\t\t\t\"InterBytes\":\t0\n"
"\t\t\t\t},\n"
"\t\t\t\t\"Expr\":\t{\n"
"\t\t\t\t\t\"Type\":\t4,\n"
"\t\t\t\t\t\"Column\":\t{\n"
"\t\t\t\t\t\t\"Type\":\t9,\n"
"\t\t\t\t\t\t\"ColId\":\t1,\n"
"\t\t\t\t\t\t\"Bytes\":\t8\n"
"\t\t\t\t\t}\n"
"\t\t\t\t}\n"
"\t\t\t}, {\n"
"\t\t\t\t\"Base\":\t{\n"
"\t\t\t\t\t\"Schema\":\t{\n"
"\t\t\t\t\t\t\"Type\":\t4,\n"
"\t\t\t\t\t\t\"ColId\":\t5001,\n"
"\t\t\t\t\t\t\"Bytes\":\t4\n"
"\t\t\t\t\t},\n"
"\t\t\t\t\t\"Columns\":\t[{\n"
"\t\t\t\t\t\t\t\"TableId\":\t1,\n"
"\t\t\t\t\t\t\t\"Flag\":\t0,\n"
"\t\t\t\t\t\t\t\"Info\":\t{\n"
"\t\t\t\t\t\t\t\t\"ColId\":\t2,\n"
"\t\t\t\t\t\t\t\t\"Type\":\t4,\n"
"\t\t\t\t\t\t\t\t\"Bytes\":\t4\n"
"\t\t\t\t\t\t\t}\n"
"\t\t\t\t\t\t}],\n"
"\t\t\t\t\t\"InterBytes\":\t0\n"
"\t\t\t\t},\n"
"\t\t\t\t\"Expr\":\t{\n"
"\t\t\t\t\t\"Type\":\t4,\n"
"\t\t\t\t\t\"Column\":\t{\n"
"\t\t\t\t\t\t\"Type\":\t4,\n"
"\t\t\t\t\t\t\"ColId\":\t2,\n"
"\t\t\t\t\t\t\"Bytes\":\t4\n"
"\t\t\t\t\t}\n"
"\t\t\t\t}\n"
"\t\t\t}],\n"
"\t\t\"InputSchema\":\t[{\n"
"\t\t\t\t\"Type\":\t9,\n"
"\t\t\t\t\"ColId\":\t5000,\n"
"\t\t\t\t\"Bytes\":\t8\n"
"\t\t\t}, {\n"
"\t\t\t\t\"Type\":\t4,\n"
"\t\t\t\t\"ColId\":\t5001,\n"
"\t\t\t\t\"Bytes\":\t4\n"
"\t\t\t}],\n"
"\t\t\"TableScan\":\t{\n"
"\t\t\t\"TableId\":\t1,\n"
"\t\t\t\"TableType\":\t2,\n"
"\t\t\t\"Flag\":\t0,\n"
"\t\t\t\"Window\":\t{\n"
"\t\t\t\t\"StartKey\":\t-9.2233720368547758e+18,\n"
"\t\t\t\t\"EndKey\":\t9.2233720368547758e+18\n"
"\t\t\t}\n"
"\t\t}\n"
"\t},\n"
"\t\"DataSink\":\t{\n"
"\t\t\"Name\":\t\"Dispatch\",\n"
"\t\t\"Dispatch\":\t{\n"
"\t\t}\n"
"\t}\n"
"}";
" \"Type\": \"33\",\n"
" \"Name\": \"PhysiProject\",\n"
" \"PhysiProject\": {\n"
" \"OutputDataBlockDesc\": {\n"
" \"Type\": \"19\",\n"
" \"Name\": \"TupleDesc\",\n"
" \"TupleDesc\": {\n"
" \"DataBlockId\": \"1\",\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\": false\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\": false\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\": false\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\": false\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\": false\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\": 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;
DataSinkHandle sinkHandle = nullptr;
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) {
// SArray* pOrderVal = taosArrayInit(4, sizeof(SOrder));
// SOrder o = {.order = TSDB_ORDER_ASC};
// o.col.info.colId = 1;
// 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)));
// 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");
// taosArrayPush(pExprInfo, &exp1);
//
// SOperatorInfo* pOperator = createOrderOperatorInfo(createDummyOperator(5), pExprInfo, pOrderVal);
//
// 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));
// for(int32_t i = 0; i < pRes->info.rows; ++i) {
// char* p = colDataGet(pCol2, i);
// printf("%d: %d, %s\n", i, ((int32_t*)pCol1->pData)[i], (char*)varDataVal(p));
// }
//}
#if 0
TEST(testCase, inMem_sort_Test) {
SArray* pOrderVal = taosArrayInit(4, sizeof(SOrder));
SOrder o = {.order = TSDB_ORDER_ASC};
o.col.info.colId = 1;
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)));
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");
taosArrayPush(pExprInfo, &exp1);
SOperatorInfo* pOperator = createOrderOperatorInfo(createDummyOperator(5), pExprInfo, pOrderVal);
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));
for(int32_t i = 0; i < pRes->info.rows; ++i) {
char* p = colDataGet(pCol2, i);
printf("%d: %d, %s\n", i, ((int32_t*)pCol1->pData)[i], (char*)varDataVal(p));
}
}
#endif
typedef struct su {
int32_t v;
......@@ -282,6 +788,7 @@ TEST(testCase, external_sort_Test) {
return;
#endif
#if 0
srand(time(NULL));
SArray* pOrderVal = taosArrayInit(4, sizeof(SOrder));
......@@ -342,5 +849,6 @@ TEST(testCase, external_sort_Test) {
tfree(exp1);
taosArrayDestroy(pExprInfo);
taosArrayDestroy(pOrderVal);
#endif
}
#pragma GCC diagnostic pop
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册