2025-02-13 06:15:54 +01:00
|
|
|
from tests.dialects.test_dialect import Validator
|
|
|
|
|
|
|
|
|
2025-02-13 20:51:40 +01:00
|
|
|
class TestStarrocks(Validator):
|
2025-02-13 06:15:54 +01:00
|
|
|
dialect = "starrocks"
|
|
|
|
|
|
|
|
def test_identity(self):
|
|
|
|
self.validate_identity("SELECT CAST(`a`.`b` AS INT) FROM foo")
|
2025-02-13 15:52:09 +01:00
|
|
|
self.validate_identity("SELECT APPROX_COUNT_DISTINCT(a) FROM x")
|
2025-02-13 14:53:05 +01:00
|
|
|
|
|
|
|
def test_time(self):
|
|
|
|
self.validate_identity("TIMESTAMP('2022-01-01')")
|
2025-02-13 20:51:40 +01:00
|
|
|
self.validate_identity(
|
2025-02-13 21:19:14 +01:00
|
|
|
"SELECT DATE_DIFF('SECOND', '2010-11-30 23:59:59', '2010-11-30 20:58:59')"
|
2025-02-13 20:51:40 +01:00
|
|
|
)
|
|
|
|
self.validate_identity(
|
2025-02-13 21:19:14 +01:00
|
|
|
"SELECT DATE_DIFF('MINUTE', '2010-11-30 23:59:59', '2010-11-30 20:58:59')"
|
2025-02-13 20:51:40 +01:00
|
|
|
)
|
2025-02-13 15:53:39 +01:00
|
|
|
|
|
|
|
def test_regex(self):
|
|
|
|
self.validate_all(
|
2025-02-13 20:51:40 +01:00
|
|
|
"SELECT REGEXP(abc, '%foo%')",
|
|
|
|
read={
|
|
|
|
"mysql": "SELECT REGEXP_LIKE(abc, '%foo%')",
|
2025-02-13 15:53:39 +01:00
|
|
|
"starrocks": "SELECT REGEXP(abc, '%foo%')",
|
|
|
|
},
|
2025-02-13 20:51:40 +01:00
|
|
|
write={
|
|
|
|
"mysql": "SELECT REGEXP_LIKE(abc, '%foo%')",
|
|
|
|
},
|
2025-02-13 15:53:39 +01:00
|
|
|
)
|