我有一张这样的table:
+-----+-----------------------+
| id | word |
+---+-------------------------+
| 1 | today is a nice day |
| 2 | hello world |
| 3 | he is good |
| 4 | is it raining? |
+-----+-----------------------+
我想得到一个子串的位置( is
)在 word
仅当列出现在第3个位置之后时
+-----+-----------------------+-----------------+
| id | word | substr_position|
+---+-------------------------+-----------------+
| 1 | today is a nice day | 7 |
| 2 | hello world | 0 |
| 3 | he is good | 4 |
| 4 | is it raining? | 0 |
+-----+-----------------------+-----------------+
有什么帮助吗?
1条答案
按热度按时间2skhul331#
您可以使用spark中的定位功能。
它返回字符串列中第一个出现的子字符串,位于特定位置之后。