startswith.sql 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* syntax version 1 */
  2. /* postgres can not */
  3. /* dq can not */
  4. /* dqfile can not */
  5. /* yt can not */
  6. pragma warning("disable", "4510");
  7. -- string/string
  8. select YQL::RangeComputeFor(
  9. Struct<x:String>,
  10. ($row) -> (StartsWith($row.x, 'foo')),
  11. AsTuple(AsAtom("x"))
  12. );
  13. select YQL::RangeComputeFor(
  14. Struct<x:String>,
  15. ($row) -> (not StartsWith($row.x, 'foo')),
  16. AsTuple(AsAtom("x"))
  17. );
  18. select YQL::RangeComputeFor(
  19. Struct<x:String>,
  20. ($row) -> (StartsWith($row.x, '\xff\xff')),
  21. AsTuple(AsAtom("x"))
  22. );
  23. select YQL::RangeComputeFor(
  24. Struct<x:String>,
  25. ($row) -> (not StartsWith($row.x, '\xff\xff')),
  26. AsTuple(AsAtom("x"))
  27. );
  28. -- optional string/string
  29. select YQL::RangeComputeFor(
  30. Struct<x:String?>,
  31. ($row) -> ((not StartsWith($row.x, 'foo')) ?? false),
  32. AsTuple(AsAtom("x"))
  33. );
  34. -- optional string/optional string
  35. select YQL::RangeComputeFor(
  36. Struct<x:String?>,
  37. ($row) -> (StartsWith($row.x, if(1 > 2, 'void')) ?? false),
  38. AsTuple(AsAtom("x"))
  39. );
  40. --utf8/string
  41. select YQL::RangeComputeFor(
  42. Struct<x:Utf8>,
  43. ($row) -> (StartsWith($row.x, 'тест')),
  44. AsTuple(AsAtom("x"))
  45. );
  46. select YQL::RangeComputeFor(
  47. Struct<x:Utf8>,
  48. ($row) -> (StartsWith($row.x, 'тест\xf5')),
  49. AsTuple(AsAtom("x"))
  50. );
  51. --optional utf8/utf8
  52. select YQL::RangeComputeFor(
  53. Struct<x:Utf8?>,
  54. ($row) -> ((not StartsWith($row.x, 'тест'u)) ?? false),
  55. AsTuple(AsAtom("x"))
  56. );
  57. select YQL::RangeComputeFor(
  58. Struct<x:Utf8?>,
  59. ($row) -> (StartsWith($row.x, '\xf4\x8f\xbf\xbf'u) ?? false),
  60. AsTuple(AsAtom("x"))
  61. );
  62. -- optional utf8/string
  63. select YQL::RangeComputeFor(
  64. Struct<x:Utf8?>,
  65. ($row) -> ((not StartsWith($row.x, 'тест\xf5')) ?? false),
  66. AsTuple(AsAtom("x"))
  67. );