-- { echoOn } select substringIndex('www.clickhouse.com', '.', -4); www.clickhouse.com select substringIndex('www.clickhouse.com', '.', -3); www.clickhouse.com select substringIndex('www.clickhouse.com', '.', -2); clickhouse.com select substringIndex('www.clickhouse.com', '.', -1); com select substringIndex('www.clickhouse.com', '.', 0); select substringIndex('www.clickhouse.com', '.', 1); www select substringIndex('www.clickhouse.com', '.', 2); www.clickhouse select substringIndex('www.clickhouse.com', '.', 3); www.clickhouse.com select substringIndex('www.clickhouse.com', '.', 4); www.clickhouse.com select substringIndex(materialize('www.clickhouse.com'), '.', -4); www.clickhouse.com select substringIndex(materialize('www.clickhouse.com'), '.', -3); www.clickhouse.com select substringIndex(materialize('www.clickhouse.com'), '.', -2); clickhouse.com select substringIndex(materialize('www.clickhouse.com'), '.', -1); com select substringIndex(materialize('www.clickhouse.com'), '.', 0); select substringIndex(materialize('www.clickhouse.com'), '.', 1); www select substringIndex(materialize('www.clickhouse.com'), '.', 2); www.clickhouse select substringIndex(materialize('www.clickhouse.com'), '.', 3); www.clickhouse.com select substringIndex(materialize('www.clickhouse.com'), '.', 4); www.clickhouse.com select substringIndex(materialize('www.clickhouse.com'), '.', materialize(-4)); www.clickhouse.com select substringIndex(materialize('www.clickhouse.com'), '.', materialize(-3)); www.clickhouse.com select substringIndex(materialize('www.clickhouse.com'), '.', materialize(-2)); clickhouse.com select substringIndex(materialize('www.clickhouse.com'), '.', materialize(-1)); com select substringIndex(materialize('www.clickhouse.com'), '.', materialize(0)); select substringIndex(materialize('www.clickhouse.com'), '.', materialize(1)); www select substringIndex(materialize('www.clickhouse.com'), '.', materialize(2)); www.clickhouse select substringIndex(materialize('www.clickhouse.com'), '.', materialize(3)); www.clickhouse.com select substringIndex(materialize('www.clickhouse.com'), '.', materialize(4)); www.clickhouse.com select substringIndex('www.clickhouse.com', '.', materialize(-4)); www.clickhouse.com select substringIndex('www.clickhouse.com', '.', materialize(-3)); www.clickhouse.com select substringIndex('www.clickhouse.com', '.', materialize(-2)); clickhouse.com select substringIndex('www.clickhouse.com', '.', materialize(-1)); com select substringIndex('www.clickhouse.com', '.', materialize(0)); select substringIndex('www.clickhouse.com', '.', materialize(1)); www select substringIndex('www.clickhouse.com', '.', materialize(2)); www.clickhouse select substringIndex('www.clickhouse.com', '.', materialize(3)); www.clickhouse.com select substringIndex('www.clickhouse.com', '.', materialize(4)); www.clickhouse.com select SUBSTRING_INDEX('www.clickhouse.com', '.', 2); www.clickhouse select substringIndex('www.clickhouse.com', '..', 2); -- { serverError BAD_ARGUMENTS } select substringIndex('www.clickhouse.com', '', 2); -- { serverError BAD_ARGUMENTS } select substringIndex('www.clickhouse.com', materialize('.'), 2); -- { serverError ILLEGAL_COLUMN } select substringIndex('www.clickhouse.com', '.', cast(2 as Int128)); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT } select substringIndexUTF8('富强,民主,文明', ',', -4); 富强,民主,文明 select substringIndexUTF8('富强,民主,文明', ',', -3); 富强,民主,文明 select substringIndexUTF8('富强,民主,文明', ',', -2); 民主,文明 select substringIndexUTF8('富强,民主,文明', ',', -1); 文明 select substringIndexUTF8('富强,民主,文明', ',', 0); select substringIndexUTF8('富强,民主,文明', ',', 1); 富强 select substringIndexUTF8('富强,民主,文明', ',', 2); 富强,民主 select substringIndexUTF8('富强,民主,文明', ',', 3); 富强,民主,文明 select substringIndexUTF8('富强,民主,文明', ',', 4); 富强,民主,文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', -4); 富强,民主,文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', -3); 富强,民主,文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', -2); 民主,文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', -1); 文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', 0); select substringIndexUTF8(materialize('富强,民主,文明'), ',', 1); 富强 select substringIndexUTF8(materialize('富强,民主,文明'), ',', 2); 富强,民主 select substringIndexUTF8(materialize('富强,民主,文明'), ',', 3); 富强,民主,文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', 4); 富强,民主,文明 select substringIndexUTF8('富强,民主,文明', ',', materialize(-4)); 富强,民主,文明 select substringIndexUTF8('富强,民主,文明', ',', materialize(-3)); 富强,民主,文明 select substringIndexUTF8('富强,民主,文明', ',', materialize(-2)); 民主,文明 select substringIndexUTF8('富强,民主,文明', ',', materialize(-1)); 文明 select substringIndexUTF8('富强,民主,文明', ',', materialize(0)); select substringIndexUTF8('富强,民主,文明', ',', materialize(1)); 富强 select substringIndexUTF8('富强,民主,文明', ',', materialize(2)); 富强,民主 select substringIndexUTF8('富强,民主,文明', ',', materialize(3)); 富强,民主,文明 select substringIndexUTF8('富强,民主,文明', ',', materialize(4)); 富强,民主,文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', materialize(-4)); 富强,民主,文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', materialize(-3)); 富强,民主,文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', materialize(-2)); 民主,文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', materialize(-1)); 文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', materialize(0)); select substringIndexUTF8(materialize('富强,民主,文明'), ',', materialize(1)); 富强 select substringIndexUTF8(materialize('富强,民主,文明'), ',', materialize(2)); 富强,民主 select substringIndexUTF8(materialize('富强,民主,文明'), ',', materialize(3)); 富强,民主,文明 select substringIndexUTF8(materialize('富强,民主,文明'), ',', materialize(4)); 富强,民主,文明 select substringIndexUTF8('富强,民主,文明', ',,', 2); -- { serverError BAD_ARGUMENTS } select substringIndexUTF8('富强,民主,文明', '', 2); -- { serverError BAD_ARGUMENTS } select substringIndexUTF8('富强,民主,文明', materialize(','), 2); -- { serverError ILLEGAL_COLUMN } select substringIndexUTF8('富强,民主,文明', ',', cast(2 as Int128)); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }