11single.mql 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. -- ============================================================
  2. -- 单分区测试
  3. -- ============================================================
  4. -- 1. 插入单分区数据
  5. insert into /test/aaa/test_partition (p_id, p_name, p_value) values (1, 'part1_item1', 100)
  6. ;
  7. insert into /test/aaa/test_partition (p_id, p_name, p_value) values (1, 'part1_item2', 200)
  8. ;
  9. insert into /test/aaa/test_partition (p_id, p_name, p_value) values (2, 'part2_item1', 300)
  10. ;
  11. insert into /test/aaa/test_partition (p_id, p_name, p_value) values (2, 'part2_item2', 400)
  12. ;
  13. -- 2. 查询单分区数据
  14. select * from /test/aaa/test_partition where p_id=1
  15. /**
  16. output()
  17. **/
  18. ;
  19. -- 3. 跨分区查询
  20. select * from /test/aaa/test_partition
  21. /**
  22. output()
  23. **/
  24. ;
  25. -- 4. 按分区聚合
  26. select p_id, count(*) from /test/aaa/test_partition group by p_id
  27. /**
  28. output()
  29. **/
  30. ;
  31. -- 5. 更新单分区数据
  32. update /test/aaa/test_partition set p_value=150 where p_id=1 and p_name='part1_item1'
  33. ;
  34. select p_value from /test/aaa/test_partition where p_id=1 and p_name='part1_item1'
  35. /**
  36. output()
  37. match("p_value","150")
  38. **/
  39. ;
  40. -- 6. 删除单分区数据
  41. delete from /test/aaa/test_partition where p_id=2 and p_name='part2_item2'
  42. ;
  43. select * from /test/aaa/test_partition where p_id=2 and p_name='part2_item2'
  44. /**
  45. output()
  46. count(0)
  47. **/
  48. ;