-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented numerous existing operations (#723)
progress on #722 Added: * hash * lower * round * sqrt * upper * zip_max * zip_min
- Loading branch information
Showing
21 changed files
with
326 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,6 @@ grouping | |
logical | ||
misc | ||
records | ||
string | ||
time | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# String | ||
|
||
```{eval-rst} | ||
.. currentmodule:: kaskada | ||
.. autosummary:: | ||
:toctree: ../apidocs/ | ||
Timestream.lower | ||
Timestream.upper | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"A","a":5.7,"b":1.2,"a_greatest_b":5.7} | ||
{"_time":"2021-01-02T00:00:00.000000000","_key":"A","a":6.3,"b":0.4,"a_greatest_b":6.3} | ||
{"_time":"2021-01-03T00:00:00.000000000","_key":"B","a":null,"b":3.7,"a_greatest_b":null} | ||
{"_time":"2021-01-04T00:00:00.000000000","_key":"A","a":13.2,"b":null,"a_greatest_b":null} | ||
{"_time":"2021-01-05T00:00:00.000000000","_key":"A","a":2.0,"b":5.4,"a_greatest_b":5.4} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"Ben","m":5.0,"hash_m":16461383214845928621} | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"Ryan","m":8.0,"hash_m":6794973171266502674} | ||
{"_time":"2021-01-02T00:00:00.000000000","_key":"Ryan","m":9.0,"hash_m":15653042715643359010} | ||
{"_time":"2021-01-03T00:00:00.000000000","_key":"Ben","m":8.0,"hash_m":6794973171266502674} | ||
{"_time":"2021-01-04T00:00:00.000000000","_key":"Ben","m":null,"hash_m":0} | ||
{"_time":"2021-01-04T00:00:00.000000000","_key":"Ryan","m":9.0,"hash_m":15653042715643359010} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"Ben","m":"hello","hash_m":1472103086483932002} | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"Ryan","m":null,"hash_m":0} | ||
{"_time":"2021-01-02T00:00:00.000000000","_key":"Ryan","m":"world","hash_m":8057155968893317866} | ||
{"_time":"2021-01-03T00:00:00.000000000","_key":"Ben","m":"hi","hash_m":2460612554838835252} | ||
{"_time":"2021-01-04T00:00:00.000000000","_key":"Ben","m":" ","hash_m":14894517190786516170} | ||
{"_time":"2021-01-04T00:00:00.000000000","_key":"Ryan","m":"earth","hash_m":14489671231712828724} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"A","a":5.7,"b":1.2,"a_least_b":1.2} | ||
{"_time":"2021-01-02T00:00:00.000000000","_key":"A","a":6.3,"b":0.4,"a_least_b":0.4} | ||
{"_time":"2021-01-03T00:00:00.000000000","_key":"B","a":null,"b":3.7,"a_least_b":null} | ||
{"_time":"2021-01-04T00:00:00.000000000","_key":"A","a":13.2,"b":null,"a_least_b":null} | ||
{"_time":"2021-01-05T00:00:00.000000000","_key":"A","a":2.0,"b":5.4,"a_least_b":2.0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"Ben","m":"Hello World","lower_m":"hello world"} | ||
{"_time":"2021-01-02T00:00:00.000000000","_key":"Ryan","m":null,"lower_m":null} | ||
{"_time":"2021-01-02T00:00:00.000000000","_key":"Ryan","m":"Hi Earth","lower_m":"hi earth"} | ||
{"_time":"2021-01-03T00:00:00.000000000","_key":"Ben","m":"Hello","lower_m":"hello"} | ||
{"_time":"2021-01-03T00:00:00.000000000","_key":"Ben","m":null,"lower_m":null} | ||
{"_time":"2021-01-04T00:00:00.000000000","_key":"Ryan","m":"hi","lower_m":"hi"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"A","m":5.7,"round_m":6.0} | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"A","m":6.3,"round_m":6.0} | ||
{"_time":"2021-01-02T00:00:00.000000000","_key":"B","m":null,"round_m":null} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"A","m":5.7,"sqrt_m":2.3874672773} | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"A","m":6.3,"sqrt_m":2.5099800796} | ||
{"_time":"2021-01-02T00:00:00.000000000","_key":"B","m":null,"sqrt_m":null} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{"_time":"2021-01-01T00:00:00.000000000","_key":"Ben","m":"Hello World","upper_m":"HELLO WORLD"} | ||
{"_time":"2021-01-02T00:00:00.000000000","_key":"Ryan","m":null,"upper_m":null} | ||
{"_time":"2021-01-02T00:00:00.000000000","_key":"Ryan","m":"Hi Earth","upper_m":"HI EARTH"} | ||
{"_time":"2021-01-03T00:00:00.000000000","_key":"Ben","m":"Hello","upper_m":"HELLO"} | ||
{"_time":"2021-01-03T00:00:00.000000000","_key":"Ben","m":null,"upper_m":null} | ||
{"_time":"2021-01-04T00:00:00.000000000","_key":"Ryan","m":"hi","upper_m":"HI"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import kaskada as kd | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def source() -> kd.sources.CsvString: | ||
content = "\n".join( | ||
[ | ||
"time,key,a,b", | ||
"2021-01-01T00:00:00,A,5.7,1.2", | ||
"2021-01-02T00:00:00,A,6.3,0.4", | ||
"2021-01-03T00:00:00,B,,3.7", | ||
"2021-01-04T00:00:00,A,13.2,", | ||
"2021-01-05T00:00:00,A,2,5.4", | ||
] | ||
) | ||
return kd.sources.CsvString(content, time_column="time", key_column="key") | ||
|
||
|
||
def test_greatest(source, golden) -> None: | ||
a = source.col("a") | ||
b = source.col("b") | ||
golden.jsonl(kd.record({"a": a, "b": b, "a_greatest_b": a.greatest(b)})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import kaskada as kd | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def string_source() -> kd.sources.CsvString: | ||
content = "\n".join( | ||
[ | ||
"time,key,m,n", | ||
"2021-01-01T00:00:00,Ben,hello,", | ||
"2021-01-01T00:00:00,Ryan,,", | ||
"2021-01-02T00:00:00,Ryan,world,", | ||
"2021-01-03T00:00:00,Ben,hi,", | ||
"2021-01-04T00:00:00,Ben, ,", | ||
"2021-01-04T00:00:00,Ryan,earth,", | ||
] | ||
) | ||
return kd.sources.CsvString(content, time_column="time", key_column="key") | ||
|
||
|
||
def test_hash_string(string_source, golden) -> None: | ||
m = string_source.col("m") | ||
golden.jsonl(kd.record({"m": m, "hash_m": m.hash()})) | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def integer_source() -> kd.sources.CsvString: | ||
content = "\n".join( | ||
[ | ||
"time,key,m,n", | ||
"2021-01-01T00:00:00,Ben,5,", | ||
"2021-01-01T00:00:00,Ryan,8,", | ||
"2021-01-02T00:00:00,Ryan,9,", | ||
"2021-01-03T00:00:00,Ben,8,", | ||
"2021-01-04T00:00:00,Ben,,", | ||
"2021-01-04T00:00:00,Ryan,9,", | ||
] | ||
) | ||
return kd.sources.CsvString(content, time_column="time", key_column="key") | ||
|
||
|
||
def test_hash_integer(integer_source, golden) -> None: | ||
m = integer_source.col("m") | ||
golden.jsonl(kd.record({"m": m, "hash_m": m.hash()})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import kaskada as kd | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def source() -> kd.sources.CsvString: | ||
content = "\n".join( | ||
[ | ||
"time,key,a,b", | ||
"2021-01-01T00:00:00,A,5.7,1.2", | ||
"2021-01-02T00:00:00,A,6.3,0.4", | ||
"2021-01-03T00:00:00,B,,3.7", | ||
"2021-01-04T00:00:00,A,13.2,", | ||
"2021-01-05T00:00:00,A,2,5.4", | ||
] | ||
) | ||
return kd.sources.CsvString(content, time_column="time", key_column="key") | ||
|
||
|
||
def test_least(source, golden) -> None: | ||
a = source.col("a") | ||
b = source.col("b") | ||
golden.jsonl(kd.record({"a": a, "b": b, "a_least_b": a.least(b)})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import kaskada as kd | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def source() -> kd.sources.CsvString: | ||
content = "\n".join( | ||
[ | ||
"time,key,m", | ||
"2021-01-01T00:00:00,Ben,Hello World", | ||
"2021-01-02T00:00:00,Ryan,", | ||
"2021-01-02T00:00:00,Ryan,Hi Earth", | ||
"2021-01-03T00:00:00,Ben,Hello", | ||
"2021-01-03T00:00:00,Ben,", | ||
"2021-01-04T00:00:00,Ryan,hi", | ||
] | ||
) | ||
return kd.sources.CsvString(content, time_column="time", key_column="key") | ||
|
||
|
||
def test_lower(source, golden) -> None: | ||
m = source.col("m") | ||
golden.jsonl(kd.record({"m": m, "lower_m": m.lower()})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import kaskada as kd | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def source() -> kd.sources.CsvString: | ||
content = "\n".join( | ||
[ | ||
"time,key,m", | ||
"2021-01-01T00:00:00,A,5.7", | ||
"2021-01-01T00:00:00,A,6.3", | ||
"2021-01-02T00:00:00,B,", | ||
] | ||
) | ||
return kd.sources.CsvString(content, time_column="time", key_column="key") | ||
|
||
|
||
def test_round(source, golden) -> None: | ||
m = source.col("m") | ||
golden.jsonl(kd.record({"m": m, "round_m": m.round()})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import kaskada as kd | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def source() -> kd.sources.CsvString: | ||
content = "\n".join( | ||
[ | ||
"time,key,m", | ||
"2021-01-01T00:00:00,A,5.7", | ||
"2021-01-01T00:00:00,A,6.3", | ||
"2021-01-02T00:00:00,B,", | ||
] | ||
) | ||
return kd.sources.CsvString(content, time_column="time", key_column="key") | ||
|
||
|
||
def test_sqrt(source, golden) -> None: | ||
m = source.col("m") | ||
golden.jsonl(kd.record({"m": m, "sqrt_m": m.sqrt()})) |
Oops, something went wrong.